[MPICH] MPI-IO, reading in c++ from fortran generated file

Russell L. Carter rcarter at esturion.net
Mon Apr 23 17:16:50 CDT 2007


Hi,
Hopefully this is a nice stupid question.  I've got a
a binary (unformatted) fortran file.  It's first entry
is a 32 bit int, which I can successfully read with
a simple fortran read into an integer*4 value.  I'm
on debian x86_64, using ifort, and I set the environment
variable F_UFMTENDIAN=little when generating and reading
just to be sure that the file is little endian.

Then, assuming nzones is a valid int*, the following
snippet:

MPI::File f = MPI::File::Open(MPI::COMM_WORLD, fname,
                               MPI::MODE_RDONLY, MPI::INFO_NULL);
file.Read(nzones, 1, MPI_INT, status);

cerr << *nzones;

prints out '4', but the correct value is '1'.

Any clues?

Thanks!

Russell




More information about the mpich-discuss mailing list