20 for(
int i=0; i < s1.size(); ++i)
38 goffsets.resize(nodeSites);
39 srcnode.resize(nodeSites);
40 dstnode.resize(nodeSites);
45 for(
int linear=0; linear < nodeSites; ++linear)
51 multi1d<int> fcoord = func(coord,+1);
55 multi1d<int> bcoord = func(coord,-1);
62 srcnode[linear] = fnode;
65 dstnode[linear] = bnode;
68 QDP_info(
"linear=%d coord=%d %d %d %d fcoord=%d %d %d %d goffsets=%d",
70 coord[0], coord[1], coord[2], coord[3],
71 fcoord[0], fcoord[1], fcoord[2], fcoord[3],
78 for(
int linear=0; linear < nodeSites; ++linear)
80 QDP_info(
"goffsets(%d) = %d",linear,goffsets(linear));
81 QDP_info(
"srcnode(%d) = %d",linear,srcnode(linear));
82 QDP_info(
"dstnode(%d) = %d",linear,dstnode(linear));
95 int cnt_srcenodes = 0;
96 for(
int i=0; i < srcenodes_tmp.size(); ++i)
97 if (srcenodes_tmp[i] != my_node)
100 int cnt_destnodes = 0;
101 for(
int i=0; i < destnodes_tmp.size(); ++i)
102 if (destnodes_tmp[i] != my_node)
107 for(
int i=0; i < srcenodes_tmp.size(); ++i)
108 QDP_info(
"srcenodes_tmp(%d) = %d",i,srcenodes_tmp[i]);
110 for(
int i=0; i < destnodes_tmp.size(); ++i)
111 QDP_info(
"destnodes_tmp(%d) = %d",i,destnodes_tmp[i]);
113 QDP_info(
"cnt_srcenodes = %d", cnt_srcenodes);
114 QDP_info(
"cnt_destnodes = %d", cnt_destnodes);
119 if (cnt_srcenodes > 0 && cnt_destnodes == 0)
120 QDP_error_exit(
"Map: some bizarre error - no dest nodes but have srce nodes");
122 if (cnt_srcenodes == 0 && cnt_destnodes > 0)
123 QDP_error_exit(
"Map: some bizarre error - no srce nodes but have dest nodes");
126 offnodeP = (cnt_srcenodes > 0) ?
true : false;
141 srcenodes.resize(cnt_srcenodes);
142 destnodes.resize(cnt_destnodes);
144 for(
int i=0, j=0; i < srcenodes_tmp.size(); ++i)
145 if (srcenodes_tmp[i] != my_node)
146 srcenodes[j++] = srcenodes_tmp[i];
148 for(
int i=0, j=0; i < destnodes_tmp.size(); ++i)
149 if (destnodes_tmp[i] != my_node)
150 destnodes[j++] = destnodes_tmp[i];
154 for(
int i=0; i < srcenodes.size(); ++i)
155 QDP_info(
"srcenodes(%d) = %d",i,srcenodes(i));
157 for(
int i=0; i < destnodes.size(); ++i)
158 QDP_info(
"destnodes(%d) = %d",i,destnodes(i));
163 srcenodes_num.resize(srcenodes.size());
164 destnodes_num.resize(destnodes.size());
169 for(
int linear=0; linear < nodeSites; ++linear)
171 int this_node = srcnode[linear];
172 if (this_node != my_node)
173 for(
int i=0; i < srcenodes_num.size(); ++i)
175 if (srcenodes[i] == this_node)
182 int that_node = dstnode[linear];
183 if (that_node != my_node)
184 for(
int i=0; i < destnodes_num.size(); ++i)
186 if (destnodes[i] == that_node)
196 for(
int i=0; i < destnodes.size(); ++i)
198 QDP_info(
"srcenodes(%d) = %d",i,srcenodes(i));
199 QDP_info(
"destnodes(%d) = %d",i,destnodes(i));
202 for(
int i=0; i < destnodes_num.size(); ++i)
204 QDP_info(
"srcenodes_num(%d) = %d",i,srcenodes_num(i));
205 QDP_info(
"destnodes_num(%d) = %d",i,destnodes_num(i));
211 if (srcenodes.size() != 1)
214 if (destnodes.size() != 1)
222 soffsets.resize(destnodes_num[0]);
227 for(
int i=0, si=0; i < nodeSites; ++i)
231 multi1d<int> fcoord = func(coord,+1);
235 if (fnode == my_node)
236 soffsets[si++] = fline;
241 for(
int i=0; i < soffsets.size(); ++i)
242 QDP_info(
"soffsets(%d) = %d",i,soffsets(i));
267 lleng = result.length();
274 dd_tmp =
new char[lleng];
275 if( dd_tmp == 0x0 ) {
280 memcpy(dd_tmp, result.c_str(), lleng);
289 result.assign(dd_tmp, lleng);
298 void route(
void *buffer,
int srce_node,
int dest_node,
int count)
301 QDP_info(
"starting a route, count=%d, srcenode=%d destnode=%d",
302 count,srce_node,dest_node);
315 sendToWait(
void *send_buf,
int dest_node,
int count)
318 QDP_info(
"starting a sendToWait, count=%d, destnode=%d", count,dest_node);
321 QMP_msgmem_t request_msg = QMP_declare_msgmem(send_buf, count);
322 QMP_msghandle_t request_mh = QMP_declare_send_to(request_msg, dest_node, 0);
324 if (QMP_start(request_mh) != QMP_SUCCESS)
327 QMP_wait(request_mh);
329 QMP_free_msghandle(request_mh);
330 QMP_free_msgmem(request_msg);
342 QDP_info(
"starting a recvFromWait, count=%d, srcenode=%d", count, srce_node);
345 QMP_msgmem_t request_msg = QMP_declare_msgmem(recv_buf, count);
346 QMP_msghandle_t request_mh = QMP_declare_receive_from(request_msg, srce_node, 0);
348 if (QMP_start(request_mh) != QMP_SUCCESS)
351 QMP_wait(request_mh);
353 QMP_free_msghandle(request_mh);
354 QMP_free_msgmem(request_msg);
357 QDP_info(
"finished a recvFromWait");
378 size_t size =
sizeof(
REAL32);
379 size_t su3_size = size*mat_size;
385 for(
int dd=0; dd<
Nd; dd++)
387 sa[dd].resize(nodeSites);
391 char *chk_buf =
new(nothrow)
char[su3_size];
392 if( chk_buf == 0x0 ) {
396 for(
int linear=0; linear < nodeSites; ++linear)
398 for(
int dd=0; dd<
Nd; dd++)
406 for(
int kk=0; kk<
Nc; kk++)
407 for(
int ii=0; ii<2; ii++)
414 memcpy(chk_buf, &(su3[0][0][0]), su3_size);
422 for(
int kk=0; kk<
Nc; kk++)
423 for(
int ii=0; ii<
Nc; ii++)
430 memcpy(chk_buf, &(su3[0][0][0]), su3_size);
435 QDPIO::cerr << __func__ <<
": unexpected size" << std::endl;
441 for(
int i=0; i < mat_size*size/
sizeof(
n_uint32_t); ++i)
442 checksum += chk_ptr[i];
469 n_uint32_t& checksum,
int mat_size,
int float_size)
481 for(
int dd=0; dd<
Nd; dd++)
484 cfg_in.readArray((
char *)&(su3[0][0][0]),
sizeof(
float), mat_size);
491 su3[2][0][0] = su3[0][1][0]*su3[1][2][0] - su3[0][1][1]*su3[1][2][1]
492 - su3[0][2][0]*su3[1][1][0] + su3[0][2][1]*su3[1][1][1];
493 su3[2][0][1] = su3[0][2][0]*su3[1][1][1] + su3[0][2][1]*su3[1][1][0]
494 - su3[0][1][0]*su3[1][2][1] - su3[0][1][1]*su3[1][2][0];
496 su3[2][1][0] = su3[0][2][0]*su3[1][0][0] - su3[0][2][1]*su3[1][0][1]
497 - su3[0][0][0]*su3[1][2][0] + su3[0][0][1]*su3[1][2][1];
498 su3[2][1][1] = su3[0][0][0]*su3[1][2][1] + su3[0][0][1]*su3[1][2][0]
499 - su3[0][2][0]*su3[1][0][1] - su3[0][2][1]*su3[1][0][0];
501 su3[2][2][0] = su3[0][0][0]*su3[1][1][0] - su3[0][0][1]*su3[1][1][1]
502 - su3[0][1][0]*su3[1][0][0] + su3[0][1][1]*su3[1][0][1];
503 su3[2][2][1] = su3[0][1][0]*su3[1][0][1] + su3[0][1][1]*su3[1][0][0]
504 - su3[0][0][0]*su3[1][1][1] - su3[0][0][1]*su3[1][1][0];
508 for(
int kk=0; kk<
Nc; kk++)
510 for(
int ii=0; ii<
Nc; ii++)
512 Real re = su3[ii][kk][0];
513 Real im = su3[ii][kk][1];
522 checksum += *(
n_uint32_t*)(su3+(((ii)*3+kk)*2+0));
523 checksum += *(
n_uint32_t*)(su3+(((ii)*3+kk)*2+1));
529 checksum += *(
n_uint32_t*)(su3+(((ii)*3+kk)*2+0));
530 checksum += *(
n_uint32_t*)(su3+(((ii)*3+kk)*2+1));
562 for(
int dd=0; dd<
Nd; dd++)
566 if ( mat_size == 12 )
568 for(
int kk=0; kk <
Nc; kk++)
569 for(
int ii=0; ii <
Nc-1; ii++)
578 for(
int kk=0; kk <
Nc; kk++)
579 for(
int ii=0; ii <
Nc; ii++)
588 cfg_out.writeArrayPrimaryNode((
char *)&(su3[0][0][0]),
sizeof(
float), mat_size);
Binary writer base class.
void make(const MapFunc &func)
Actual constructor from a function object.
Container for a multi-dimensional 1D array.
int DML_route_bytes(char *buf, size_t size, int fromnode, int tonode)
OScalar< PScalar< PScalar< RComplex< REAL > > > > Complex
OScalar< PScalar< PColorMatrix< RComplex< REAL >, Nc > > > ColorMatrix
OScalar< PScalar< PScalar< RScalar< REAL > > > > Real
void QDP_extract(multi1d< OScalar< T > > &dest, const OLattice< T > &src, const Subset &s)
Copy data values from field src to array dest.
OLattice< T1 > & pokeSite(OLattice< T1 > &l, const OScalar< T1 > &r, const multi1d< int > &coord)
Insert site element.
OScalar< T1 > peekSite(const OScalar< T1 > &l, const multi1d< int > &coord)
Extract site element.
void readArchiv(BinaryReader &cfg_in, multi1d< LatticeColorMatrix > &u, n_uint32_t &checksum, int mat_size, int float_size)
Read a NERSC Gauge Connection Archive file.
TextWriter & operator<<(TextWriter &txt, const std::string &output)
void writeArchiv(BinaryWriter &cfg_out, const multi1d< LatticeColorMatrix > &u, int mat_size)
Writes a NERSC Gauge Connection Archive gauge configuration file.
float toFloat(const IScalar< T > &s)
QDP Real to float primitive in conversion routine.
Subset all
Default all subset.
int nodeNumber()
Returns the node number of this node.
int linearSiteIndex(int site)
The linearized site index for the corresponding lexicographic site.
int sitesOnNode()
Subgrid lattice volume.
multi1d< int > siteCoords(int node, int index) QDP_CONST
Reconstruct the lattice coordinate from the node and site number.
const multi1d< int > & lattSize()
Virtual grid (problem grid) lattice size.
int vol()
Total lattice volume.
bool primaryNode()
Returns whether this is the primary node.
StandardOutputStream cerr
void broadcast(T &dest)
Broadcast from primary node to all other nodes.
void sendToWait(void *send_buf, int dest_node, int count)
Send to another node (wait).
void route(void *buffer, int srce_node, int dest_node, int count)
Route to another node (blocking).
void recvFromWait(void *recv_buf, int srce_node, int count)
Receive from another node (wait).
void broadcast_str(std::string &result)
Broadcast a string from primary node to all other nodes.
void globalSumArray(unsigned int *dest, int len)
Wrapper to get a functional unsigned global sum.
Yet another random number generator.
MakeReturn< UnaryNode< FnReal, typenameCreateLeaf< QDPExpr< T1, C1 > >::Leaf_t >, typenameUnaryReturn< C1, FnReal >::Type_t >::Expression_t real(const QDPExpr< T1, C1 > &l)
MakeReturn< UnaryNode< FnPeekColorMatrix, typenameCreateLeaf< QDPExpr< T1, C1 > >::Leaf_t >, C1 >::Expression_t peekColor(const QDPExpr< T1, C1 > &l, int row, int col)
void QDP_error_exit(const char *format,...)
Simple error display and abort routine.
multi1d< int > uniquify_list(const multi1d< int > &ll)
Unique-ify a list.
C1 & pokeColor(QDPType< T1, C1 > &l, const QDPExpr< T2, C2 > &r, int row, int col)
MakeReturn< BinaryNode< FnCmplx, typenameCreateLeaf< QDPType< T1, C1 > >::Leaf_t, typenameCreateLeaf< QDPExpr< T2, C2 > >::Leaf_t >, typenameBinaryReturn< C1, C2, FnCmplx >::Type_t >::Expression_t cmplx(const QDPType< T1, C1 > &l, const QDPExpr< T2, C2 > &r)
n_uint32_t computeChecksum(const multi1d< LatticeColorMatrix > &u, int mat_size)
Compute simple NERSC-like checksum of a gauge field.
MakeReturn< UnaryNode< FnImag, typenameCreateLeaf< QDPExpr< T1, C1 > >::Leaf_t >, typenameUnaryReturn< C1, FnImag >::Type_t >::Expression_t imag(const QDPExpr< T1, C1 > &l)
multi1d< int > crtesn(int ipos, const multi1d< int > &latt_size)
Decompose a lexicographic site into coordinates.
int QDP_info(const char *format,...)
Simple information display routine.
Primary include file for QDP.