I am trying to use MPI_ALLGATHERV
using derived data types. Actually, I have to pass chunks of small 3D array in the form of:
SS(IIST:IIEND,JJST:JJEND,KKST:KKEND)
Here, IIST
, IIEND
, JJST
, JJEND
, KKST
, KKEND
are local indices of each process. So I tried to define a derived datatype in the following form:
INTEGER :: MPII,MPJJ,MPKK
CALL MPI_TYPE_CONTIGUOUS(IIEND-IIST+1,MPI_DOUBLE_PRECISION,MPII,IERR)
CALL MPI_TYPE_CONTIGUOUS(JJEND-JJST+1,MPII,MPJJ,IERR)
CALL MPI_TYPE_CONTIGUOUS(KKEND-KKST+1,MPJJ,MPKK,IERR)
CALL MPI_TYPE_COMMIT(MPKK,IERR)
Now, I am defining a displacement array which is visible to every process to be used in MPI_ALLGATHERV
. The total number of processes is 27 and they are numbered from 0-26.
DO NT=0,26
DISPL(1)=0
IF (NT.GT.0) DISPL(NT+1)= DISPL(NT)+1
ENDDO
Now, I am executing MPI_ALLGATHERV
with the following syntax:
CALL MPI_ALLGATHERV(SS(IIST:IIEND,JJST:JJEND,KKST:KKEND),SPANX*SPANY*SPANZ,MPI_DOUBLE_PRECISION,SS(1,1,1),1,DISPL,MPKK,MPI_COMM_WORLD,IERR)
This is giving me error. Any pointers in this problem will be very helpful and appreciated.