【发布时间】:2019-12-11 03:49:41
【问题描述】:
在这种情况下,我在 VM 上使用 jupyter notebook 来训练一些 CNN 模型。 VM 有 16v CPU 和 60GB 内存。我刚刚安装了 NVIDIA TESLA P4 以获得更好的性能。但它总是给出像"RuntimeError: CUDA out of memory. Tried to allocate 196.00 MiB (GPU 0; 7.43 GiB total capacity; 2.20 GiB already allocated; 180.44 MiB free; 226.01 MiB cached)"这样的错误
为什么会这样?系统很干净。我想知道为什么我只有这么少的可用内存?
我认为GPU设置没有错误
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 440.33.01 Driver Version: 440.33.01 CUDA Version: 10.2 |
|-------------------------------+----------------------+----------------------+
| GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. |
|===============================+======================+======================|
| 0 Tesla P4 Off | 00000000:00:04.0 Off | 0 |
| N/A 38C P0 22W / 75W | 0MiB / 7611MiB | 2% Default |
+-------------------------------+----------------------+----------------------+
+-----------------------------------------------------------------------------+
| Processes: GPU Memory |
| GPU PID Type Process name Usage |
|=============================================================================|
| No running processes found |
+-----------------------------------------------------------------------------+
【问题讨论】:
-
为您的问题添加更多描述。您正在使用哪个库 - TensorFlow、Keras 或任何其他库。共享您指定 GPU 的代码段(如果您是)。对于 TensorFlow,您可以通过传递“per_process_gpu_memory_fraction”标志来限制 GPU 内存使用。
-
尝试减小批量大小?可能到 2 或 8,只是一个命中和试验,如果它是 GPU 问题或代码问题?
标签: python tensorflow jupyter-notebook gpu