Passing values around in parallel / which subroutine to call
Posted: Mon Jun 07, 2010 3:16 pm
I wanted to output the values at boundary face cells to check one of my subroutines and got some strange results which led me to notice I wasn't paying attention to parallel. i.e. I am only listing the values of the boundary face in one (which I assume to be rank 0) part of the parallel split.
I calculate the total force on a boundary face in usproj as in the 3rd example and can run this in parallel using the parsom subrountine. But to list the values at each point is less simple.
For instance just to list the boundary face coordinates I tried using parbcr to broadcast the x,y,z values (my code's below) to the other ranks but it crashes, the terminal reads:
*** An error occurred in MPI_Bcast *** on communicator MPI_COMM_WORLD *** MPI_ERR_TRUNCATE: message truncated *** MPI_ERRORS_ARE_FATAL (your MPI job will now abort)
And the listing file stops after "CPU time for restart files" but there is no other output.
If I change call parbcr(irangp,ndim,xyz) to call parbcr(irangv,ndim,xyz) the code runs without error but with the same result as if I run under one processor.
I think I am slightly missunderstanding the way in which the par*** subroutines are intended to be used here, if there's any point in the right direction it'd be great.
Thanks,
James
I calculate the total force on a boundary face in usproj as in the 3rd example and can run this in parallel using the parsom subrountine. But to list the values at each point is less simple.
For instance just to list the boundary face coordinates I tried using parbcr to broadcast the x,y,z values (my code's below) to the other ranks but it crashes, the terminal reads:
*** An error occurred in MPI_Bcast *** on communicator MPI_COMM_WORLD *** MPI_ERR_TRUNCATE: message truncated *** MPI_ERRORS_ARE_FATAL (your MPI job will now abort)
And the listing file stops after "CPU time for restart files" but there is no other output.
If I change call parbcr(irangp,ndim,xyz) to call parbcr(irangv,ndim,xyz) the code runs without error but with the same result as if I run under one processor.
I think I am slightly missunderstanding the way in which the par*** subroutines are intended to be used here, if there's any point in the right direction it'd be great.
Thanks,
James
Code: Select all
testfile = impusr(1) irangv = 0
if (ntcabs.eq.ntmabs) then
if (irangp.le.0) open(file='test.dat',unit=testfile)
call getfbr('inner', nlelt, lstelt)
!==========
do ilelt = 1, nlelt
ifac = lstelt(ilelt)
do ii = 1, ndim
xyz(ii) = cdgfbo(ii,ifac)
enddo
if (irangp.ge.0) then
call parbcr(irangp,ndim,xyz)
endif
if (irangp.le.0) then
write(testfile,'(3(F10.6,1X))')xyz(1),xyz(2),xyz(3)
endif
enddo
if (irangp.le.0) close(unit=testfile)
endif