Thanks Pierre. The direct access format does work, you just determine the offset and use a DO loop to read the data into an array.
Chris
> Dear Christopher,
>
> I guess you are producing a raw binary file, which is lacking the
> structure of an unformatted fortran file. Using a fortran interface to the
> MPI I/O library is not expected to change the internal file structure.
>
> If your buffers are of equal size, you should be able to read the file in
> Fortran as a binary direct file. Be aware that the unit for expressing the
> size of direct access buffers is compiler-dependant.
>
> If not, all you need is to write a few C routines for opening, making
> offsets, and read buffers of specified length.
>
> In case my analysis is correct, I attach a C template I am using for
> manipulating in fortran large raw files produced either by acquisition
> hardware devices or by ab-initio quantum calculations. Be aware that this
> template might not be 64-bit clean. This template was contributed by
> Francoise Roch at the SCCI, cf.
> http://www.obs.ujf-grenoble.fr/osug/content/blogcategory/83/63/
>
> Pierre.
>
>
> Christopher G. Roberts wrote:
>> Dear Sirs:
>>
>>
>> I have successfully implemented a parallel write to file using the
>> Fortran subroutine, MPI_FILE_WRITE() and using the MPI_FILE_SET_VIEW to
>> displace the file pointers for each processor. The file output contains
>> all integers and is unformmatted. The issue is that I cannot open the
>> file in a typical Fortran program because the file does not contain the
>> "headers" and "tails" values common to a Fortran unformatted file. The
>> worst part is I have all my analysis codes written in F90.
>>
>> Is there any way I can overcome this problem or do I have to write a C
>> function to open the data file, read it to a 1D array, pass it back to
>> Fortran by reference, and unpack it in column major order?
>>
>> If you need me to send a schematic of this issue, please let me know.
>>
>> Thanks for your time,
>>
>> Chris Roberts
>>
>> _______________________________________________ This list is archived at
>> http://www.lam-mpi.org/MailArchives/lam/
>>
>
>
> -- Soutenez le mouvement SAUVONS LA RECHERCHE : National :
> http://recherche-en-danger.apinc.org/ Grenoble :
> http://recherchegrenoble.free.fr et http://etatsg.free.fr
>
> _/_/_/_/ _/ _/ Dr. Pierre VALIRON _/ _/ _/ _/
> Laboratoire d'Astrophysique _/ _/ _/ _/ Observatoire de
> Grenoble / UJF _/_/_/_/ _/ _/ BP 53 F-38041 Grenoble Cedex 9
> (France) _/ _/ _/ http://www-laog.obs.ujf-grenoble.fr _/
> _/ _/ mail: Pierre.Valiron_at_[hidden] _/ _/ _/
> Phone: +33 4 7651 4787 Fax: +33 4 7644 8821 _/ _/_/
>
>
> _______________________________________________ This list is archived at
> http://www.lam-mpi.org/MailArchives/lam/
|