title: Limiting access to resources for Cuda and OpenCL
body: <p>We want to extend our batch system to support GPU computations.</p>
  
  <p>The problem is that from the batch system viewpoint, the GPU is a resource. We can easily count used resources, but we also need to limit the access to them.</p>
  
  <p>For GPUs that means that each job claims a GPU exclusively (when a GPU is requested).</p>
  
  <p>From what I have been told, sharing GPUs between jobs is a very bad idea (because the GPU part of jobs might be killed randomly).</p>
  
  <p>So, what I need is some way to limit access to GPUs for CUDA and OpenCL. The batch system has root privileges. I can limit access to devices in <code>/dev/</code> using <code>cgroups</code> but I figured, that this won't be enough in this case.</p>
  
  <p>Ideal state would be if the job would only see as many GPUs as it requested and these couldn't be accessed by any other job.</p>