如何获取分配给多个GPU节点上的SLURM作业的GPU的ID? [英] How to get the ID of GPU allocated to a SLURM job on a multiple GPUs node?

查看:781
本文介绍了如何获取分配给多个GPU节点上的SLURM作业的GPU的ID?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我向带有两个GPU的节点提交带有选项--gres = gpu:1的SLURM作业时,如何获取为该作业分配的GPU的ID?是否有为此目的的环境变量?我使用的GPU都是nvidia GPU. 谢谢.

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.

推荐答案

您可以使用环境变量CUDA_VISIBLE_DEVICES获取GPU ID.此变量是分配给作业的GPU ID的逗号分隔列表.

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.

这篇关于如何获取分配给多个GPU节点上的SLURM作业的GPU的ID?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆