comm_split_by_color Function

private function comm_split_by_color(this, color) result(new_comm)

Partitions the communicator into disjoint subgroups based on color. Processes with the same color end up in the same new communicator.

Type Bound

comm_t

Arguments

Type IntentOptional Attributes Name
class(comm_t), intent(in) :: this
integer, intent(in) :: color

Return Value type(comm_t)


Calls

proc~~comm_split_by_color~~CallsGraph proc~comm_split_by_color comm_t%comm_split_by_color interface~comm_null comm_null proc~comm_split_by_color->interface~comm_null mpi_comm_split mpi_comm_split proc~comm_split_by_color->mpi_comm_split proc~create_comm_from_mpi create_comm_from_mpi proc~comm_split_by_color->proc~create_comm_from_mpi proc~create_null_comm create_null_comm interface~comm_null->proc~create_null_comm mpi_comm_rank mpi_comm_rank proc~create_comm_from_mpi->mpi_comm_rank mpi_comm_size mpi_comm_size proc~create_comm_from_mpi->mpi_comm_size

Called by

proc~~comm_split_by_color~~CalledByGraph proc~comm_split_by_color comm_t%comm_split_by_color proc~comm_discard_leader comm_t%comm_discard_leader proc~comm_discard_leader->proc~comm_split_by_color proc~comm_discard_to comm_t%comm_discard_to proc~comm_discard_to->proc~comm_split_by_color

Variables

Type Visibility Attributes Name Initial
integer(kind=int32), private :: ierr
type(MPI_Comm), private :: mpi_comm_new

Source Code

   function comm_split_by_color(this, color) result(new_comm)
   !! Partitions the communicator into disjoint subgroups based on color.
   !! Processes with the same color end up in the same new communicator.
      class(comm_t), intent(in) :: this
      integer, intent(in) :: color
      type(comm_t) :: new_comm
      type(MPI_Comm) :: mpi_comm_new
      integer(int32) :: ierr

      if (.not. this%is_valid) then
         new_comm = comm_null()
         return
      end if

      call MPI_Comm_split(this%m_comm, color, 0, mpi_comm_new, ierr)
      new_comm = create_comm_from_mpi(mpi_comm_new)
   end function comm_split_by_color