transports
mpi
- class anemoi.inference.transports.mpi.MPITransport(couplings: Configuration, tasks: dict[str, Task], *args: Any, **kwargs: Any)
Bases:
TransportTransport implementation using MPI.
- send(sender: Task, target: Task, state: dict[str, Any], tag: int) None
Send a state from the sender to the target.
- receive(receiver: Task, source: Task, tag: int) dict[str, Any]
Receive a state from the source to the receiver.
- Parameters:
receiver (Any) – The task receiving the state.
source (Any) – The task sending the state.
tag (int) – The tag associated with the state.
- Returns:
The received state.
- Return type:
Any
processes
- class anemoi.inference.transports.processes.ProcessesTransport(couplings: Any, tasks: dict[str, Any], *args: Any, **kwargs: Any)
Bases:
TransportTransport implementation using processes.
- child_process(task: Any) int
Run the task in a child process.
- Parameters:
task (Any) – The task to be run.
- Returns:
The exit status of the child process.
- Return type:
- send(sender: Task, target: Task, state: dict[str, Any], tag: int) None
Send a state from the sender to the target.
- Parameters:
sender (Any) – The task sending the state.
target (Any) – The task receiving the state.
state (Any) – The state to be sent.
tag (int) – The tag associated with the state.
- receive(receiver: Task, source: Task, tag: int) dict[str, Any]
Receive a state from the source to the receiver.
- Parameters:
receiver (Any) – The task receiving the state.
source (Any) – The task sending the state.
tag (int) – The tag associated with the state.
- Returns:
The received state.
- Return type:
Any
threads
- class anemoi.inference.transports.threads.TaskWrapper(task: Task)
Bases:
objectWraps a task to be executed in a thread.
- run(transport: ThreadsTransport) None
Run the task within the given transport.
- Parameters:
transport (ThreadsTransport) – The transport in which the task is run.
- class anemoi.inference.transports.threads.ThreadsTransport(couplings: Any, tasks: dict[str, Task], *args: Any, **kwargs: Any)
Bases:
TransportTransport implementation using threads.
- send(sender: Task, target: Task, state: dict[str, Any], tag: int) None
Send a state from the sender to the target.
- Parameters:
sender (Any) – The task sending the state.
target (Any) – The task receiving the state.
state (Any) – The state to be sent.
tag (int) – The tag associated with the state.
- receive(receiver: Task, source: Task, tag: int) dict[str, Any]
Receive a state from the source to the receiver.
- Parameters:
receiver (Any) – The task receiving the state.
source (Any) – The task sending the state.
tag (int) – The tag associated with the state.
- Returns:
The received state.
- Return type:
Any