private function create_comm_from_handle(fhandle) result(comm)
Builds an OWNED comm_t from a caller’s Fortran MPI communicator handle.
Under the legacy mpi module a communicator already IS this integer,
so no conversion is needed – but the duplication still is. See the
mpi_f08 backend for the full rationale: the result owns its
communicator, so finalize frees pic-mpi’s copy and never the
caller’s.
COLLECTIVE over the communicator fhandle names, because MPI_Comm_dup
is: every rank in that communicator must call this, together.
A handle naming MPI_COMM_NULL returns an invalid comm_t and makes no
MPI call.
Nodes of different colours represent the following:
Solid arrows point from a procedure to one which it calls. Dashed
arrows point from an interface to procedures which implement that interface.
This could include the module procedures in a generic interface or the
implementation in a submodule of an interface in a parent module.
Where possible, edges connecting nodes are
given different colours to make them easier to distinguish in
large graphs.
Nodes of different colours represent the following:
Solid arrows point from a procedure to one which it calls. Dashed
arrows point from an interface to procedures which implement that interface.
This could include the module procedures in a generic interface or the
implementation in a submodule of an interface in a parent module.
Where possible, edges connecting nodes are
given different colours to make them easier to distinguish in
large graphs.
Variables
Type
Visibility
Attributes
Name
Initial
integer,
private
::
dup_comm
integer(kind=int32),
private
::
ierr
Source Code
function create_comm_from_handle(fhandle)result(comm)!! Builds an OWNED comm_t from a caller's Fortran MPI communicator handle.!!!! Under the legacy `mpi` module a communicator already IS this integer,!! so no conversion is needed -- but the duplication still is. See the!! mpi_f08 backend for the full rationale: the result owns its!! communicator, so `finalize` frees pic-mpi's copy and never the!! caller's.!!!! COLLECTIVE over the communicator `fhandle` names, because MPI_Comm_dup!! is: every rank in that communicator must call this, together.!!!! A handle naming MPI_COMM_NULL returns an invalid comm_t and makes no!! MPI call.integer,intent(in)::fhandletype(comm_t)::comminteger::dup_comminteger(int32)::ierrif(fhandle==MPI_COMM_NULL)thencomm=create_null_comm()return end if call MPI_Comm_dup(fhandle,dup_comm,ierr)comm=create_comm_from_mpi(dup_comm)end function create_comm_from_handle