Partial sum of data from all processes with result on each process.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
complex(kind=real_8), | intent(in), | CONTIGUOUS | :: | msg(:,:) |
Matrix to sum (input) |
|
complex(kind=real_8), | intent(out), | CONTIGUOUS | :: | res(:,:) |
Matrix containing result (output) |
|
type(mp_comm_type), | intent(in) | :: | gid |
Message passing environment identifier |
SUBROUTINE mp_sum_partial_zm(msg, res, gid) !! Partial sum of data from all processes with result on each process. COMPLEX(kind=real_8), CONTIGUOUS, INTENT(IN) :: msg(:, :) !! Matrix to sum (input) COMPLEX(kind=real_8), CONTIGUOUS, INTENT(OUT) :: res(:, :) !! Matrix containing result (output) TYPE(mp_comm_type), INTENT(IN) :: gid !! Message passing environment identifier CHARACTER(LEN=*), PARAMETER :: routineN = 'mp_sum_partial_zm' INTEGER :: handle, ierr, msglen #if defined(__parallel) INTEGER :: taskid #endif ierr = 0 CALL timeset(routineN, handle) msglen = SIZE(msg) #if defined(__parallel) CALL mpi_comm_rank(gid%handle, taskid, ierr) IF (ierr /= 0) CALL mp_stop(ierr, "mpi_comm_rank @ "//routineN) IF (msglen > 0) THEN CALL mpi_scan(msg, res, msglen, MPI_DOUBLE_COMPLEX, MPI_SUM, gid%handle, ierr) IF (ierr /= 0) CALL mp_stop(ierr, "mpi_scan @ "//routineN) END IF CALL add_perf(perf_id=3, msg_size=msglen*(2*real_8_size)) ! perf_id is same as for other summation routines #else res = msg MARK_USED(gid) #endif CALL timestop(handle) END SUBROUTINE mp_sum_partial_zm