diff --git a/lib/parallelIO/BinaryIO.h b/lib/parallelIO/BinaryIO.h index 117bec01..108e7ef8 100644 --- a/lib/parallelIO/BinaryIO.h +++ b/lib/parallelIO/BinaryIO.h @@ -98,35 +98,39 @@ class BinaryIO { NerscChecksum(grid,scalardata,nersc_csum); } - - template static inline void NerscChecksum(GridBase *grid,std::vector &fbuf,uint32_t &nersc_csum) + + template + static inline void NerscChecksum(GridBase *grid, std::vector &fbuf, uint32_t &nersc_csum) { - const uint64_t size32 = sizeof(fobj)/sizeof(uint32_t); + const uint64_t size32 = sizeof(fobj) / sizeof(uint32_t); - - uint64_t lsites =grid->lSites(); - if (fbuf.size()==1) { - lsites=1; + uint64_t lsites = grid->lSites(); + if (fbuf.size() == 1) + { + lsites = 1; } -#pragma omp parallel - { - uint32_t nersc_csum_thr=0; + #pragma omp parallel + { + uint32_t nersc_csum_thr = 0; -#pragma omp for - for(uint64_t local_site=0;local_site static inline void ScidacChecksum(GridBase *grid,std::vector &fbuf,uint32_t &scidac_csuma,uint32_t &scidac_csumb) { const uint64_t size32 = sizeof(fobj)/sizeof(uint32_t); @@ -266,7 +270,7 @@ class BinaryIO { grid->Barrier(); GridStopWatch timer; GridStopWatch bstimer; - + nersc_csum=0; scidac_csuma=0; scidac_csumb=0; @@ -362,18 +366,22 @@ class BinaryIO { #else assert(0); #endif - } else { - std::cout<< GridLogMessage<< "C++ read I/O "<< file<<" : " - << iodata.size()*sizeof(fobj)<<" bytes"<Barrier(); - grid->GlobalSum(nersc_csum); - grid->GlobalXOR(scidac_csuma); - grid->GlobalXOR(scidac_csumb); - grid->Barrier(); + // if the data size is 1 we do not want to sum over the MPI ranks + if (iodata.size() != 1){ + grid->Barrier(); + grid->GlobalSum(nersc_csum); + grid->GlobalXOR(scidac_csuma); + grid->GlobalXOR(scidac_csumb); + grid->Barrier(); + } } ///////////////////////////////////////////////////////////////////////////// @@ -546,9 +585,9 @@ class BinaryIO { int gsites = grid->gSites(); int lsites = grid->lSites(); - uint32_t nersc_csum_tmp; - uint32_t scidac_csuma_tmp; - uint32_t scidac_csumb_tmp; + uint32_t nersc_csum_tmp = 0; + uint32_t scidac_csuma_tmp = 0; + uint32_t scidac_csumb_tmp = 0; GridStopWatch timer;