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
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
,petsc.PetscSFBcastBegin
- bcastEnd(unit, rootdata, leafdata, op)¶
End a broadcast & reduce operation started with
bcastBegin
.Collective.
- Parameters:
- Return type:
See also
bcastBegin
,petsc.PetscSFBcastEnd
- compose(sf)¶
Compose a new
SF
.Collective.
Puts the
sf
under this object in a top (roots) down (leaves) view.See also
petsc.PetscSFCompose
- computeDegree()¶
Compute and return the degree of each root vertex.
Collective.
See also
petsc.PetscSFComputeDegreeBegin
,petsc.PetscSFComputeDegreeEnd
Source code at petsc4py/PETSc/SF.pyx:281
- 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
petsc.PetscSFCreate
- createEmbeddedLeafSF(selected)¶
Remove edges from all but the selected leaves.
Collective.
Does not remap indices.
See also
petsc.PetscSFCreateEmbeddedLeafSF
- createEmbeddedRootSF(selected)¶
Remove edges from all but the selected roots.
Collective.
Does not remap indices.
See also
petsc.PetscSFCreateEmbeddedRootSF
- createInverse()¶
Create the inverse map.
Collective.
Create the inverse map given a PetscSF in which all vertices have degree 1.
See also
petsc.PetscSFCreateInverseSF
Source code at petsc4py/PETSc/SF.pyx:264
- 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
petsc.PetscSFCreateSectionSF
- destroy()¶
Destroy the star forest.
Collective.
See also
petsc.PetscSFDestroy
Source code at petsc4py/PETSc/SF.pyx:52
- 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
petsc.PetscSFDistributeSection
- 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
,petsc.PetscSFFetchAndOpBegin
- 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
fetchAndOpBegin
,petsc.PetscSFFetchAndOpEnd
- gatherBegin(unit, leafdata, multirootdata)¶
Begin pointwise gather of all leaves into multi-roots.
Collective.
This call has to be completed with
gatherEnd
.- Parameters:
unit (Datatype) – MPI datatype.
leafdata (ndarray) – Leaf data to gather to roots.
multirootdata (ndarray) – Root buffer to gather into, amount of space per root is equal to its degree.
- Return type:
See also
gatherEnd
,petsc.PetscSFGatherBegin
- gatherEnd(unit, leafdata, multirootdata)¶
End gather operation that was started with
gatherBegin
.Collective.
- Parameters:
unit (Datatype) – MPI datatype.
leafdata (ndarray) – Leaf data to gather to roots.
multirootdata (ndarray) – Root buffer to gather into, amount of space per root is equal to its degree.
- Return type:
See also
gatherBegin
,petsc.PetscSFGatherEnd
- getGraph()¶
Return star forest graph.
Not collective.
The number of leaves can be determined from the size of
ilocal
.- Returns:
- Return type:
See also
petsc.PetscSFGetGraph
- getMulti()¶
Return the inner SF implementing gathers and scatters.
Collective.
See also
petsc.PetscSFGetMultiSF
Source code at petsc4py/PETSc/SF.pyx:249
- Return type:
- getType()¶
Return the type name of the star forest.
Collective.
See also
petsc.PetscSFGetType
Source code at petsc4py/PETSc/SF.pyx:105
- 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
,petsc.PetscSFReduceBegin
- reduceEnd(unit, leafdata, rootdata, op)¶
End a reduction operation started with
reduceBegin
.Collective.
- Parameters:
- Return type:
See also
reduceBegin
,petsc.PetscSFReduceEnd
- reset()¶
Reset a star forest so that different sizes or neighbors can be used.
Collective.
See also
petsc.PetscSFReset
Source code at petsc4py/PETSc/SF.pyx:143
- 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:
unit (Datatype) – MPI datatype.
multirootdata (ndarray) – Root buffer to send to each leaf, one unit of data per leaf.
leafdata (ndarray) – Leaf data to be updated with personal data from each respective root.
- Return type:
See also
scatterEnd
,petsc.PetscSFScatterBegin
- scatterEnd(unit, multirootdata, leafdata)¶
End scatter operation that was started with
scatterBegin
.Collective.
- Parameters:
unit (Datatype) – MPI datatype.
multirootdata (ndarray) – Root buffer to send to each leaf, one unit of data per leaf.
leafdata (ndarray) – Leaf data to be updated with personal data from each respective root.
- Return type:
See also
scatterBegin
,petsc.PetscSFScatterEnd
- setFromOptions()¶
Set options using the options database.
Logically collective.
See also
Working with PETSc options (TODO),
petsc.PetscSFSetFromOptions
Source code at petsc4py/PETSc/SF.pyx:119
- 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
petsc.PetscSFSetGraph
- setRankOrder(flag)¶
Sort multi-points for gathers and scatters by rank order.
Logically collective.
See also
petsc.PetscSFSetRankOrder
- setType(sf_type)¶
Set the type of the star forest.
Collective.
See also
petsc.PetscSFSetType
- setUp()¶
Set up communication structures.
Collective.
See also
petsc.PetscSFSetUp
Source code at petsc4py/PETSc/SF.pyx:131
- Return type: