returns number of tasks and task id for a given mpi group simple and cartesian version.. recursive needed in case of failing mpi_comm_rank.
..mp_world_setup is gone, use mp_environ instead (i.e. give a groupid explicitly)
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer, | intent(out), | optional | :: | numtask | ||
integer, | intent(out), | optional | :: | taskid | ||
integer, | intent(in) | :: | groupid |
mpi communicator |
RECURSIVE SUBROUTINE mp_environ_l(numtask, taskid, groupid)
!! returns number of tasks and task id for a given mpi group
!! simple and cartesian version.. recursive needed in case of failing mpi_comm_rank.
!! @note
!! ..mp_world_setup is gone, use mp_environ instead (i.e. give a groupid explicitly)
INTEGER, OPTIONAL, INTENT(OUT) :: numtask, taskid
INTEGER, INTENT(IN) :: groupid
!! mpi communicator
INTEGER :: ierr
ierr = 0
IF (PRESENT(numtask)) numtask = 1
IF (PRESENT(taskid)) taskid = 0
#if defined(__parallel)
IF (PRESENT(taskid)) THEN
CALL mpi_comm_rank(groupid, taskid, ierr)
IF (ierr /= 0) CALL mp_stop(ierr, "mpi_comm_rank @ mp_environ_l")
END IF
IF (PRESENT(numtask)) THEN
CALL mpi_comm_size(groupid, numtask, ierr)
IF (ierr /= 0) CALL mp_stop(ierr, "mpi_comm_size @ mp_environ_l")
END IF
#else
MARK_USED(groupid)
#endif
END SUBROUTINE mp_environ_l