Skip to content

updater

TIMER_HALO_EX_KEY = 'halo_exchange_global' module-attribute

HaloUpdater

Exchange halo information between ranks.

The class is responsible for the entire exchange and uses the init to precompute the maximum of information to have minimum overhead at runtime. Therefore it should be cached for early and re-used at runtime.

  • from_scalar_specifications/from_vector_specifications are used to create a HaloUpdater from a list of memory specifications
  • update and start/wait trigger the halo exchange
  • the class creates a "pattern" of exchange that can fit any memory given to do/start
  • temporary references to the Quantities are held between start and wait

__init__(comm, tag, transformers, timer)

Build the updater.

Parameters:

Name Type Description Default
comm Communicator

communicator responsible for send/recv commands.

required
tag int

network tag to be used for communication

required
transformers dict[int, HaloDataTransformer]

mapping from destination rank to transformers used to pack/unpack before and after communication

required
timer Timer

timing operations

required

force_finalize_on_wait()

HaloDataTransformer are finalized after a wait call

This is a temporary fix. See DSL-816 which will remove self._finalize_on_wait.

from_scalar_specifications(comm, numpy_like_module, specifications, boundaries, tag, optional_timer=None) classmethod

Create/retrieve as many packed buffer as needed and queue the slices to exchange.

Parameters:

Name Type Description Default
comm Communicator

communicator to post network messages

required
numpy_like_module ModuleType

module implementing numpy API

required
specifications Iterable[QuantityHaloSpec]

data specifications to exchange, including number of halo points

required
boundaries Iterable[Boundary]

information on the exchange boundaries.

required
tag int

network tag (to differentiate messaging) for this node.

required
optional_timer Timer | None

timing of operations.

None

Returns:

Type Description
HaloUpdater

HaloUpdater ready to exchange data.

from_vector_specifications(comm, numpy_like_module, specifications_x, specifications_y, boundaries, tag, optional_timer=None) classmethod

Create/retrieve as many packed buffer as needed and queue the slices to exchange.

Parameters:

Name Type Description Default
comm Communicator

communicator to post network messages

required
numpy_like_module ModuleType

module implementing numpy API

required
specifications_x Iterable[QuantityHaloSpec]

specifications to exchange along the x axis. Length must match y specifications.

required
specifications_y Iterable[QuantityHaloSpec]

specifications to exchange along the y axis. Length must match x specifications.

required
boundaries Iterable[Boundary]

information on the exchange boundaries.

required
tag int

network tag (to differentiate messaging) for this node.

required
optional_timer Timer | None

timing of operations.

None

Returns:

Type Description
HaloUpdater

HaloUpdater ready to exchange data.

update(quantities_x, quantities_y=None)

Exchange the data and blocks until finished.

start(quantities_x, quantities_y=None)

Start data exchange.

wait()

Finalize data exchange.

HaloUpdateRequest

Asynchronous request object for halo updates.

__init__(send_data, recv_data, timer=None)

Build a halo request. Args: send_data: a tuple of the MPI request and the buffer sent recv_data: a tuple of the MPI request, the temporary buffer and the destination buffer timer: optional, time the wait & unpack of a halo exchange

wait()

Wait & unpack data into destination buffers Clean up by inserting back all buffers back in cache for potential reuse

VectorInterfaceHaloUpdater

timer = timer if timer is not None else NullTimer() instance-attribute

comm = comm instance-attribute

boundaries = boundaries instance-attribute

__init__(comm, boundaries, force_cpu=False, timer=None)

Initialize a CubedSphereCommunicator.

Parameters:

Name Type Description Default
comm Comm

ndsl.Comm object

required
boundaries Mapping[int, Boundary]

?

required
force_cpu bool

Force all communication to go through central memory. Optional.

False
timer Timer | None

Time communication operations. Optional.

None

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

on_c_grid(x_quantity, y_quantity)