<div dir="ltr">I also remember there being write-only permissions involved when working with cgroups and devices .. which bent my head slightly.. </div><br><div class="gmail_quote"><div dir="ltr">On Thu, 30 Aug 2018 at 17:02, John Hearns <<a href="mailto:hearnsj@googlemail.com">hearnsj@googlemail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>Chaofeng,  I agree with what Chris says. You should be using cgroups.</div><div><br></div><div>I did a lot of work with cgroups anf GPUs in PBSPro (yes I know... splitter!)</div><div>With cgroups you only get access to the devices which are allocated to that cgroup, and you get CUDA_VISIBLE_DEVICES set for you.</div><div><br></div><div>Remember also to look at the permissions on /dev/nvidia(0,1,2...)   - which are usually OK</div><div>and on /dev/nvidiactl</div><div><br></div><div><br></div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr">On Thu, 30 Aug 2018 at 15:52, Renfro, Michael <<a href="mailto:Renfro@tntech.edu">Renfro@tntech.edu</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Chris’ method will set CUDA_VISIBLE_DEVICES like you’re used to, and it will help keep you or your users from picking conflicting devices.<br>
<br>
My cgroup/GPU settings from slurm.conf:<br>
<br>
=====<br>
<br>
[renfro@login ~]$ egrep -i '(cgroup|gpu)' /etc/slurm/slurm.conf | grep -v '^#'<br>
ProctrackType=proctrack/cgroup<br>
TaskPlugin=task/affinity,task/cgroup<br>
NodeName=gpunode[001-004]  CoresPerSocket=14 RealMemory=126000 Sockets=2 ThreadsPerCore=1 Gres=gpu:2<br>
PartitionName=gpu Default=NO MinNodes=1 DefaultTime=1-00:00:00 MaxTime=30-00:00:00 AllowGroups=ALL PriorityJobFactor=1 PriorityTier=1 DisableRootJobs=NO RootOnly=NO Hidden=NO Shared=NO GraceTime=0 PreemptMode=OFF ReqResv=NO DefMemPerCPU=4000 AllowAccounts=ALL AllowQos=ALL LLN=NO ExclusiveUser=NO OverSubscribe=NO OverTimeLimit=0 State=UP Nodes=gpunode[001-004]<br>
PartitionName=gpu-debug Default=NO MinNodes=1 MaxTime=00:30:00 AllowGroups=ALL PriorityJobFactor=2 PriorityTier=1 DisableRootJobs=NO RootOnly=NO Hidden=NO Shared=NO GraceTime=0 PreemptMode=OFF ReqResv=NO DefMemPerCPU=4000 AllowAccounts=ALL AllowQos=ALL LLN=NO ExclusiveUser=NO OverSubscribe=NO OverTimeLimit=0 State=UP Nodes=gpunode[001-004]<br>
PartitionName=gpu-interactive Default=NO MinNodes=1 MaxNodes=2 MaxTime=02:00:00 AllowGroups=ALL PriorityJobFactor=3 PriorityTier=1 DisableRootJobs=NO RootOnly=NO Hidden=NO Shared=NO GraceTime=0 PreemptMode=OFF ReqResv=NO DefMemPerCPU=4000 AllowAccounts=ALL AllowQos=ALL LLN=NO ExclusiveUser=NO OverSubscribe=NO OverTimeLimit=0 State=UP Nodes=gpunode[001-004]<br>
GresTypes=gpu,mic<br>
<br>
=====<br>
<br>
Example (where srun is a function that runs “srun --pty $SHELL -I”), with no CUDA_VISIBLE_DEVICES on the submit host, but is correctly set on reserving GPUs:<br>
<br>
=====<br>
<br>
[renfro@login ~]$ echo $CUDA_VISIBLE_DEVICES<br>
<br>
[renfro@login ~]$ hpcshell --partition=gpu-interactive --gres=gpu:1<br>
[renfro@gpunode003 ~]$ echo $CUDA_VISIBLE_DEVICES<br>
0<br>
[renfro@login ~]$ hpcshell --partition=gpu-interactive --gres=gpu:2<br>
[renfro@gpunode004 ~]$ echo $CUDA_VISIBLE_DEVICES<br>
0,1<br>
<br>
=====<br>
<br>
> On Aug 30, 2018, at 4:18 AM, Chaofeng Zhang <<a href="mailto:zhangcf1@lenovo.com" target="_blank">zhangcf1@lenovo.com</a>> wrote:<br>
> <br>
> CUDA_VISBLE_DEVICES is used by many AI framework to determine which gpu to use, like tensorflow. So this environment is critical to us.<br>
> <br>
> -----Original Message-----<br>
> From: slurm-users <<a href="mailto:slurm-users-bounces@lists.schedmd.com" target="_blank">slurm-users-bounces@lists.schedmd.com</a>> On Behalf Of Chris Samuel<br>
> Sent: Thursday, August 30, 2018 4:42 PM<br>
> To: <a href="mailto:slurm-users@lists.schedmd.com" target="_blank">slurm-users@lists.schedmd.com</a><br>
> Subject: [External] Re: [slurm-users] serious bug about CUDA_VISBLE_DEVICES in the slurm 17.11.7<br>
> <br>
> On Thursday, 30 August 2018 6:38:08 PM AEST Chaofeng Zhang wrote:<br>
> <br>
>> The CUDA_VISBLE_DEVICES can't be set NoDevFiles in Slurm 17.11.7.  <br>
>> This is worked when we use Slurm 17.02.<br>
> <br>
> You probably should be using cgroups instead to constrain access to GPUs.  <br>
> Then it doesn't matter what you set CUDA_VISBLE_DEVICES to be as processes will only be able to access what they requested.<br>
> <br>
> Hope that helps!<br>
> Chris<br>
> --<br>
> Chris Samuel  :  <a href="http://www.csamuel.org/" rel="noreferrer" target="_blank">http://www.csamuel.org/</a>  :  Melbourne, VIC<br>
> <br>
> <br>
> <br>
> <br>
> <br>
<br>
</blockquote></div></blockquote></div>