CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > General Forums > Main CFD Forum

How to read files in parallel using fortran and mpi

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   November 21, 2010, 11:41
Default How to read files in parallel using fortran and mpi
  #1
Senior Member
 
TWB
Join Date: Mar 2009
Posts: 414
Rep Power: 19
quarkz is on a distinguished road
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
quarkz is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
is there any parallel code for the famous Lid Driven Cavity flow? gholamghar Main CFD Forum 0 August 1, 2010 02:55
How to partition cartesian grid for MPI in fortran CF Main CFD Forum 3 January 17, 2008 05:38
how to call C++ function from fortran with MPI kenn Main CFD Forum 1 February 17, 2002 21:39


All times are GMT -4. The time now is 03:50.