PROGRAM mpi2io USE MPI IMPLICIT none INTEGER :: myrank, nproc,ierr; INTEGER, PARAMETER :: dim_buf = 10 INTEGER :: buf(dim_buf) INTEGER :: i, intsize; INTEGER(KIND=MPI_OFFSET_KIND) :: offset, file_size INTEGER :: fh INTEGER :: status(MPI_STATUS_SIZE) INTEGER :: filetype CALL MPI_Init(ierr); CALL MPI_Comm_size(MPI_COMM_WORLD,nproc,ierr) CALL MPI_Comm_rank(MPI_COMM_WORLD,myrank,ierr) DO i=1,dim_buf buf(i) = myrank*dim_buf+i-1; END DO ! Open the file and write ... call MPI_File_open to access "output.dat" file in writing mode ... call MPI_File_write_ordered to write onto the file ... call MPI_File_close to free the file ! Re-open the file and read data ... call MPI_File_open to access "output.dat" file in reading mode ... call MPI_File_read_ordered to read from the file ... call MPI_File_close to free the file WRITE(*,*) "myid ",myrank," buffer after read:" WRITE(*,*) buf CALL MPI_Finalize(ierr) END PROGRAM mpi2io