the direct way to split a communicator each color is a sub_comm, the rank order is accoring to the order in the orig comm
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer, | intent(in) | :: | comm | |||
integer, | intent(out) | :: | sub_comm | |||
integer, | intent(in) | :: | color | |||
integer, | intent(in), | optional | :: | key |
SUBROUTINE mp_comm_split_direct(comm, sub_comm, color, key)
!! the direct way to split a communicator each color is a sub_comm,
!! the rank order is accoring to the order in the orig comm
INTEGER, INTENT(in) :: comm
INTEGER, INTENT(OUT) :: sub_comm
INTEGER, INTENT(in) :: color
INTEGER, INTENT(in), OPTIONAL :: key
CHARACTER(LEN=*), PARAMETER :: routineN = 'mp_comm_split_direct'
INTEGER :: handle, ierr, my_key
ierr = 0
CALL timeset(routineN, handle)
my_key = 0
#if defined(__parallel)
IF (PRESENT(key)) my_key = key
CALL mpi_comm_split(comm, color, my_key, sub_comm, ierr)
debug_comm_count = debug_comm_count + 1
IF (ierr /= mpi_success) CALL mp_stop(ierr, routineN)
#else
CALL mp_comm_dup(comm, sub_comm)
MARK_USED(color)
MARK_USED(key)
#endif
CALL timestop(handle)
END SUBROUTINE mp_comm_split_direct