Need to scatter from a few of the processors only to the zero processor
Randall Mackie
randy at geosystem.us
Wed Dec 13 10:44:46 CST 2006
At the end of my large 3D computation, I compute the results at, say, 20 locations
in the entire 3D volume. This calculation doesn't happen on every processor, but
only those processors that own that part of the 3D volume.
I want to get those results to the zero processor for output, but I'm unsure
about the best way to do this. My question is can I define a parallel vector
that is smaller than the number of processors, or does that even make sense?
Right now, I'm doing the following, and I'm wondering how to do this with
VecCreateMPI and scattering the results to the zero processor:
!
! See if computation point is owned by this processor:
!
IF (ii >= xs .and. ii <= xs+xm-1 .and.
. jj >= ys .and. jj <= ys+ym-1 .and.
. kk >= zs .and. kk <= zs+zm-1 ) THEN
flg=.true.
hyijk=xh(idx+3*row+2)
hyijf=xh(idx+3*(row+gxm*gym)+2)
hzijk=xh(idx+3*row+3)
hziek=xh(idx+3*(row+gxm)+3)
etc, do some computations
END IF
IF (flg .and. rank /= 0) THEN
call MPI_Send(esxInterp(iTx,1), 1, MPI_DOUBLE_COMPLEX, 0, 1,
. MPI_COMM_WORLD, ierr)
ELSE IF (.not. flg .and. rank == 0) THEN
call MPI_Recv(esxInterp(iTx,1), 1, MPI_DOUBLE_COMPLEX,
. MPI_ANY_SOURCE, 1, PETSC_COMM_WORLD, mpi_status, ierr)
END IF
--
Randall Mackie
GSY-USA, Inc.
PMB# 643
2261 Market St.,
San Francisco, CA 94114-1600
Tel (415) 469-8649
Fax (415) 469-5044
California Registered Geophysicist
License No. GP 1034
More information about the petsc-users
mailing list