comm_discard_to Function

private function comm_discard_to(this, num_ranks) result(new_comm)

Type Bound

comm_t

Arguments

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

Return Value type(comm_t)


Calls

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

Variables

Type Visibility Attributes Name Initial
integer(kind=int32), private :: color

Source Code

   function comm_discard_to(this, num_ranks) result(new_comm)
      class(comm_t), intent(in) :: this
      integer, intent(in) :: num_ranks
      type(comm_t) :: new_comm
      integer(int32) :: color

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

      if (this%rank() < num_ranks) then
         color = 0_int32
      else
         color = MPI_UNDEFINED
      end if
      new_comm = this%split_by(color)
   end function comm_discard_to