create_comm_from_handle Function

private function create_comm_from_handle(fhandle) result(comm)

Builds an OWNED comm_t from a caller’s Fortran MPI communicator handle.

There is no MPI here and exactly one communicator, so there is nothing to duplicate: any handle that is not the null one names the single rank, and the result is the same comm_t comm_world() gives. The signature exists so that code written against the API compiles and runs unchanged in a serial build – which is the whole point of this backend.

Not collective, unlike the real backends: there is only one rank to be collective over. A handle naming MPI_COMM_NULL returns an invalid comm_t.

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: fhandle

Return Value type(comm_t)


Calls

proc~~create_comm_from_handle~2~~CallsGraph proc~create_comm_from_handle~2 create_comm_from_handle proc~create_null_comm~2 create_null_comm proc~create_comm_from_handle~2->proc~create_null_comm~2 proc~create_world_comm~2 create_world_comm proc~create_comm_from_handle~2->proc~create_world_comm~2

Called by

proc~~create_comm_from_handle~2~~CalledByGraph proc~create_comm_from_handle~2 create_comm_from_handle interface~comm_from_handle~2 comm_from_handle interface~comm_from_handle~2->proc~create_comm_from_handle~2

Source Code

   function create_comm_from_handle(fhandle) result(comm)
   !! Builds an OWNED comm_t from a caller's Fortran MPI communicator handle.
   !!
   !! There is no MPI here and exactly one communicator, so there is nothing
   !! to duplicate: any handle that is not the null one names the single
   !! rank, and the result is the same comm_t comm_world() gives. The
   !! signature exists so that code written against the API compiles and
   !! runs unchanged in a serial build -- which is the whole point of this
   !! backend.
   !!
   !! Not collective, unlike the real backends: there is only one rank to be
   !! collective over. A handle naming MPI_COMM_NULL returns an invalid
   !! comm_t.
      integer, intent(in) :: fhandle
      type(comm_t) :: comm

      if (fhandle == MPI_COMM_NULL%v) then
         comm = create_null_comm()
      else
         comm = create_world_comm()
      end if

   end function create_comm_from_handle