Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(tem_sparta_type), | intent(inout) | :: | me | |||
integer, | intent(in) | :: | comm | |||
integer, | intent(in) | :: | nParts | |||
integer, | intent(in) | :: | send_count(0:nParts-1) |
subroutine tem_set_sparta( me, comm, nParts, send_count )
type( tem_sparta_type ), intent(inout) :: me
integer, intent(in) :: comm, nParts
integer, intent(in) :: send_count(0:nParts-1)
integer :: iProc, iErr
! Each process needs to know how many elements to receive from which process
call mpi_alltoall(send_count, 1, mpi_integer, &
& me%recv_count, 1, mpi_integer, &
& comm, iErr)
! Create additional structures for alltoallv ------------------------------
me%send_index(0) = 0
me%recv_index(0) = 0
me%send_count(0) = send_count(0)
do iProc = 1,nParts-1
me%send_count(iProc) = send_count(iProc)
me%send_index(iProc) = me%send_index(iProc-1) + send_count(iProc-1)
me%recv_index(iProc) = me%recv_index(iProc-1) + me%recv_count(iProc-1)
end do
! Create additional structures for alltoallv ------------------------------
me%old_size = sum(me%send_count)
me%new_size = sum(me%recv_count)
end subroutine tem_set_sparta