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

Russell L. Carter rcarter at esturion.net
Mon Apr 23 18:16:45 CDT 2007


Ah, I see. I'd forgotten about od.  I guess I'll have to dig into
the ifort file format because here's the first couple lines of
output (from od -i)

0000000           4           1           4          12
0000020          64          64          64          12
0000040     7340032           0 -1075838976 -1073741824

The two '4's and '12's are evidently record separators.
The content should be 1,64,64,64, and then a bunch of doubles.

Thanks,
Russell

Rajeev Thakur wrote:
> 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
>>
>>
> 


-- 
Russell L. Carter
Esturion, LLC
2285 Sandia Drive
Prescott, Arizona 86301

rcarter at esturion.net
928 308-4154




More information about the mpich-discuss mailing list