PetscCommCreateNonempty#
Creates a sub-communicator of the processes of a communicator that own data
Synopsis#
#include "petscsys.h"
PetscErrorCode PetscCommCreateNonempty(MPI_Comm comm, const PetscInt ranges[], MPI_Comm *subcomm)
Collective
Input Parameters#
comm - the communicator to split
ranges - the offset of the first datum owned by each process, of length one more than the size of
comm, and the same on every process
Output Parameter#
subcomm -
commitself when every process owns data,MPI_COMM_NULLon a process that owns none, and otherwise a new communicator of the processes that do
Notes#
Graph partitioning and ordering libraries such as ParMETIS and PT-SCOTCH require every process of
the communicator they are given to own at least one vertex. Building the distributed graph on the
communicator returned here, and doing nothing where it is MPI_COMM_NULL, meets that requirement
without altering the graph itself.
Release subcomm with PetscCommDestroyNonempty(), which frees it only when it is a new
communicator.
Because ranges is already known to every process, whether a split is needed is decided without
communicating, and no communicator is created when every process owns data. The processes of a new
subcomm keep their relative order in comm, so a contiguous layout stays contiguous, and
ascending, over subcomm.
See Also#
PetscCommDestroyNonempty(), PetscCommDuplicate(), PetscSubcommCreate()
Level#
developer
Location#
Index of all Sys routines
Table of Contents for all manual pages
Index of all manual pages