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

Rajeev Thakur thakur at mcs.anl.gov
Mon Apr 23 18:00:26 CDT 2007


Was the file created by a Fortran program using Fortran write() statements
(not MPI-IO)? Fortran may add its own metadata to the file. Try reading the
file with an "od -d" and see what it shows as the first integer.

Rajeev
 

> -----Original Message-----
> From: owner-mpich-discuss at mcs.anl.gov 
> [mailto:owner-mpich-discuss at mcs.anl.gov] On Behalf Of Russell 
> L. Carter
> Sent: Monday, April 23, 2007 5:17 PM
> Cc: mpich-discuss at mcs.anl.gov
> Subject: [MPICH] MPI-IO, reading in c++ from fortran generated file
> 
> 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