nvidia显卡的Exclusive Process模式

利用nvidia显卡GPU进行神经网络训练的时候,可以使用Exclusive  Process模式来提高效率。表示只能运行一个计算进程独占GPU。

使用nvidia-smi命令设置GPU的Compute Mode为Exclusive  Process(老版本的cuda还有Exclusive  Thead,已经废掉了)

sudo nvidia-smi -c 3

怎么看现在GPU有没有计算进程,需要用nvidia-smi命令,在processes列表中看到type为C的进程就是计算进程。当有一个计算进程那么就不会让其他进程使用了。

+-----------------------------------------------------------------------------+
| NVIDIA-SMI 418.56       Driver Version: 418.56       CUDA Version: 10.1     |
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|===============================+======================+======================|
|   0  GeForce GTX 950     Off  | 00000000:01:00.0  On |                  N/A |
| 39%   45C    P0    27W / 100W |    304MiB /  1995MiB |      0%   E. Process |
+-------------------------------+----------------------+----------------------+
|   1  GeForce GTX 950     Off  | 00000000:02:00.0 Off |                  N/A |
| 51%   60C    P0    89W / 100W |   1062MiB /  2002MiB |     98%   E. Process |
+-------------------------------+----------------------+----------------------+
                                                                               
+-----------------------------------------------------------------------------+
| Processes:                                                       GPU Memory |
|  GPU       PID   Type   Process name                             Usage      |
|=============================================================================|
|    0      1646      G   /usr/lib/xorg/Xorg                            65MiB |
|    0      2647      G   /usr/bin/gnome-shell                         140MiB |
|    0      4152      G   /usr/lib/firefox/firefox                       1MiB |
|    0      8865      G   /usr/lib/firefox/firefox                       1MiB |
|    0     13823      G   /usr/lib/xorg/Xorg                            47MiB |
|    0     21056      C   /usr/lib/libreoffice/program/soffice.bin      32MiB |
|    1     24945      C   nnet3-train                                 1050MiB |
+-----------------------------------------------------------------------------+

 

你可能感兴趣的:(nvidia显卡的Exclusive Process模式)