Some weeks ago, I reported a problem using MPI IO in OpenMPI 1.3,
which did not occur with OpenMPI 1.2 or MPICH2.
The bug was encountered with the Code_Saturne CFD tool (http://www.code-saturne.org),
and seemed to be an issue with individual file pointers, as another mode using
explicit offsets worked fine.
I have finally extracted the read pattern from the complete case, so as to
generate the simple test case attached. Further testing showed that the
bug could be reproduced easily using only part of the read pattern,
so I commented most of the patterns from the original case using #if 0 / #endif.
The test should be run with an MPI_COMM_WORLD size of 2. Initially,
rank 0 generates a simple binary file using Posix I/O and
containing the values 0, 1, 2, ... up to about 300000.
The file is then opened for reading using MPI IO, and as the values
expected at a given offset are easily determined, read values are compared
to expected values, and MPI_Abort is called in case of an error.
I also added a USE_FILE_TYPE macro definition, which can be undefined
to "turn off" the bug.
Basically, I have:
MPI_Type_hindexed(1, lengths, disps, MPI_BYTE, &file_type);
MPI_File_set_view(fh, offset, MPI_BYTE, file_type, datarep, MPI_INFO_NULL);
MPI_File_set_view(fh, offset+disps, MPI_BYTE, MPI_BYTE, datarep, MPI_INFO_NULL);
retval = MPI_File_read_all(fh, buf, (int)(lengths), MPI_BYTE, &status);
Using the file type indexed datatype, I exhibit the bug with both
versions 1.3.0 and 1.3.2 of OpenMPI.