[mpich-discuss] MPI I/O

vvvnew at umich.edu vvvnew at umich.edu
Wed Jun 8 18:04:04 CDT 2011



The most straight forward way to do this is to read from a single proc and
then use MPI_BCAST . The program will look something like this 
PROGRAM broadcast
INCLUDE 'mpif.h'
INTEGER err, rank, size
INTEGER A(10)
CALL MPI_INIT(err)
CALL MPI_COMM_RANK(MPI_COMM_WORLD, rank, err)
CALL MPI_COMM_SIZE(MPI_COMM_WORLD, size, err)

open(file='vvv.data',status='old',unit=12,form='formatted')

if(rank.eq.0) 

read(12,*) A(10)

end if

call MPI_BCAST(A,10,MPI_INTEGER,0,MPI_COMM_WORLD,err)

CALL MPI_FINALIZE(err)

close(unit=12) 

!-------------------------------------------------
END

Sreenivas 

On Thu, 9 Jun 2011 03:14:14 +0500, Irfan Gul  wrote: Hi,
I need a simple program to read integer values from text file by multiple
processes?
each process store n/p values in array. 
for example text file have n values like.
4
2
7
4
9
6
3
1
 ..............................................................
thanks

Regard: Irfan

 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/mpich-discuss/attachments/20110608/38467aa4/attachment.htm>


More information about the mpich-discuss mailing list