我在 Ubuntu 22.04 上尝试运行 PyTorch 脚本并得到
torch.cuda.OutOfMemoryError: CUDA out of memory. Tried to allocate 86.00 MiB (GPU 0; 3.81 GiB total capacity; 3.18 GiB already allocated; 80.81 MiB free; 3.18 GiB reserved in total by PyTorch)
prime-select query
得出以下结果:
on-demand
lspci | egrep 'VGA|3D'
得出以下结果:
00:02.0 VGA compatible controller: Intel Corporation Alder Lake-P Integrated Graphics Controller (rev 0c)
01:00.0 3D controller: NVIDIA Corporation GA107M [GeForce RTX 3050 Ti Mobile] (rev a1)
nvidia-smi
得出以下结果:
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 525.85.05 Driver Version: 525.85.05 CUDA Version: 12.0 |
|-------------------------------+----------------------+----------------------+
| GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. |
| | | MIG M. |
|===============================+======================+======================|
| 0 NVIDIA GeForce ... Off | 00000000:01:00.0 Off | N/A |
| N/A 37C P0 N/A / 35W | 7MiB / 4096MiB | 0% Default |
| | | N/A |
+-------------------------------+----------------------+----------------------+
+-----------------------------------------------------------------------------+
| Processes: |
| GPU GI CI PID Type Process name GPU Memory |
| ID ID Usage |
|=============================================================================|
| 0 N/A N/A 1464 G /usr/lib/xorg/Xorg 4MiB |
| 0 N/A N/A 1743 G ...ome-remote-desktop-daemon 1MiB |
+-----------------------------------------------------------------------------+
在我的 UbuntuAbout
设置中,“Graphichs”显示为:
NVIDIA Corporation GA107M [GeForce RTX 3050 Ti Mobile] / Mesa Intel® Graphics (ADL GT2)
我怎样才能阻止我的 gpu 被用于Xorg
和gnome-remote-desktop-daemon
?我只想将我的 gpu 与 PyTorch 一起使用。使用torch.cuda.memory_allocated
和torch.cuda.memory_reserved
函数显示我正在使用0.0GB
我的 gpu,尽管识别了 Nvidia gpu,所以我很困惑哈哈。
如果有人需要更多信息,请告诉我(:
谢谢!