1
0
mirror of https://github.com/paboyle/Grid.git synced 2024-11-14 01:35:36 +00:00

Debugging offsets in BinaryIO

This commit is contained in:
Guido Cossu 2018-05-10 17:55:05 +01:00
parent 0064685bd7
commit fa5d8702cb

View File

@ -358,7 +358,7 @@ PARALLEL_CRITICAL
if ( (control & BINARYIO_LEXICOGRAPHIC) && (nrank > 1) ) {
#ifdef USE_MPI_IO
std::cout<< GridLogMessage<<"IOobject: MPI read I/O "<< file<< std::endl;
std::cout<< GridLogMessage<<"IOobject: MPI read I/O "<< file<< " and offset " << offset << std::endl;
ierr=MPI_File_open(grid->communicator,(char *) file.c_str(), MPI_MODE_RDONLY, MPI_INFO_NULL, &fh); assert(ierr==0);
ierr=MPI_File_set_view(fh, disp, mpiObject, fileArray, "native", MPI_INFO_NULL); assert(ierr==0);
ierr=MPI_File_read_all(fh, &iodata[0], 1, localArray, &status); assert(ierr==0);
@ -380,10 +380,8 @@ PARALLEL_CRITICAL
<< iodata.size() * sizeof(fobj) << " bytes and offset " << offset << std::endl;
std::ifstream fin;
fin.open(file, std::ios::binary | std::ios::in);
if (0)//control & BINARYIO_MASTER_APPEND)
if (control & BINARYIO_MASTER_APPEND)
{
// Note Guido. Crosscheck this for the RNG case
// why the negative offset?
fin.seekg(-sizeof(fobj), fin.end);
}
else
@ -391,8 +389,9 @@ PARALLEL_CRITICAL
fin.seekg(offset + myrank * lsites * sizeof(fobj));
}
fin.read((char *)&iodata[0], iodata.size() * sizeof(fobj));
offset = fin.tellg();
assert(fin.fail() == 0);
offset = fin.tellg();
fin.close();
}
timer.Stop();