限制nvidia-docker中的GPU使用率?

时间:2017-02-17 18:54:16

标签: docker jupyterhub nvidia-docker

我在多GPU服务器上设置内部Jupyterhub。 Jupyter访问是通过docker实例提供的。我想将每个用户的访问权限限制为不超过一个GPU。我很感激任何建议或评论。感谢。

3 个答案:

答案 0 :(得分:1)

您可以使用nvidia-docker-compose

进行尝试
version: "2"
services
  process1:
    image: nvidia/cuda
    devices:
      - /dev/nvidia0

答案 1 :(得分:1)

问题可以通过这种方式解决,只需在“nvidia-docker”之前添加环境变量“NV_GPU”,如下所示:

 [root@bogon ~]# NV_GPU='4,5' nvidia-docker run -dit --name tf_07 tensorflow/tensorflow:latest-gpu /bin/bash
e04645c2d7ea658089435d64e72603f69859a3e7b6af64af005fb852473d6b56
[root@bogon ~]# docker attach tf_07
root@e04645c2d7ea:/notebooks#
root@e04645c2d7ea:/notebooks# ll /dev
total 4
drwxr-xr-x  5 root root      460 Dec 29 03:52 ./
drwxr-xr-x 22 root root     4096 Dec 29 03:52 ../
crw--w----  1 root tty  136,   0 Dec 29 03:53 console
lrwxrwxrwx  1 root root       11 Dec 29 03:52 core -> /proc/kcore
lrwxrwxrwx  1 root root       13 Dec 29 03:52 fd -> /proc/self/fd/
crw-rw-rw-  1 root root   1,   7 Dec 29 03:52 full
drwxrwxrwt  2 root root       40 Dec 29 03:52 mqueue/
crw-rw-rw-  1 root root   1,   3 Dec 29 03:52 null
crw-rw-rw-  1 root root 245,   0 Dec 29 03:52 nvidia-uvm
crw-rw-rw-  1 root root 245,   1 Dec 29 03:52 nvidia-uvm-tools
crw-rw-rw-  1 root root 195,   4 Dec 29 03:52 nvidia4
crw-rw-rw-  1 root root 195,   5 Dec 29 03:52 nvidia5
crw-rw-rw-  1 root root 195, 255 Dec 29 03:52 nvidiactl
lrwxrwxrwx  1 root root        8 Dec 29 03:52 ptmx -> pts/ptmx
drwxr-xr-x  2 root root        0 Dec 29 03:52 pts/
crw-rw-rw-  1 root root   1,   8 Dec 29 03:52 random
drwxrwxrwt  2 root root       40 Dec 29 03:52 shm/
lrwxrwxrwx  1 root root       15 Dec 29 03:52 stderr -> /proc/self/fd/2
lrwxrwxrwx  1 root root       15 Dec 29 03:52 stdin -> /proc/self/fd/0
lrwxrwxrwx  1 root root       15 Dec 29 03:52 stdout -> /proc/self/fd/1
crw-rw-rw-  1 root root   5,   0 Dec 29 03:52 tty
crw-rw-rw-  1 root root   1,   9 Dec 29 03:52 urandom
crw-rw-rw-  1 root root   1,   5 Dec 29 03:52 zero
root@e04645c2d7ea:/notebooks#

或,阅读nvidia-docker of github's wiki

答案 2 :(得分:0)

共有3个选项。

具有NVIDIA RUNTIME(版本2.0.x)的Docker

根据official documentation

employee_id   employee_name   motor_id
--------------------------------------
1             jack            2
2             john            1

nvidia-docker(版本1.0.x)

基于popular post

select motor_types from tbl_motor

(它与tensorflow一起使用)

以编程方式

tbl_employee