Tensorflow:out of memory 错误解决方法


>>> print(tf.test.is_gpu_available())
2021-09-12 20:17:56.416492: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:937] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
2021-09-12 20:17:56.417553: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:937] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
2021-09-12 20:17:56.418404: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:937] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/kobe/miniconda3/envs/tf2/lib/python3.7/site-packages/tensorflow/python/util/deprecation.py", line 346, in new_func
    return func(*args, **kwargs)
  File "/home/kobe/miniconda3/envs/tf2/lib/python3.7/site-packages/tensorflow/python/framework/test_util.py", line 1665, in is_gpu_available
    for local_device in device_lib.list_local_devices():
  File "/home/kobe/miniconda3/envs/tf2/lib/python3.7/site-packages/tensorflow/python/client/device_lib.py", line 45, in list_local_devices
    _convert(s) for s in _pywrap_device_lib.list_devices(serialized_config)
RuntimeError: CUDA runtime implicit initialization on GPU:0 failed. Status: out of memory

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
错误内容
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
显卡内存展示

>>> print(tf.test.is_gpu_available())
2021-09-12 20:21:40.055666: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:937] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
2021-09-12 20:21:40.056565: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:937] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
2021-09-12 20:21:40.057325: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:937] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
2021-09-12 20:21:40.478674: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:937] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
2021-09-12 20:21:40.479155: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:937] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
2021-09-12 20:21:40.479567: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:937] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
2021-09-12 20:21:40.479930: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1510] Created device /device:GPU:0 with 2816 MB memory:  -> device: 0, name: NVIDIA GeForce GTX 960M, pci bus id: 0000:01:00.0, compute capability: 5.0
True

以上为展示成功

参考链接

https://blog.csdn.net/wc781708249/article/details/78029176

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值