PlagTag
PlagTag

Reputation: 6429

slurm how to get the cpu_ids from within an sbatch job?

What's the best way to get the valid cpu ids from within a running job? My idea is to do an allocation --> wrap a docker command with the limits of the allocation --> run nvidia-docker on an remote gpu server.

To limit the docker to the allocation I need to tell it the cpu_ids.

My job submission will look like:

sbatch -o test.txt -c2 -n 10 --mem=10GB --wrap="job that needs the cpu_ids"

Upvotes: 0

Views: 592

Answers (1)

Bub Espinja
Bub Espinja

Reputation: 4571

In the script you launch with sbatch, you should execute the next line in order to get the CPU IDs and save them in a file:

scontrol -dd show job $SLURM_JOB_ID | grep "CPU_IDs" | sed 's/^ *//' > cpuids.out

Upvotes: 2

Related Questions