mache.parallel.placement.ResourcePlacement
- class mache.parallel.placement.ResourcePlacement(nodes: Sequence[str], cores: Sequence[int], gpus: int = 0, gpu_ids: Sequence[int] | None = None)[source]
Where a single parallel launch should run.
A placement says which nodes a launch may use, which cores it may use on each of them, and how many GPUs it needs in total. It is machine independent: each
ParallelSystemrenders it into whatever its launcher needs.- Variables:
nodes (tuple of str) – The hostnames the launch may run on. An empty tuple leaves the choice of nodes to the scheduler, which is only useful when nothing else is running concurrently.
The cores, on each of
nodes, that the launch may use, in the order they should be handed out to tasks. This is an explicit set rather than a count because the usable cores on a node may not be contiguous and may not start at zero.Whether the exact set is honored depends on the machine: launchers that bind explicitly use it as given, while a scheduler that reserves resources uses only how many cores there are and picks which ones itself.
gpus (int) – The number of GPUs the launch needs in total, not per task. A per-task count does not confine a launch on the GPU machines mache supports, whereas a total does. The default of 0 is rendered as an explicit request for no GPUs, since a launch that says nothing about GPUs is read as claiming every one on the node.
gpu_ids (tuple of int or None) – Which of the node’s GPUs to use, as indices from 0 to
gpus_per_node - 1. This is needed only where the batch system does not assign GPUs itself and mache has to name them, which is the case on PBS with PALS. Only the caller knows about every concurrent launch, so only the caller can assign disjoint GPUs; mache renders what it is given and never guesses.Nonewhere the scheduler assigns GPUs fromgpus.
- __init__(nodes: Sequence[str], cores: Sequence[int], gpus: int = 0, gpu_ids: Sequence[int] | None = None) None
Methods
__init__(nodes, cores[, gpus, gpu_ids])Attributes
gpu_idsgpusnodescores