Sum an array across MPI ranks: explicit-shape with implicit reshaping Multi-D->1D.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=wp), | intent(inout), | DIMENSION(sz) | :: | arr | ||
| integer, | intent(in) | :: | sz |
SUBROUTINE parSumArrayES(arr,sz) ! MODULES USE MODgvec_Globals, ONLY : wp IMPLICIT NONE !-------------------------------------------------------------------------------------------------------------------------------- ! INPUT VARIABLES INTEGER, INTENT(IN) :: sz REAL(wp), DIMENSION(sz), INTENT(INOUT) :: arr !implicit array reshaping !-------------------------------------------------------------------------------------------------------------------------------- ! LOCAL VARIABLES # if MPI INTEGER :: ierr !================================================================================================================================ ! BODY CALL MPI_AllReduce(MPI_IN_PLACE, arr, sz, dType, MPI_SUM, worldComm, ierr) # endif END SUBROUTINE parSumArrayES