[mpich-discuss] MPI IO, reading MPI Writes without MPI read

Rajeev Thakur thakur at mcs.anl.gov
Thu Mar 28 08:47:17 CDT 2013


Most MPI-IO implementations write plain binary files without any additional information. So the data should be exactly what you wrote and at the locations you specified. The disp is not stored in the file. It is just used to offset to the right location. The file won't be portable with the default "native" file format used for writing. In other words, it will be readable only on the same type of machine architecture. 

Try writing a simple MPI-IO program to write a file and then read it back using POSIX I/O calls (lseek, read) from a C program. I don't know if Fortran I/O expects files to be formatted in a particular way, which could cause a problem when reading from Fortran.

Rajeev


On Mar 28, 2013, at 2:00 AM, Ryan Crocker wrote:

> So i'm not sure if this is crazy or not, but i have file outputs from my code that write ensight gold files in MPI.  Here is the write, 
> 
>  disp = 3*80+4+0*ncells_hexa*4
>  call MPI_FILE_SET_VIEW(iunit,disp,MPI_REAL_SP,fileview_hexa,"native",mpi_info,ierr)
>  call MPI_FILE_WRITE_ALL(iunit,buffer3_hexa(:,1),ncells_hexa_,MPI_REAL_SP,status,ierr)
> 
> if i wanted to read that in binary in fortran, or C (preferably fortran) what exactly would i need to do?  I can't seem to write code that reads these in and produces anything that looks like the plot i get in paraview.  I know that MPI write puts out each processor data vector with that disp in between them, but i just can't make that structure make sense to me when i try to read it in.
> 
> Thanks for the help, 
> 
> Ryan Crocker
> University of Vermont, School of Engineering
> Mechanical Engineering Department
> rcrocker at uvm.edu
> 315-212-7331
> 
> _______________________________________________
> discuss mailing list     discuss at mpich.org
> To manage subscription options or unsubscribe:
> https://lists.mpich.org/mailman/listinfo/discuss




More information about the discuss mailing list