communicator
Communicator
boundaries
property
boundaries of this tile with neighboring tiles
rank
property
Rank of the current process within this communicator.
size
property
Total number of ranks in this communicator.
gather(send_quantity, recv_quantity=None)
Transfer subtile regions of a full-tile quantity from each rank to the tile root rank.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
send_quantity
|
Quantity
|
quantity to send |
required |
recv_quantity
|
Quantity | None
|
if provided, assign received data into this Quantity (only used on the tile root rank) |
None
|
Returns: recv_quantity: quantity if on root rank, otherwise None
gather_state(send_state=None, recv_state=None, transfer_type=None)
Transfer a state dictionary from subtile ranks to the tile root rank.
'time' is assumed to be the same on all ranks, and its value will be set to the value from the root rank.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
send_state
|
the model state to be sent containing the subtile data |
None
|
|
recv_state
|
the pre-allocated state in which to receive the full tile state. Only variables which are scattered will be written to. |
None
|
Returns: recv_state: on the root rank, the state containing the entire tile
halo_update(quantity, n_points)
scatter(send_quantity=None, recv_quantity=None)
Transfer subtile regions of a full-tile quantity from the tile root rank to all subtiles.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
send_quantity
|
Quantity | None
|
quantity to send, only required/used on the tile root rank |
None
|
recv_quantity
|
Quantity | None
|
if provided, assign received data into this Quantity. |
None
|
Returns: recv_quantity
scatter_state(send_state=None, recv_state=None)
Transfer a state dictionary from the tile root rank to all subtiles.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
send_state
|
the model state to be sent containing the entire tile, required only from the root rank |
None
|
|
recv_state
|
the pre-allocated state in which to receive the scattered state. Only variables which are scattered will be written to. |
None
|
Returns: rank_state: the state corresponding to this rank's subdomain
start_halo_update(quantity, n_points)
Start an asynchronous halo update on a quantity.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
quantity
|
Quantity | list[Quantity]
|
the quantity to be updated |
required |
n_points
|
int
|
how many halo points to update, starting from the interior |
required |
Returns:
| Name | Type | Description |
|---|---|---|
request |
HaloUpdater
|
an asynchronous request object with a .wait() method |
start_synchronize_vector_interfaces(x_quantity, y_quantity)
Synchronize shared points at the edges of a vector interface variable.
Sends the values on the south and west edges to overwrite the values on adjacent subtiles. Vector must be defined on the Arakawa C grid.
For interface variables, the edges of the tile are computed on both ranks bordering that edge. This routine copies values across those shared edges so that both ranks have the same value for that edge. It also handles any rotation of vector quantities needed to move data across the edge.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x_quantity
|
Quantity
|
the x-component quantity to be synchronized |
required |
y_quantity
|
Quantity
|
the y-component quantity to be synchronized |
required |
Returns:
| Name | Type | Description |
|---|---|---|
request |
HaloUpdateRequest
|
an asynchronous request object with a .wait() method |
start_vector_halo_update(x_quantity, y_quantity, n_points)
Start an asynchronous halo update of a horizontal vector quantity.
Assumes the x and y dimension indices are the same between the two quantities.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x_quantity
|
Quantity | list[Quantity]
|
the x-component quantity to be halo updated |
required |
y_quantity
|
Quantity | list[Quantity]
|
the y-component quantity to be halo updated |
required |
n_points
|
int
|
how many halo points to update, starting at the interior |
required |
Returns:
| Name | Type | Description |
|---|---|---|
request |
HaloUpdater
|
an asynchronous request object with a .wait() method |
synchronize_vector_interfaces(x_quantity, y_quantity)
Synchronize shared points at the edges of a vector interface variable.
Sends the values on the south and west edges to overwrite the values on adjacent subtiles. Vector must be defined on the Arakawa C grid.
For interface variables, the edges of the tile are computed on both ranks bordering that edge. This routine copies values across those shared edges so that both ranks have the same value for that edge. It also handles any rotation of vector quantities needed to move data across the edge.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x_quantity
|
Quantity
|
the x-component quantity to be synchronized |
required |
y_quantity
|
Quantity
|
the y-component quantity to be synchronized |
required |
vector_halo_update(x_quantity, y_quantity, n_points)
Perform a halo update of a horizontal vector quantity or quantities.
Assumes the x and y dimension indices are the same between the two quantities.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x_quantity
|
Quantity | list[Quantity]
|
the x-component quantity to be halo updated |
required |
y_quantity
|
Quantity | list[Quantity]
|
the y-component quantity to be halo updated |
required |
n_points
|
int
|
how many halo points to update, starting at the interior |
required |
CubedSphereCommunicator
Bases: Communicator[CubedSpherePartitioner]
Performs communications within a cubed sphere.
boundaries
property
boundaries of this tile with neighboring tiles
rank
property
Rank of the current process within this communicator.
size
property
Total number of ranks in this communicator.
tile
property
Communicator for within a tile.
__init__(comm, partitioner, force_cpu=False, timer=None)
Initialize a CubedSphereCommunicator.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
comm
|
Comm
|
mpi4py.Comm object |
required |
partitioner
|
CubedSpherePartitioner
|
cubed sphere partitioner |
required |
force_cpu
|
bool
|
Force all communication to go through central memory. |
False
|
timer
|
Timer | None
|
Time communication operations. |
None
|
gather(send_quantity, recv_quantity=None)
Transfer subtile regions of a full-tile quantity from each rank to the tile root rank.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
send_quantity
|
Quantity
|
quantity to send |
required |
recv_quantity
|
Quantity | None
|
if provided, assign received data into this Quantity (only used on the tile root rank) |
None
|
Returns: recv_quantity: quantity if on root rank, otherwise None
gather_state(send_state=None, recv_state=None, transfer_type=None)
Transfer a state dictionary from subtile ranks to the tile root rank.
'time' is assumed to be the same on all ranks, and its value will be set to the value from the root rank.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
send_state
|
the model state to be sent containing the subtile data |
None
|
|
recv_state
|
the pre-allocated state in which to receive the full tile state. Only variables which are scattered will be written to. |
None
|
Returns: recv_state: on the root rank, the state containing the entire tile
halo_update(quantity, n_points)
scatter(send_quantity=None, recv_quantity=None)
Transfer subtile regions of a full-tile quantity from the tile root rank to all subtiles.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
send_quantity
|
Quantity | None
|
quantity to send, only required/used on the tile root rank |
None
|
recv_quantity
|
Quantity | None
|
if provided, assign received data into this Quantity. |
None
|
Returns: recv_quantity
scatter_state(send_state=None, recv_state=None)
Transfer a state dictionary from the tile root rank to all subtiles.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
send_state
|
the model state to be sent containing the entire tile, required only from the root rank |
None
|
|
recv_state
|
the pre-allocated state in which to receive the scattered state. Only variables which are scattered will be written to. |
None
|
Returns: rank_state: the state corresponding to this rank's subdomain
start_halo_update(quantity, n_points)
Start an asynchronous halo update on a quantity.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
quantity
|
Quantity | list[Quantity]
|
the quantity to be updated |
required |
n_points
|
int
|
how many halo points to update, starting from the interior |
required |
Returns:
| Name | Type | Description |
|---|---|---|
request |
HaloUpdater
|
an asynchronous request object with a .wait() method |
start_synchronize_vector_interfaces(x_quantity, y_quantity)
Synchronize shared points at the edges of a vector interface variable.
Sends the values on the south and west edges to overwrite the values on adjacent subtiles. Vector must be defined on the Arakawa C grid.
For interface variables, the edges of the tile are computed on both ranks bordering that edge. This routine copies values across those shared edges so that both ranks have the same value for that edge. It also handles any rotation of vector quantities needed to move data across the edge.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x_quantity
|
Quantity
|
the x-component quantity to be synchronized |
required |
y_quantity
|
Quantity
|
the y-component quantity to be synchronized |
required |
Returns:
| Name | Type | Description |
|---|---|---|
request |
HaloUpdateRequest
|
an asynchronous request object with a .wait() method |
start_vector_halo_update(x_quantity, y_quantity, n_points)
Start an asynchronous halo update of a horizontal vector quantity.
Assumes the x and y dimension indices are the same between the two quantities.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x_quantity
|
Quantity | list[Quantity]
|
the x-component quantity to be halo updated |
required |
y_quantity
|
Quantity | list[Quantity]
|
the y-component quantity to be halo updated |
required |
n_points
|
int
|
how many halo points to update, starting at the interior |
required |
Returns:
| Name | Type | Description |
|---|---|---|
request |
HaloUpdater
|
an asynchronous request object with a .wait() method |
synchronize_vector_interfaces(x_quantity, y_quantity)
Synchronize shared points at the edges of a vector interface variable.
Sends the values on the south and west edges to overwrite the values on adjacent subtiles. Vector must be defined on the Arakawa C grid.
For interface variables, the edges of the tile are computed on both ranks bordering that edge. This routine copies values across those shared edges so that both ranks have the same value for that edge. It also handles any rotation of vector quantities needed to move data across the edge.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x_quantity
|
Quantity
|
the x-component quantity to be synchronized |
required |
y_quantity
|
Quantity
|
the y-component quantity to be synchronized |
required |
vector_halo_update(x_quantity, y_quantity, n_points)
Perform a halo update of a horizontal vector quantity or quantities.
Assumes the x and y dimension indices are the same between the two quantities.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x_quantity
|
Quantity | list[Quantity]
|
the x-component quantity to be halo updated |
required |
y_quantity
|
Quantity | list[Quantity]
|
the y-component quantity to be halo updated |
required |
n_points
|
int
|
how many halo points to update, starting at the interior |
required |
NestTileCommunicator
Bases: TileCommunicator
Communicate within one non-periodic nested grid region.
Nested halo updates use the generic Communicator implementation rather than the specialized TileCommunicator path. NestedPartitioner supports non-periodic layouts that do not necessarily satisfy the layout assumptions enforced by TileCommunicator.
boundaries
property
boundaries of this tile with neighboring tiles
rank
property
Rank of the current process within this communicator.
size
property
Total number of ranks in this communicator.
__init__(comm, partitioner, force_cpu=False, timer=None)
Initialize a TileCommunicator.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
comm
|
Comm
|
communication object behaving like mpi4py.Comm |
required |
partitioner
|
TilePartitioner
|
tile partitioner |
required |
force_cpu
|
bool
|
force all communication to go through central memory |
False
|
timer
|
Timer | None
|
Time communication operations. |
None
|
gather(send_quantity, recv_quantity=None)
Transfer subtile regions of a full-tile quantity from each rank to the tile root rank.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
send_quantity
|
Quantity
|
quantity to send |
required |
recv_quantity
|
Quantity | None
|
if provided, assign received data into this Quantity (only used on the tile root rank) |
None
|
Returns: recv_quantity: quantity if on root rank, otherwise None
gather_state(send_state=None, recv_state=None, transfer_type=None)
Transfer a state dictionary from subtile ranks to the tile root rank.
'time' is assumed to be the same on all ranks, and its value will be set to the value from the root rank.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
send_state
|
the model state to be sent containing the subtile data |
None
|
|
recv_state
|
the pre-allocated state in which to receive the full tile state. Only variables which are scattered will be written to. |
None
|
Returns: recv_state: on the root rank, the state containing the entire tile
halo_update(quantity, n_points)
scatter(send_quantity=None, recv_quantity=None)
Transfer subtile regions of a full-tile quantity from the tile root rank to all subtiles.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
send_quantity
|
Quantity | None
|
quantity to send, only required/used on the tile root rank |
None
|
recv_quantity
|
Quantity | None
|
if provided, assign received data into this Quantity. |
None
|
Returns: recv_quantity
scatter_state(send_state=None, recv_state=None)
Transfer a state dictionary from the tile root rank to all subtiles.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
send_state
|
the model state to be sent containing the entire tile, required only from the root rank |
None
|
|
recv_state
|
the pre-allocated state in which to receive the scattered state. Only variables which are scattered will be written to. |
None
|
Returns: rank_state: the state corresponding to this rank's subdomain
synchronize_vector_interfaces(x_quantity, y_quantity)
Synchronize shared points at the edges of a vector interface variable.
Sends the values on the south and west edges to overwrite the values on adjacent subtiles. Vector must be defined on the Arakawa C grid.
For interface variables, the edges of the tile are computed on both ranks bordering that edge. This routine copies values across those shared edges so that both ranks have the same value for that edge. It also handles any rotation of vector quantities needed to move data across the edge.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x_quantity
|
Quantity
|
the x-component quantity to be synchronized |
required |
y_quantity
|
Quantity
|
the y-component quantity to be synchronized |
required |
vector_halo_update(x_quantity, y_quantity, n_points)
Perform a halo update of a horizontal vector quantity or quantities.
Assumes the x and y dimension indices are the same between the two quantities.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x_quantity
|
Quantity | list[Quantity]
|
the x-component quantity to be halo updated |
required |
y_quantity
|
Quantity | list[Quantity]
|
the y-component quantity to be halo updated |
required |
n_points
|
int
|
how many halo points to update, starting at the interior |
required |
NestedCommunicator
Coordinate communication among a parent domain and nested domains.
NestedCommunicator is an orchestration layer rather than the communicator for a single partitioned domain. It delegates same-resolution halo updates to the nested-domain communicators and coordinates parent-to-nested transport over the world communicator.
The cross-domain orchestration in this class supports the current nested-grid prototype. Some of these responsibilities may ultimately belong to a higher-level component once ownership of nested-grid orchestration is established.
Numerical coarse-to-fine interpolation is owned by the caller.
parent_to_nested(nest_id, parent_quantity, nested_quantity, coarse_n_points)
Transport parent-resolution boundary data to a nested domain.
update_nested_boundaries(nest_id, parent_quantity, nested_coarse_quantity, fine_quantity, fine_n_points, coarse_n_points)
Update internal nested halos and transport parent boundary data.
Internal nested halos are exchanged at the fine-grid resolution. Parent boundary data is transported into a parent-resolution quantity on the nested ranks for subsequent coarse-to-fine interpolation.
update_nested_halo(nest_id, fine_quantity, n_points)
Perform same-resolution halo communication within one nest.
TileCommunicator
Bases: Communicator[TilePartitioner]
Performs communications within a single tile or region of a tile.
boundaries
property
boundaries of this tile with neighboring tiles
rank
property
Rank of the current process within this communicator.
size
property
Total number of ranks in this communicator.
__init__(comm, partitioner, force_cpu=False, timer=None)
Initialize a TileCommunicator.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
comm
|
Comm
|
communication object behaving like mpi4py.Comm |
required |
partitioner
|
TilePartitioner
|
tile partitioner |
required |
force_cpu
|
bool
|
force all communication to go through central memory |
False
|
timer
|
Timer | None
|
Time communication operations. |
None
|
gather(send_quantity, recv_quantity=None)
Transfer subtile regions of a full-tile quantity from each rank to the tile root rank.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
send_quantity
|
Quantity
|
quantity to send |
required |
recv_quantity
|
Quantity | None
|
if provided, assign received data into this Quantity (only used on the tile root rank) |
None
|
Returns: recv_quantity: quantity if on root rank, otherwise None
gather_state(send_state=None, recv_state=None, transfer_type=None)
Transfer a state dictionary from subtile ranks to the tile root rank.
'time' is assumed to be the same on all ranks, and its value will be set to the value from the root rank.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
send_state
|
the model state to be sent containing the subtile data |
None
|
|
recv_state
|
the pre-allocated state in which to receive the full tile state. Only variables which are scattered will be written to. |
None
|
Returns: recv_state: on the root rank, the state containing the entire tile
halo_update(quantity, n_points)
scatter(send_quantity=None, recv_quantity=None)
Transfer subtile regions of a full-tile quantity from the tile root rank to all subtiles.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
send_quantity
|
Quantity | None
|
quantity to send, only required/used on the tile root rank |
None
|
recv_quantity
|
Quantity | None
|
if provided, assign received data into this Quantity. |
None
|
Returns: recv_quantity
scatter_state(send_state=None, recv_state=None)
Transfer a state dictionary from the tile root rank to all subtiles.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
send_state
|
the model state to be sent containing the entire tile, required only from the root rank |
None
|
|
recv_state
|
the pre-allocated state in which to receive the scattered state. Only variables which are scattered will be written to. |
None
|
Returns: rank_state: the state corresponding to this rank's subdomain
start_halo_update(quantity, n_points)
Start an asynchronous halo update on a quantity.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
quantity
|
Quantity | list[Quantity]
|
the quantity to be updated |
required |
n_points
|
int
|
how many halo points to update, starting from the interior |
required |
Returns:
| Name | Type | Description |
|---|---|---|
request |
HaloUpdater
|
an asynchronous request object with a .wait() method |
start_synchronize_vector_interfaces(x_quantity, y_quantity)
Synchronize shared points at the edges of a vector interface variable.
Sends the values on the south and west edges to overwrite the values on adjacent subtiles. Vector must be defined on the Arakawa C grid.
For interface variables, the edges of the tile are computed on both ranks bordering that edge. This routine copies values across those shared edges so that both ranks have the same value for that edge. It also handles any rotation of vector quantities needed to move data across the edge.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x_quantity
|
Quantity
|
the x-component quantity to be synchronized |
required |
y_quantity
|
Quantity
|
the y-component quantity to be synchronized |
required |
Returns:
| Name | Type | Description |
|---|---|---|
request |
HaloUpdateRequest
|
an asynchronous request object with a .wait() method |
start_vector_halo_update(x_quantity, y_quantity, n_points)
Start an asynchronous halo update of a horizontal vector quantity.
Assumes the x and y dimension indices are the same between the two quantities.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x_quantity
|
Quantity | list[Quantity]
|
the x-component quantity to be halo updated |
required |
y_quantity
|
Quantity | list[Quantity]
|
the y-component quantity to be halo updated |
required |
n_points
|
int
|
how many halo points to update, starting at the interior |
required |
Returns:
| Name | Type | Description |
|---|---|---|
request |
HaloUpdater
|
an asynchronous request object with a .wait() method |
synchronize_vector_interfaces(x_quantity, y_quantity)
Synchronize shared points at the edges of a vector interface variable.
Sends the values on the south and west edges to overwrite the values on adjacent subtiles. Vector must be defined on the Arakawa C grid.
For interface variables, the edges of the tile are computed on both ranks bordering that edge. This routine copies values across those shared edges so that both ranks have the same value for that edge. It also handles any rotation of vector quantities needed to move data across the edge.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x_quantity
|
Quantity
|
the x-component quantity to be synchronized |
required |
y_quantity
|
Quantity
|
the y-component quantity to be synchronized |
required |
vector_halo_update(x_quantity, y_quantity, n_points)
Perform a halo update of a horizontal vector quantity or quantities.
Assumes the x and y dimension indices are the same between the two quantities.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x_quantity
|
Quantity | list[Quantity]
|
the x-component quantity to be halo updated |
required |
y_quantity
|
Quantity | list[Quantity]
|
the y-component quantity to be halo updated |
required |
n_points
|
int
|
how many halo points to update, starting at the interior |
required |
to_numpy(array, dtype=None)
Input array can be a numpy array or a cupy array. Returns numpy array.