Tensorflow 不分配完整的 GPU 内存

2024-05-15

Tensorflow 默认分配所有 GPU 内存,但我的新设置实际上只有 9588 MiB / 11264 MiB。我预计大约 11.000MiB 就像我的旧设置一样。

张量流信息在这里:

$ from tensorflow.python.client import device_lib
$ print(device_lib.list_local_devices())

[name: "/cpu:0"
device_type: "CPU"
memory_limit: 268435456
locality {
}
incarnation: 9709578925658430097
, name: "/gpu:0"
device_type: "GPU"
memory_limit: 9273834701
locality {
  bus_id: 1
}
incarnation: 16668416364446126258
physical_device_desc: "device: 0, name: GeForce GTX 1080 Ti, pci bus id: 0000:03:00.0"
, name: "/gpu:1"
device_type: "GPU"
memory_limit: 9273834701
locality {
  bus_id: 1
}
incarnation: 2094938711079475130
physical_device_desc: "device: 1, name: GeForce GTX 1080 Ti, pci bus id: 0000:04:00.0"
]

nvidia-smi.exe 说:

+-----------------------------------------------------------------------------+
| NVIDIA-SMI 385.41                 Driver Version: 385.41                    |
|-------------------------------+----------------------+----------------------+
| GPU  Name            TCC/WDDM | Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|===============================+======================+======================|
|   0  GeForce GTX 108... WDDM  | 00000000:03:00.0 Off |                  N/A |
| 23%   35C    P8    13W / 250W |   9284MiB / 11264MiB |      0%      Default |
+-------------------------------+----------------------+----------------------+
|   1  GeForce GTX 108... WDDM  | 00000000:04:00.0 Off |                  N/A |
| 23%   38C    P2    55W / 250W |   9146MiB / 11264MiB |      0%      Default |
+-------------------------------+----------------------+----------------------+

+-----------------------------------------------------------------------------+
| Processes:                                                       GPU Memory |
|  GPU       PID   Type   Process name                             Usage      |
|=============================================================================|
|    0      1280    C+G   ...mmersiveControlPanel\SystemSettings.exe N/A      |
|    0      1448      C   ...ers\Administrator\Anaconda3\pythonw.exe N/A      |
|    0      1560    C+G   Insufficient Permissions                   N/A      |
|    0      4120    C+G   ...6)\Google\Chrome\Application\chrome.exe N/A      |
|    0      4580    C+G   C:\Windows\explorer.exe                    N/A      |
|    0      5188    C+G   ...t_cw5n1h2txyewy\ShellExperienceHost.exe N/A      |
|    0      5324    C+G   ...dows.Cortana_cw5n1h2txyewy\SearchUI.exe N/A      |
|    1      1228    C+G   Insufficient Permissions                   N/A      |
|    1      1244    C+G   Insufficient Permissions                   N/A      |
|    1      1448      C   ...ers\Administrator\Anaconda3\pythonw.exe N/A      |
+-----------------------------------------------------------------------------+

我的环境是这样的:

操作系统:Windows10 库:python 3.6,keras 2.0.8,tensorflow-gpu 1.3.0,CUDA8.0 CUDNN6.0

有谁知道原因吗?


有必要使用TCC驱动程序来避免Windows保留一些VRAM。您可能正在使用 WDDM 驱动程序。

这是TCC的页面:https://docs.nvidia.com/gameworks/content/developertools/desktop/nsight/tesla_compute_cluster.htm https://docs.nvidia.com/gameworks/content/developertools/desktop/nsight/tesla_compute_cluster.htm

这是一个相关问题:如何在 Windows 10 上的单个进程中使用辅助 GPU 上 100% 的 VRAM? https://stackoverflow.com/questions/47855185/how-can-i-use-100-of-vram-on-a-secondary-gpu-from-a-single-process-on-windows-1

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

Tensorflow 不分配完整的 GPU 内存 的相关文章

随机推荐