CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   Main CFD Forum (http://www.cfd-online.com/Forums/main/)
-   -   How to read files in parallel using fortran and mpi (http://www.cfd-online.com/Forums/main/82248-how-read-files-parallel-using-fortran-mpi.html)

quarkz November 21, 2010 11:41

How to read files in parallel using fortran and mpi
 
Hi,

I am now trying to read a data file which has about 2000x2000 pts. In the past, when file size is smaller, the file was read by 1 processor and then distributed to the rest of the processors.

However, now the file size has gotten too big for the current memory. I am able to write to the file in parallel using:

...
DO irank = 0, nprocs - 1
CALL MPI_BARRIER(MPI_COMM_WORLD, ierr)
IF (irank == myrank) THEN
IF (myrank == 0) THEN
OPEN(10, FILE=’output’)
ELSE
OPEN(10, FILE=’output’, POSITION=’APPEND’)
ENDIF
WRITE(10) (outdata(i), i=ista,iend)
CLOSE(10)
ENDIF
ENDDO
...

I tried to do the same for the reading case but it can't work. Is it possible to read in fortran files by skipping e.g. 20000 values? If it's possible, then I should be able to solve my problem. Btw, I am using fortran binary files.

Thanks


All times are GMT -4. The time now is 14:01.