submitit
submitit copied to clipboard
calculating proportionate resources with clusterscope
clusterscope has an API to calculate proportionate resource usage in the machine (CPUs / Mem) given the number of GPUs or CPUs.
that is, for GPU requests:
if a slurm partition has nodes with 8 gpus, 80 cpus, 80GB; and a user ask for a single gpu:
>>> resources = clusterscope.job_gen_task_slurm(gpus_per_task=1, partition=...)
clusterscope returns a dict with 10 cpus (1/8 gpus * 80 cpus) and 10GB (1/8 gpus * 80GB) assigned:
>>> resources
{'cpus_per_task': 10, 'memory': '10G', 'tasks_per_node': 1, 'mem_gb': 10', slurm_partition': 'h100', ...}
notice how this dict allocates the proportionate amount of cpus and mem based on the number of gpus in the request.