petsc4py.PETSc.SF#
- class petsc4py.PETSc.SF#
Bases:
Object
Star Forest object for communication.
SF is used for setting up and managing the communication of certain entries of arrays and
Vec
between MPI processes.Enumerations
The star forest types.
Methods Summary
bcastBegin
(unit, rootdata, leafdata, op)Begin pointwise broadcast.
bcastEnd
(unit, rootdata, leafdata, op)End a broadcast & reduce operation started with
bcastBegin
.compose
(sf)Compose a new
SF
.Compute and return the degree of each root vertex.
create
([comm])Create a star forest communication context.
createEmbeddedLeafSF
(selected)Remove edges from all but the selected leaves.
createEmbeddedRootSF
(selected)Remove edges from all but the selected roots.
Create the inverse map.
createSectionSF
(rootSection, remoteOffsets, ...)Create an expanded
SF
of DOFs.destroy
()Destroy the star forest.
distributeSection
(rootSection[, leafSection])Create a new, reorganized
Section
.fetchAndOpBegin
(unit, rootdata, leafdata, ...)Begin fetch and update operation.
fetchAndOpEnd
(unit, rootdata, leafdata, ...)End operation started in a matching call to
fetchAndOpBegin
.gatherBegin
(unit, leafdata, multirootdata)Begin pointwise gather of all leaves into multi-roots.
gatherEnd
(unit, leafdata, multirootdata)End gather operation that was started with
gatherBegin
.getGraph
()Return star forest graph.
getMulti
()Return the inner SF implementing gathers and scatters.
getType
()Return the type name of the star forest.
reduceBegin
(unit, leafdata, rootdata, op)Begin reduction of leafdata into rootdata.
reduceEnd
(unit, leafdata, rootdata, op)End a reduction operation started with
reduceBegin
.reset
()Reset a star forest so that different sizes or neighbors can be used.
scatterBegin
(unit, multirootdata, leafdata)Begin pointwise scatter operation.
scatterEnd
(unit, multirootdata, leafdata)End scatter operation that was started with
scatterBegin
.Set options using the options database.
setGraph
(nroots, local, remote)Set star forest graph.
setRankOrder
(flag)Sort multi-points for gathers and scatters by rank order.
setType
(sf_type)Set the type of the star forest.
setUp
()Set up communication structures.
view
([viewer])View a star forest.
Methods Documentation
- bcastBegin(unit, rootdata, leafdata, op)#
Begin pointwise broadcast.
Collective.
Root values are reduced to leaf values. This call has to be concluded with a call to
bcastEnd
.- Parameters:
- Return type:
See also
- bcastEnd(unit, rootdata, leafdata, op)#
End a broadcast & reduce operation started with
bcastBegin
.Collective.
- Parameters:
- Return type:
See also
- compose(sf)#
Compose a new
SF
.Collective.
Puts the
sf
under this object in a top (roots) down (leaves) view.See also
- computeDegree()#
Compute and return the degree of each root vertex.
Collective.
Source code at petsc4py/PETSc/SF.pyx:279
- Return type:
- create(comm=None)#
Create a star forest communication context.
Collective.
- Parameters:
comm (Comm | None) – MPI communicator, defaults to
Sys.getDefaultComm
.- Return type:
See also
- createEmbeddedLeafSF(selected)#
Remove edges from all but the selected leaves.
Collective.
Does not remap indices.
See also
- createEmbeddedRootSF(selected)#
Remove edges from all but the selected roots.
Collective.
Does not remap indices.
See also
- createInverse()#
Create the inverse map.
Collective.
Create the inverse map given a PetscSF in which all vertices have degree 1.
See also
Source code at petsc4py/PETSc/SF.pyx:262
- Return type:
- createSectionSF(rootSection, remoteOffsets, leafSection)#
Create an expanded
SF
of DOFs.Collective.
Assumes the input
SF
relates points.- Parameters:
rootSection (Section) – Data layout of remote points for outgoing data (this is usually the serial section).
remoteOffsets (Sequence[int] | None) – Offsets for point data on remote processes (these are offsets from the root section), or
None
.leafSection (Section) – Data layout of local points for incoming data (this is the distributed section).
- Return type:
See also
- destroy()#
Destroy the star forest.
Collective.
See also
Source code at petsc4py/PETSc/SF.pyx:50
- Return type:
- distributeSection(rootSection, leafSection=None)#
Create a new, reorganized
Section
.Collective.
Moves from the root to the leaves of the
SF
.- Parameters:
- Return type:
See also
- fetchAndOpBegin(unit, rootdata, leafdata, leafupdate, op)#
Begin fetch and update operation.
Collective.
This operation fetches values from root and updates atomically by applying an operation using the leaf value.
This call has to be completed with
fetchAndOpEnd
.- Parameters:
unit (Datatype) – MPI datatype.
rootdata (ndarray) – Root values to be updated, input state is seen by first process to perform an update.
leafdata (ndarray) – Leaf values to use in reduction.
leafupdate (ndarray) – State at each leaf’s respective root immediately prior to my atomic update.
op (Op) – MPI reduction operation.
- Return type:
See also
- fetchAndOpEnd(unit, rootdata, leafdata, leafupdate, op)#
End operation started in a matching call to
fetchAndOpBegin
.Collective.
- Parameters:
unit (Datatype) – MPI datatype.
rootdata (ndarray) – Root values to be updated, input state is seen by first process to perform an update.
leafdata (ndarray) – Leaf values to use in reduction.
leafupdate (ndarray) – State at each leaf’s respective root immediately prior to my atomic update.
op (Op) – MPI reduction operation.
- Return type:
See also
- gatherBegin(unit, leafdata, multirootdata)#
Begin pointwise gather of all leaves into multi-roots.
Collective.
This call has to be completed with
gatherEnd
.- Parameters:
- Return type:
See also
- gatherEnd(unit, leafdata, multirootdata)#
End gather operation that was started with
gatherBegin
.Collective.
- Parameters:
- Return type:
See also
- getGraph()#
Return star forest graph.
Not collective.
The number of leaves can be determined from the size of
ilocal
.- Returns:
- Return type:
See also
- getMulti()#
Return the inner SF implementing gathers and scatters.
Collective.
See also
Source code at petsc4py/PETSc/SF.pyx:247
- Return type:
- getType()#
Return the type name of the star forest.
Collective.
See also
Source code at petsc4py/PETSc/SF.pyx:103
- Return type:
- reduceBegin(unit, leafdata, rootdata, op)#
Begin reduction of leafdata into rootdata.
Collective.
This call has to be completed with call to
reduceEnd
.- Parameters:
- Return type:
See also
- reduceEnd(unit, leafdata, rootdata, op)#
End a reduction operation started with
reduceBegin
.Collective.
- Parameters:
- Return type:
See also
- reset()#
Reset a star forest so that different sizes or neighbors can be used.
Collective.
See also
Source code at petsc4py/PETSc/SF.pyx:141
- Return type:
- scatterBegin(unit, multirootdata, leafdata)#
Begin pointwise scatter operation.
Collective.
Operation is from multi-roots to leaves. This call has to be completed with
scatterEnd
.- Parameters:
- Return type:
See also
- scatterEnd(unit, multirootdata, leafdata)#
End scatter operation that was started with
scatterBegin
.Collective.
- Parameters:
- Return type:
See also
- setFromOptions()#
Set options using the options database.
Logically collective.
Source code at petsc4py/PETSc/SF.pyx:117
- Return type:
- setGraph(nroots, local, remote)#
Set star forest graph.
Collective.
The number of leaves argument can be determined from the size of
local
and/orremote
.- Parameters:
nroots (int) – Number of root vertices on the current process (these are possible targets for other process to attach leaves).
local (Sequence[int]) – Locations of leaves in leafdata buffers, pass
None
for contiguous storage.remote (Sequence[int]) – Remote locations of root vertices for each leaf on the current process. Should be
2*nleaves
long as (rank, index) pairs.
- Return type:
See also
- setRankOrder(flag)#
Sort multi-points for gathers and scatters by rank order.
Logically collective.
See also
- setType(sf_type)#
Set the type of the star forest.
Collective.
See also
- setUp()#
Set up communication structures.
Collective.
See also
Source code at petsc4py/PETSc/SF.pyx:129
- Return type:
- view(viewer=None)#
View a star forest.
Collective.
See also