为什么在运行带有内置插件的 SLURM 的集群上请求 GPU 作为通用资源会失败?

Pix*_*hem 10 cluster job-scheduler hpc

免责声明:这篇文章很长,因为我试图提供所有相关的配置信息。

状态和问题:

我管理一个 gpu 集群,我想使用 slurm 进行作业管理。不幸的是,我无法使用 slurm 的相应通用资源插件来请求 GPU。

注意:test.sh 是一个打印环境变量 CUDA_VISIBLE_DEVICES 的小脚本。

正在运行的作业--gres=gpu:1未完成

运行srun -n1 --gres=gpu:1 test.sh结果如下错误:

srun: error: Unable to allocate resources: Requested node configuration is not available
Run Code Online (Sandbox Code Playgroud)

日志:

gres: gpu state for job 83
    gres_cnt:4 node_cnt:0 type:(null)
    _pick_best_nodes: job 83 never runnable
    _slurm_rpc_allocate_resources: Requested node configuration is not available
Run Code Online (Sandbox Code Playgroud)

运行作业--gres=gram:500确实完成

srun -n1 --gres=gram:500 test.sh但是,如果我打电话,作业会运行并打印

CUDA_VISIBLE_DEVICES=NoDevFiles
Run Code Online (Sandbox Code Playgroud)

日志:

sched: _slurm_rpc_allocate_resources JobId=76 NodeList=smurf01 usec=193
debug:  Configuration for job 76 complete
debug:  laying out the 1 tasks on 1 hosts smurf01 dist 1
job_complete: JobID=76 State=0x1 NodeCnt=1 WIFEXITED 1 WEXITSTATUS 0
job_complete: JobID=76 State=0x8003 NodeCnt=1 done
Run Code Online (Sandbox Code Playgroud)

因此,slurm 似乎已正确配置为使用srun请求的通用资源运行作业,--gres但由于某种原因无法识别 gpu。

我的第一个想法是为 gpu 通用资源使用另一个名称,因为其他通用资源似乎可以工作,但我想坚持使用 gpu 插件。

配置

集群有两个以上的从属主机,但为了清楚起见,我将坚持使用两个稍微不同配置的从属主机和控制器主机:papa(控制器)、smurf01 和 smurf02。

配置文件

slurm 配置的通用资源相关部分:

...
TaskPlugin=task/cgroup
...
GresTypes=gpu,ram,gram,scratch
...
NodeName=smurf01 NodeAddr=192.168.1.101 Feature="intel,fermi" Boards=1 SocketsPerBoard=2 CoresPerSocket=6 ThreadsPerCore=2 Gres=gpu:tesla:8,ram:48,gram:no_consume:6000,scratch:1300
NodeName=smurf02 NodeAddr=192.168.1.102 Feature="intel,fermi" Boards=1 SocketsPerBoard=2 CoresPerSocket=6 ThreadsPerCore=1 Gres=gpu:tesla:8,ram:48,gram:no_consume:6000,scratch:1300
...
Run Code Online (Sandbox Code Playgroud)

注意:ram 以 GB 为单位,gram 以 MB 为单位,scratch 再次以 GB 为单位。

输出 scontrol show node

NodeName=smurf01 Arch=x86_64 CoresPerSocket=6
   CPUAlloc=0 CPUErr=0 CPUTot=24 CPULoad=0.01 Features=intel,fermi
   Gres=gpu:tesla:8,ram:48,gram:no_consume:6000,scratch:1300
   NodeAddr=192.168.1.101 NodeHostName=smurf01 Version=14.11
   OS=Linux RealMemory=1 AllocMem=0 Sockets=2 Boards=1
   State=IDLE ThreadsPerCore=2 TmpDisk=0 Weight=1
   BootTime=2015-04-23T13:58:15 SlurmdStartTime=2015-04-24T10:30:46
   CurrentWatts=0 LowestJoules=0 ConsumedJoules=0
   ExtSensorsJoules=n/s ExtSensorsWatts=0 ExtSensorsTemp=n/s

NodeName=smurf02 Arch=x86_64 CoresPerSocket=6
   CPUAlloc=0 CPUErr=0 CPUTot=12 CPULoad=0.01 Features=intel,fermi
   Gres=gpu:tesla:8,ram:48,gram:no_consume:6000,scratch:1300
   NodeAddr=192.168.1.102 NodeHostName=smurf02 Version=14.11
   OS=Linux RealMemory=1 AllocMem=0 Sockets=2 Boards=1
   State=IDLE ThreadsPerCore=1 TmpDisk=0 Weight=1
   BootTime=2015-04-23T13:57:56 SlurmdStartTime=2015-04-24T10:24:12
   CurrentWatts=0 LowestJoules=0 ConsumedJoules=0
   ExtSensorsJoules=n/s ExtSensorsWatts=0 ExtSensorsTemp=n/s
Run Code Online (Sandbox Code Playgroud)

smurf01 配置

GPU

 > ls /dev | grep nvidia
nvidia0
... 
nvidia7
 > nvidia-smi | grep Tesla
|   0  Tesla M2090         On   | 0000:08:00.0     Off |                    0 |
... 
|   7  Tesla M2090         On   | 0000:1B:00.0     Off |                    0 |
...
Run Code Online (Sandbox Code Playgroud)

配置文件

Name=gpu Type=tesla File=/dev/nvidia0 CPUs=0
Name=gpu Type=tesla File=/dev/nvidia1 CPUs=1
Name=gpu Type=tesla File=/dev/nvidia2 CPUs=2
Name=gpu Type=tesla File=/dev/nvidia3 CPUs=3
Name=gpu Type=tesla File=/dev/nvidia4 CPUs=4
Name=gpu Type=tesla File=/dev/nvidia5 CPUs=5
Name=gpu Type=tesla File=/dev/nvidia6 CPUs=6
Name=gpu Type=tesla File=/dev/nvidia7 CPUs=7
Name=ram Count=48
Name=gram Count=6000
Name=scratch Count=1300
Run Code Online (Sandbox Code Playgroud)

smurf02 配置

GPU

与 smurf01 相同的配置/输出。

smurf02 上的 gres.conf

Name=gpu Count=8 Type=tesla File=/dev/nvidia[0-7]
Name=ram Count=48
Name=gram Count=6000
Name=scratch Count=1300
Run Code Online (Sandbox Code Playgroud)

注意:守护进程已重新启动,机器也已重新启动。slurm 和作业提交用户在从节点和控制器节点上具有相同的 ID/组,并且 munge 身份验证工作正常。

日志输出

DebugFlags=Gres在 slurm.conf 文件中添加了 GPU,插件似乎可以识别这些 GPU:

控制器日志

gres / gpu: state for smurf01
   gres_cnt found : 8 configured : 8 avail : 8 alloc : 0
   gres_bit_alloc :
   gres_used : (null)
   topo_cpus_bitmap[0] : 0
   topo_gres_bitmap[0] : 0
   topo_gres_cnt_alloc[0] : 0
   topo_gres_cnt_avail[0] : 1
   type[0] : tesla
   topo_cpus_bitmap[1] : 1
   topo_gres_bitmap[1] : 1
   topo_gres_cnt_alloc[1] : 0
   topo_gres_cnt_avail[1] : 1
   type[1] : tesla
   topo_cpus_bitmap[2] : 2
   topo_gres_bitmap[2] : 2
   topo_gres_cnt_alloc[2] : 0
   topo_gres_cnt_avail[2] : 1
   type[2] : tesla
   topo_cpus_bitmap[3] : 3
   topo_gres_bitmap[3] : 3
   topo_gres_cnt_alloc[3] : 0
   topo_gres_cnt_avail[3] : 1
   type[3] : tesla
   topo_cpus_bitmap[4] : 4
   topo_gres_bitmap[4] : 4
   topo_gres_cnt_alloc[4] : 0
   topo_gres_cnt_avail[4] : 1
   type[4] : tesla
   topo_cpus_bitmap[5] : 5
   topo_gres_bitmap[5] : 5
   topo_gres_cnt_alloc[5] : 0
   topo_gres_cnt_avail[5] : 1
   type[5] : tesla
   topo_cpus_bitmap[6] : 6
   topo_gres_bitmap[6] : 6
   topo_gres_cnt_alloc[6] : 0
   topo_gres_cnt_avail[6] : 1
   type[6] : tesla
   topo_cpus_bitmap[7] : 7
   topo_gres_bitmap[7] : 7
   topo_gres_cnt_alloc[7] : 0
   topo_gres_cnt_avail[7] : 1
   type[7] : tesla
   type_cnt_alloc[0] : 0
   type_cnt_avail[0] : 8
   type[0] : tesla
...
gres/gpu: state for smurf02
   gres_cnt found:TBD configured:8 avail:8 alloc:0
   gres_bit_alloc:
   gres_used:(null)
   type_cnt_alloc[0]:0
   type_cnt_avail[0]:8
   type[0]:tesla
Run Code Online (Sandbox Code Playgroud)

从站日志

Gres Name = gpu Type = tesla Count = 8 ID = 7696487 File = / dev / nvidia[0 - 7]
...
gpu 0 is device number 0
gpu 1 is device number 1
gpu 2 is device number 2
gpu 3 is device number 3
gpu 4 is device number 4
gpu 5 is device number 5
gpu 6 is device number 6
gpu 7 is device number 7
Run Code Online (Sandbox Code Playgroud)

Pix*_*hem 1

已安装版本 ( 14.11.5) 中的 Slurm 似乎在分配给 GPU 的类型方面存在问题,因为Type=...从 中删除gres.conf并相应地更改节点配置行Gres=gpu:N,ram:...会导致通过 成功执行需要 GPU 的作业--gres=gpu:N