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

Ryan Crocker rcrocker at uvm.edu
Thu Mar 28 10:19:23 CDT 2013


So write the vector to be written 

counter = 0
do k
  do j 
    do i 
    counter = counter +1
    buffer(counter) = U(i,j,k)
    end do 
  end do 
end do 

when i read that back in:
counter = 0
do k
  do j 
    do i 
    counter = counter +1
    U(i,j,k) = buffer(counter)
    end do 
  end do 
end do 


from the file those points are most definitely not in the same spot.  We're using a set view so the memory is stored non-contiguously so you can't just read it back in, and i can see the offset in the data blocks.


On Mar 28, 2013, at 6:47 AM, Rajeev Thakur wrote:

> 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
> 
> _______________________________________________
> discuss mailing list     discuss at mpich.org
> To manage subscription options or unsubscribe:
> https://lists.mpich.org/mailman/listinfo/discuss

Ryan Crocker
University of Vermont, School of Engineering
Mechanical Engineering Department
rcrocker at uvm.edu
315-212-7331




More information about the discuss mailing list