how to open files in a parallel code???
hi friends.........
i am using fedora 8 as my os.
my program is in fortran 90 and am using MPI ... while tryiing to open and write in a file....using 4 processors, some error creeps.which does not allow the files to be opened... can anyone plz tell where am i going wrong?
the program is........
implicit none
use mpi
integer t,Na,Nb,Nc,ios,i,ierr,myrank,p,m,mos,tt,Naa,Nbb,Ncc,j,Nam,uni,info,type,filetype,buff(9)
character(len=10) native
INTEGER(KIND=MPI_OFFSET_KIND) DISP
character(len=15) cpar, cpar1
character(len=25) datfilename
real Pb,k1,k2,r,Nbm,Ncm
CALL MPI_INIT(ierr)
CALL MPI_COMM_SIZE(MPI_COMM_WORLD,p,ierr)
CALL MPI_COMM_RANK(MPI_COMM_WORLD, myrank, ierr )
uni=(myrank+1)*10
write(cpar1,*) myrank
write(cpar,*) uni
datfilename = 'data.'//trim(adjustl(cpar1))
open(uni,file= datfilename,status='new',iostat=ios)
if (ios/=0) then
write(*,*) datfilename,'cannot be opened'
else
write(*,*) ' file ',datfilename,' successfully opened'
endif
CALL MPI_FINALIZE(ierr)
end program
|