diff --git a/Grid/parallelIO/BinaryIO.h b/Grid/parallelIO/BinaryIO.h index e9893aa1..32964565 100644 --- a/Grid/parallelIO/BinaryIO.h +++ b/Grid/parallelIO/BinaryIO.h @@ -165,7 +165,7 @@ class BinaryIO { * FIXME -- 128^3 x 256 x 16 will overflow. */ - int global_site; + int64_t global_site; Lexicographic::CoorFromIndex(coor,local_site,local_vol); @@ -175,8 +175,8 @@ class BinaryIO { Lexicographic::IndexFromCoor(coor,global_site,global_vol); - uint32_t gsite29 = global_site%29; - uint32_t gsite31 = global_site%31; + uint64_t gsite29 = global_site%29; + uint64_t gsite31 = global_site%31; site_crc = crc32(0,(unsigned char *)site_buf,sizeof(fobj)); // std::cout << "Site "< scalardata(lsites); std::vector iodata(lsites); // Munge, checksum, byte order in here - IOobject(w,grid,iodata,file,offset,format,BINARYIO_READ|BINARYIO_LEXICOGRAPHIC, + IOobject(w,grid,iodata,file,offset,format,BINARYIO_READ|control, nersc_csum,scidac_csuma,scidac_csumb); GridStopWatch timer; @@ -582,7 +584,8 @@ class BinaryIO { const std::string &format, uint32_t &nersc_csum, uint32_t &scidac_csuma, - uint32_t &scidac_csumb) + uint32_t &scidac_csumb, + int control=BINARYIO_LEXICOGRAPHIC) { typedef typename vobj::scalar_object sobj; typedef typename vobj::Realified::scalar_type word; word w=0; @@ -607,7 +610,7 @@ class BinaryIO { while (attemptsLeft >= 0) { grid->Barrier(); - IOobject(w,grid,iodata,file,offset,format,BINARYIO_WRITE|BINARYIO_LEXICOGRAPHIC, + IOobject(w,grid,iodata,file,offset,format,BINARYIO_WRITE|control, nersc_csum,scidac_csuma,scidac_csumb); if (checkWrite) { @@ -617,7 +620,7 @@ class BinaryIO { std::cout << GridLogMessage << "writeLatticeObject: read back object" << std::endl; grid->Barrier(); - IOobject(w,grid,ckiodata,file,ckoffset,format,BINARYIO_READ|BINARYIO_LEXICOGRAPHIC, + IOobject(w,grid,ckiodata,file,ckoffset,format,BINARYIO_READ|control, cknersc_csum,ckscidac_csuma,ckscidac_csumb); if ((cknersc_csum != nersc_csum) or (ckscidac_csuma != scidac_csuma) or (ckscidac_csumb != scidac_csumb)) { diff --git a/Grid/parallelIO/IldgIO.h b/Grid/parallelIO/IldgIO.h index 80d135d2..7a39b34d 100644 --- a/Grid/parallelIO/IldgIO.h +++ b/Grid/parallelIO/IldgIO.h @@ -206,7 +206,7 @@ class GridLimeReader : public BinaryIO { // Read a generic lattice field and verify checksum //////////////////////////////////////////// template - void readLimeLatticeBinaryObject(Lattice &field,std::string record_name) + void readLimeLatticeBinaryObject(Lattice &field,std::string record_name,int control=BINARYIO_LEXICOGRAPHIC) { typedef typename vobj::scalar_object sobj; scidacChecksum scidacChecksum_; @@ -238,7 +238,7 @@ class GridLimeReader : public BinaryIO { uint64_t offset= ftello(File); // std::cout << " ReadLatticeObject from offset "< munge; - BinaryIO::readLatticeObject< vobj, sobj >(field, filename, munge, offset, format,nersc_csum,scidac_csuma,scidac_csumb); + BinaryIO::readLatticeObject< vobj, sobj >(field, filename, munge, offset, format,nersc_csum,scidac_csuma,scidac_csumb,control); std::cout << GridLogMessage << "SciDAC checksum A " << std::hex << scidac_csuma << std::dec << std::endl; std::cout << GridLogMessage << "SciDAC checksum B " << std::hex << scidac_csumb << std::dec << std::endl; ///////////////////////////////////////////// @@ -408,7 +408,7 @@ class GridLimeWriter : public BinaryIO // in communicator used by the field.Grid() //////////////////////////////////////////////////// template - void writeLimeLatticeBinaryObject(Lattice &field,std::string record_name) + void writeLimeLatticeBinaryObject(Lattice &field,std::string record_name,int control=BINARYIO_LEXICOGRAPHIC) { //////////////////////////////////////////////////////////////////// // NB: FILE and iostream are jointly writing disjoint sequences in the @@ -459,7 +459,7 @@ class GridLimeWriter : public BinaryIO /////////////////////////////////////////// std::string format = getFormatString(); BinarySimpleMunger munge; - BinaryIO::writeLatticeObject(field, filename, munge, offset1, format,nersc_csum,scidac_csuma,scidac_csumb); + BinaryIO::writeLatticeObject(field, filename, munge, offset1, format,nersc_csum,scidac_csuma,scidac_csumb,control); /////////////////////////////////////////// // Wind forward and close the record @@ -512,7 +512,8 @@ class ScidacWriter : public GridLimeWriter { //////////////////////////////////////////////// template void writeScidacFieldRecord(Lattice &field,userRecord _userRecord, - const unsigned int recordScientificPrec = 0) + const unsigned int recordScientificPrec = 0, + int control=BINARYIO_LEXICOGRAPHIC) { GridBase * grid = field.Grid(); @@ -534,7 +535,7 @@ class ScidacWriter : public GridLimeWriter { writeLimeObject(0,0,_scidacRecord,_scidacRecord.SerialisableClassName(),std::string(SCIDAC_PRIVATE_RECORD_XML)); } // Collective call - writeLimeLatticeBinaryObject(field,std::string(ILDG_BINARY_DATA)); // Closes message with checksum + writeLimeLatticeBinaryObject(field,std::string(ILDG_BINARY_DATA),control); // Closes message with checksum } }; @@ -553,7 +554,8 @@ class ScidacReader : public GridLimeReader { // Write generic lattice field in scidac format //////////////////////////////////////////////// template - void readScidacFieldRecord(Lattice &field,userRecord &_userRecord) + void readScidacFieldRecord(Lattice &field,userRecord &_userRecord, + int control=BINARYIO_LEXICOGRAPHIC) { typedef typename vobj::scalar_object sobj; GridBase * grid = field.Grid(); @@ -571,7 +573,7 @@ class ScidacReader : public GridLimeReader { readLimeObject(header ,std::string("FieldMetaData"),std::string(GRID_FORMAT)); // Open message readLimeObject(_userRecord,_userRecord.SerialisableClassName(),std::string(SCIDAC_RECORD_XML)); readLimeObject(_scidacRecord,_scidacRecord.SerialisableClassName(),std::string(SCIDAC_PRIVATE_RECORD_XML)); - readLimeLatticeBinaryObject(field,std::string(ILDG_BINARY_DATA)); + readLimeLatticeBinaryObject(field,std::string(ILDG_BINARY_DATA),control); } void skipPastBinaryRecord(void) { std::string rec_name(ILDG_BINARY_DATA);