How to get the ID of GPU allocated to a SLURM job

2019-06-28 04:09发布

When I submit a SLURM job with the option --gres=gpu:1 to a node with two GPUs, how can I get the ID of the GPU which is allocated for the job? Is there an environment variable for this purpose? The GPUs I'm using are all nvidia GPUs. Thanks.

1条回答
太酷不给撩
2楼-- · 2019-06-28 04:52

You can get the GPU id with the environment variable CUDA_VISIBLE_DEVICES. This variable is a comma separated list of the GPU ids assigned to the job.

查看更多
登录 后发表回答