ssapy_toolkit.hpc
Helpers for distributing work across CPUs or nodes.
These utilities provide simple index-based partitioning that works with or without MPI.
Functions
|
Compute a contiguous slice of work for a given worker. |
|
Calculates a unique ID based on the rank, run number, and CPUs per node. |
|
Return a unique integer ID for a worker. |
- ssapy_toolkit.hpc.distribute_array_no_mpi(unique_id, total_jobs, array_size)[source]
Compute a contiguous slice of work for a given worker.
- Parameters:
- Returns:
(start_idx, end_idx)for the slice assigned to the worker, or(None, None)if no work is assigned.- Return type:
- ssapy_toolkit.hpc.get_unique_id(rank, run_number, cpus_per_node)[source]
Calculates a unique ID based on the rank, run number, and CPUs per node.
Parameters: rank (int): The rank of the CPU within the node. run_number (int): The current run number. cpus_per_node (int): The number of CPUs per node.
Returns: int: The unique ID for the given rank, run number, and CPUs per node.