mirror of
https://github.com/paboyle/Grid.git
synced 2025-04-11 14:40:46 +01:00
Revert "optional non-fatal checksum fail in Lime lattice read (with error codes)"
This reverts commit bccfd4cbb356a5dfcabfae8ff5a708ce249fb397.
This commit is contained in:
parent
10fc263675
commit
0e3035c51d
@ -167,14 +167,6 @@ namespace QCD {
|
|||||||
////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////
|
||||||
class GridLimeReader : public BinaryIO {
|
class GridLimeReader : public BinaryIO {
|
||||||
public:
|
public:
|
||||||
// error codes
|
|
||||||
enum
|
|
||||||
{
|
|
||||||
LIME_READ_SUCCESS = 0,
|
|
||||||
LIME_READ_CHECKSUM = 1,
|
|
||||||
LIME_READ_FAILURE = -1
|
|
||||||
};
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////
|
///////////////////////////////////////////////////
|
||||||
// FIXME: format for RNG? Now just binary out instead
|
// FIXME: format for RNG? Now just binary out instead
|
||||||
///////////////////////////////////////////////////
|
///////////////////////////////////////////////////
|
||||||
@ -209,7 +201,7 @@ class GridLimeReader : public BinaryIO {
|
|||||||
// Read a generic lattice field and verify checksum
|
// Read a generic lattice field and verify checksum
|
||||||
////////////////////////////////////////////
|
////////////////////////////////////////////
|
||||||
template<class vobj>
|
template<class vobj>
|
||||||
int readLimeLatticeBinaryObject(Lattice<vobj> &field, std::string record_name, const bool fatalChecksum = true)
|
void readLimeLatticeBinaryObject(Lattice<vobj> &field,std::string record_name)
|
||||||
{
|
{
|
||||||
typedef typename vobj::scalar_object sobj;
|
typedef typename vobj::scalar_object sobj;
|
||||||
scidacChecksum scidacChecksum_;
|
scidacChecksum scidacChecksum_;
|
||||||
@ -225,47 +217,36 @@ class GridLimeReader : public BinaryIO {
|
|||||||
// std::cout << GridLogMessage<< " readLimeObject seeking "<< record_name <<" found record :" <<limeReaderType(LimeR) <<std::endl;
|
// std::cout << GridLogMessage<< " readLimeObject seeking "<< record_name <<" found record :" <<limeReaderType(LimeR) <<std::endl;
|
||||||
|
|
||||||
if ( !strncmp(limeReaderType(LimeR), record_name.c_str(),strlen(record_name.c_str()) ) ) {
|
if ( !strncmp(limeReaderType(LimeR), record_name.c_str(),strlen(record_name.c_str()) ) ) {
|
||||||
// std::cout << GridLogMessage<< " readLimeLatticeBinaryObject matches ! " <<std::endl;
|
|
||||||
|
|
||||||
uint64_t PayloadSize = sizeof(sobj) * field._grid->_gsites;
|
// std::cout << GridLogMessage<< " readLimeLatticeBinaryObject matches ! " <<std::endl;
|
||||||
|
|
||||||
// std::cout << "R sizeof(sobj)= " <<sizeof(sobj)<<std::endl;
|
uint64_t PayloadSize = sizeof(sobj) * field._grid->_gsites;
|
||||||
// std::cout << "R Gsites " <<field._grid->_gsites<<std::endl;
|
|
||||||
// std::cout << "R Payload expected " <<PayloadSize<<std::endl;
|
|
||||||
// std::cout << "R file size " <<file_bytes <<std::endl;
|
|
||||||
|
|
||||||
assert(PayloadSize == file_bytes);// Must match or user error
|
// std::cout << "R sizeof(sobj)= " <<sizeof(sobj)<<std::endl;
|
||||||
|
// std::cout << "R Gsites " <<field._grid->_gsites<<std::endl;
|
||||||
|
// std::cout << "R Payload expected " <<PayloadSize<<std::endl;
|
||||||
|
// std::cout << "R file size " <<file_bytes <<std::endl;
|
||||||
|
|
||||||
uint64_t offset= ftello(File);
|
assert(PayloadSize == file_bytes);// Must match or user error
|
||||||
// std::cout << " ReadLatticeObject from offset "<<offset << std::endl;
|
|
||||||
BinarySimpleMunger<sobj,sobj> munge;
|
|
||||||
BinaryIO::readLatticeObject< vobj, sobj >(field, filename, munge, offset, format,nersc_csum,scidac_csuma,scidac_csumb);
|
|
||||||
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;
|
|
||||||
/////////////////////////////////////////////
|
|
||||||
// Insist checksum is next record
|
|
||||||
/////////////////////////////////////////////
|
|
||||||
readLimeObject(scidacChecksum_,std::string("scidacChecksum"),std::string(SCIDAC_CHECKSUM));
|
|
||||||
|
|
||||||
/////////////////////////////////////////////
|
uint64_t offset= ftello(File);
|
||||||
// Verify checksums
|
// std::cout << " ReadLatticeObject from offset "<<offset << std::endl;
|
||||||
/////////////////////////////////////////////
|
BinarySimpleMunger<sobj,sobj> munge;
|
||||||
bool checksumCorrect = (scidacChecksumVerify(scidacChecksum_,scidac_csuma,scidac_csumb) == 1);
|
BinaryIO::readLatticeObject< vobj, sobj >(field, filename, munge, offset, format,nersc_csum,scidac_csuma,scidac_csumb);
|
||||||
|
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;
|
||||||
|
/////////////////////////////////////////////
|
||||||
|
// Insist checksum is next record
|
||||||
|
/////////////////////////////////////////////
|
||||||
|
readLimeObject(scidacChecksum_,std::string("scidacChecksum"),std::string(SCIDAC_CHECKSUM));
|
||||||
|
|
||||||
if (fatalChecksum)
|
/////////////////////////////////////////////
|
||||||
{
|
// Verify checksums
|
||||||
assert(checksumCorrect);
|
/////////////////////////////////////////////
|
||||||
}
|
assert(scidacChecksumVerify(scidacChecksum_,scidac_csuma,scidac_csumb)==1);
|
||||||
else if (!checksumCorrect)
|
return;
|
||||||
{
|
|
||||||
return LIME_READ_CHECKSUM;
|
|
||||||
}
|
|
||||||
|
|
||||||
return LIME_READ_SUCCESS;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return LIME_READ_FAILURE;
|
|
||||||
}
|
}
|
||||||
////////////////////////////////////////////
|
////////////////////////////////////////////
|
||||||
// Read a generic serialisable object
|
// Read a generic serialisable object
|
||||||
@ -532,7 +513,7 @@ class ScidacReader : public GridLimeReader {
|
|||||||
// Write generic lattice field in scidac format
|
// Write generic lattice field in scidac format
|
||||||
////////////////////////////////////////////////
|
////////////////////////////////////////////////
|
||||||
template <class vobj, class userRecord>
|
template <class vobj, class userRecord>
|
||||||
int readScidacFieldRecord(Lattice<vobj> &field, userRecord &_userRecord, const bool fatalChecksum = true)
|
void readScidacFieldRecord(Lattice<vobj> &field,userRecord &_userRecord)
|
||||||
{
|
{
|
||||||
typedef typename vobj::scalar_object sobj;
|
typedef typename vobj::scalar_object sobj;
|
||||||
GridBase * grid = field._grid;
|
GridBase * grid = field._grid;
|
||||||
@ -550,10 +531,8 @@ class ScidacReader : public GridLimeReader {
|
|||||||
readLimeObject(header ,std::string("FieldMetaData"),std::string(GRID_FORMAT)); // Open message
|
readLimeObject(header ,std::string("FieldMetaData"),std::string(GRID_FORMAT)); // Open message
|
||||||
readLimeObject(_userRecord,_userRecord.SerialisableClassName(),std::string(SCIDAC_RECORD_XML));
|
readLimeObject(_userRecord,_userRecord.SerialisableClassName(),std::string(SCIDAC_RECORD_XML));
|
||||||
readLimeObject(_scidacRecord,_scidacRecord.SerialisableClassName(),std::string(SCIDAC_PRIVATE_RECORD_XML));
|
readLimeObject(_scidacRecord,_scidacRecord.SerialisableClassName(),std::string(SCIDAC_PRIVATE_RECORD_XML));
|
||||||
|
readLimeLatticeBinaryObject(field,std::string(ILDG_BINARY_DATA));
|
||||||
return readLimeLatticeBinaryObject(field, std::string(ILDG_BINARY_DATA), fatalChecksum);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void skipPastBinaryRecord(void) {
|
void skipPastBinaryRecord(void) {
|
||||||
std::string rec_name(ILDG_BINARY_DATA);
|
std::string rec_name(ILDG_BINARY_DATA);
|
||||||
while ( limeReaderNextRecord(LimeR) == LIME_SUCCESS ) {
|
while ( limeReaderNextRecord(LimeR) == LIME_SUCCESS ) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user