34 LatticeColorMatrix& Umufield)
36 int localsiteindex=Layout::linearSiteIndex(
coord);
37 ColorMatrix locColMat;
39 for (
int row=0;row<QDP::Nc;row++)
40 for (
int col=0;col<QDP::Nc;col++){
41 Complex sitecomp=cmplx(Real64(buf[
count]),Real64(buf[
count+1]));
42 pokeColor(locColMat,sitecomp,row,col);
44 Umufield.elem(localsiteindex) = locColMat.elem();
50 int NX,
int NY,
int NZ,
int NT, multi1d<LatticeColorMatrix>&
u,
54 vector<double> cmbuf(8*lcbz*linkdbles);
56 #if defined(ARCH_PARSCALAR) || defined(ARCH_PARSCALARVEC)
57 if (Layout::primaryNode()){
59 for (
int dir=0;dir<8;dir+=2)
60 for (
int lz=0;
lz<lcbz;
lz++){
61 int indstart=(8*
lz+dir)*linkdbles;
62 for (
int k=0;
k<linkdbles;
k++)
63 cmbuf[
count++]=rdbuf[indstart+
k];}
64 for (
int dir=7;dir>0;dir-=2)
65 for (
int lz=lcbz-1;
lz>=0;
lz--){
66 int indstart=(8*
lz+dir)*linkdbles;
67 for (
int k=0;
k<linkdbles;
k++)
68 cmbuf[
count++]=rdbuf[indstart+
k];}
69 #if defined(ARCH_PARSCALAR) || defined(ARCH_PARSCALARVEC)
73 int zkeep,ykeep,xkeep,tkeep,xshift,yshift,zshift,shift;
75 #if defined(ARCH_PARSCALAR) || defined(ARCH_PARSCALARVEC)
78 int cnode=Layout::nodeNumber(
coord);
81 int tmnode=Layout::nodeNumber(
coord);
85 int xmnode=Layout::nodeNumber(
coord);
89 int ymnode=Layout::nodeNumber(
coord);
93 int zmnode=Layout::nodeNumber(
coord);
97 size_t dbsize=
sizeof(double);
98 if ((cnode==tmnode)&&(cnode==xmnode)&&(cnode==ymnode)&&(cnode==zmnode)){
99 size_t bytes=8*lcbz*linkdbles*dbsize;
101 if (Layout::primaryNode())
102 QDPInternal::sendToWait((
void *)&cmbuf[0],cnode,bytes);
103 if (Layout::nodeNumber() == cnode)
104 QDPInternal::recvFromWait((
void *)&cmbuf[0],0,bytes);}}
107 size_t bytes=(5*lcbz-((cnode!=zmnode)?1:0))*linkdbles*dbsize;
108 if (Layout::primaryNode())
109 QDPInternal::sendToWait((
void *)&cmbuf[0],cnode,bytes);
110 if (Layout::nodeNumber() == cnode)
111 QDPInternal::recvFromWait((
void *)&cmbuf[0],0,bytes);}
112 count=(5*lcbz-1)*linkdbles;
113 if ((zmnode!=cnode)&&(zmnode!=0)){
114 size_t bytes=linkdbles*dbsize;
115 if (Layout::primaryNode())
116 QDPInternal::sendToWait((
void *)&cmbuf[
count],zmnode,bytes);
117 if (Layout::nodeNumber() == zmnode)
118 QDPInternal::recvFromWait((
void *)&cmbuf[
count],0,bytes);}
119 count=5*lcbz*linkdbles;
120 size_t bytes=lcbz*linkdbles*dbsize;
122 if (Layout::primaryNode())
123 QDPInternal::sendToWait((
void *)&cmbuf[
count],ymnode,bytes);
124 if (Layout::nodeNumber() == ymnode)
125 QDPInternal::recvFromWait((
void *)&cmbuf[
count],0,bytes);}
126 count=6*lcbz*linkdbles;
128 if (Layout::primaryNode())
129 QDPInternal::sendToWait((
void *)&cmbuf[
count],xmnode,bytes);
130 if (Layout::nodeNumber() == xmnode)
131 QDPInternal::recvFromWait((
void *)&cmbuf[
count],0,bytes);}
132 count=7*lcbz*linkdbles;
134 if (Layout::primaryNode())
135 QDPInternal::sendToWait((
void *)&cmbuf[
count],tmnode,bytes);
136 if (Layout::nodeNumber() == tmnode)
137 QDPInternal::recvFromWait((
void *)&cmbuf[
count],0,bytes);}}
140 if (Layout::nodeNumber()==cnode){
143 xshift=lcbz*linkdbles;
144 yshift=2*lcbz*linkdbles;
145 zshift=3*lcbz*linkdbles;
147 for (
int lz=0;
lz<lcbz;
lz++,shift+=linkdbles){
153 coord[2]=zkeep+2*(lcbz-1)-1;
154 shift=4*lcbz*linkdbles;
155 for (
int lz=1;
lz<lcbz;
lz++,shift+=linkdbles){
159 #if defined(ARCH_PARSCALAR) || defined(ARCH_PARSCALARVEC)
162 if (Layout::nodeNumber()==zmnode){
166 shift=(5*lcbz-1)*linkdbles;
169 #if defined(ARCH_PARSCALAR) || defined(ARCH_PARSCALARVEC)
172 if (Layout::nodeNumber()==ymnode){
176 coord[2]=zkeep+2*(lcbz-1);
178 shift=5*lcbz*linkdbles;
179 for (
int lz=0;
lz<lcbz;
lz++,shift+=linkdbles){
184 #if defined(ARCH_PARSCALAR) || defined(ARCH_PARSCALARVEC)
187 if (Layout::nodeNumber()==xmnode){
191 coord[2]=zkeep+2*(lcbz-1);
193 shift=6*lcbz*linkdbles;
194 for (
int lz=0;
lz<lcbz;
lz++,shift+=linkdbles){
199 #if defined(ARCH_PARSCALAR) || defined(ARCH_PARSCALARVEC)
202 if (Layout::nodeNumber()==tmnode){
206 coord[2]=zkeep+2*(lcbz-1);
208 shift=7*lcbz*linkdbles;
209 for (
int lz=0;
lz<lcbz;
lz++,shift+=linkdbles){
214 #if defined(ARCH_PARSCALAR) || defined(ARCH_PARSCALARVEC)
225 if ((
sizeof(
int)!=4)||(
sizeof(
double)!=8)){
226 QDPIO::cout <<
"CERN files contain 4-byte ints, 8-byte doubles"<<std::endl;
229 QDPIO::cout <<
"readCERN only supports Nc=3"<<std::endl;
232 QDPIO::cout <<
"readCERN only supported for 4 space-time dimensions"<<std::endl;
235 int NT = QDP::Layout::lattSize()[3];
236 int NZ = QDP::Layout::lattSize()[2];
237 int NY = QDP::Layout::lattSize()[1];
238 int NX = QDP::Layout::lattSize()[0];
240 QDPIO::cout <<
"NZ must be even"<<endl;
243 QDPIO::cout <<std::endl<<
"Beginning read of CERN gauge field ("<<NX<<
" x "<<NY
244 <<
" x "<<NZ<<
" ) x "<<NT<<std::endl;
245 StopWatch rtimer; rtimer.start();
251 BinaryFileReader fin(cfg_file);
253 fin.readArrayLittleEndian((
char*)&Ncern[0],
sizeof(
int),4);
256 if ((Ncern[0]!=NT)||(Ncern[1]!=NX)||(Ncern[2]!=NY)||(Ncern[3]!=NZ)){
257 QDPIO::cout <<
"readCERN: Lattice size mismatch " << std::endl;
258 QDPIO::cout <<
"read "<<Ncern[1]<<
" "<<Ncern[2]<<
" "<<Ncern[3]
259 <<
" "<<Ncern[0]<<std::endl;
260 QDPIO::cout <<
"Chroma wants "<<NX<<
" "<<NY<<
" "<<NZ<<
" "<<NT<<std::endl;
264 fin.readArrayLittleEndian((
char*)&
plaq,
sizeof(
double),1);
268 multi1d<int> gridsize=Layout::subgridLattSize();
270 size_t dbsize=
sizeof(double);
271 size_t linkdbles=2*QDP::Nc*QDP::Nc;
273 size_t rdsize=rdlinks*linkdbles;
274 vector<double> rdbuf(rdsize);
277 for (
int it=0;
it<NT;
it++){
279 for (
int ix=0;ix<NX;ix++){
281 for (
int iy=0;
iy<NY;
iy++){
285 fin.readArrayPrimaryNodeLittleEndian((
char*)&rdbuf[0],dbsize,rdsize);
288 int izstart=((
it+ix+
iy)%2)?0:1;
294 for (
int iz=izstart;
iz<NZ;
iz+=LZ+zz){
298 zshift+=8*lcbz*linkdbles;
303 QDPIO::cout <<
"readCERN: plaq read: " <<
plaq << std::endl;
306 QDPIO::cout <<
"readCERN: plaq recomputed: " <<
w_plaq << std::endl;
307 QDPIO::cout <<
"Read of CERN gauge field done in "<<rtimer.getTimeInSeconds()<<
" seconds"<<std::endl;
308 QDPIO::cout <<
"Time of IO operations = "<<iotimer.getTimeInSeconds()<<
" seconds"<<std::endl;
309 QDPIO::cout <<
"Time of communications = "<<cmtimer.getTimeInSeconds()<<
" seconds"<<std::endl<<std::endl;
310 #if defined(ARCH_PARSCALAR) || defined(ARCH_PARSCALARVEC)
Primary include file for CHROMA library code.
Asqtad Staggered-Dirac operator.
static multi1d< LatticeColorMatrix > u
void pokeCernLinks(const double *rdbuf, int lcbz, int linkdbles, multi1d< int > &coord, int NX, int NY, int NZ, int NT, multi1d< LatticeColorMatrix > &u, StopWatch &cmtimer)
void readCERN(multi1d< LatticeColorMatrix > &, const std::string &)
void localPokeCernLink(const multi1d< int > &coord, const double *buf, LatticeColorMatrix &Umufield)
FloatingPoint< double > Double
MesPlq(u, w_plaq, s_plaq, t_plaq, link)