Allgather an integer array with perElem entries per element from the decomposition's contiguous rank-local element ranges into the global element ordering.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(DomainDecomposition), | intent(in) | :: | decomp | |||
| integer, | intent(in) | :: | perElem | |||
| integer, | intent(in) | :: | localArr(*) | |||
| integer, | intent(out) | :: | globalArr(*) |
subroutine AllgatherPerElemInts(decomp,perElem,localArr,globalArr)
!! Allgather an integer array with perElem entries per element from the decomposition's
!! contiguous rank-local element ranges into the global element ordering.
implicit none
type(DomainDecomposition),intent(in) :: decomp
integer,intent(in) :: perElem
integer,intent(in) :: localArr(*)
integer,intent(out) :: globalArr(*)
! Local
integer :: r,ierror
integer,allocatable :: counts(:),displs(:)
allocate(counts(1:decomp%nRanks),displs(1:decomp%nRanks))
do r = 1,decomp%nRanks
counts(r) = perElem*(decomp%offsetElem(r+1)-decomp%offsetElem(r))
displs(r) = perElem*decomp%offsetElem(r)
enddo
call mpi_allgatherv(localArr,counts(decomp%rankId+1),MPI_INTEGER, &
globalArr,counts,displs,MPI_INTEGER, &
decomp%mpiComm,ierror)
deallocate(counts,displs)
endsubroutine AllgatherPerElemInts