检查失败:错误== cudaSuccess(2 vs. 0)内存不足 [英] Check failed: error == cudaSuccess (2 vs. 0) out of memory

查看:519
本文介绍了检查失败:错误== cudaSuccess(2 vs. 0)内存不足的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在gpu上使用pycaffe运行神经网络。

I am trying to run a neural network with pycaffe on gpu.

此功能在我第一次调用脚本时有效。
第二次运行相同的脚本时,CUDA在标题中引发错误。

This works when I call the script for the first time. When I run the same script for the second time, CUDA throws the error in the title.

批处理大小为1,此时图像大小为243x322 ,gpu的内存为8gb。

Batch size is 1, image size at this moment is 243x322, the gpu has 8gb RAM.

我想我缺少重置内存的命令了?

I guess I am missing a command that resets the memory?

谢谢

编辑:

也许我应该澄清一些事情:我正在Windows上运行caffe 。

Maybe I should clarify a few things: I am running caffe on windows.

当我使用python script.py调用脚本时,进程终止,gpu内存被释放,因此可以正常工作。

When i call the script with python script.py, the process terminates and the gpu memory gets freed, so this works.

使用我用于调试的ipython,GPU内存确实没有被释放(经过一遍之后,8 bg中的6个已在使用中,感谢nvidia-smi的建议!)

With ipython, which I use for debugging, the GPU memory indeed does not get freed (after one pass, 6 of the 8 bg are in use, thanks for the nvidia-smi suggestion!)

所以,我要寻找的是我可以在pyhton中调用的命令,大致如下:

So, what I am looking for is a command I can call from within pyhton, along the lines of:

运行网络

过程图像输出

免费的gpu内存

推荐答案

您的GPU内存没有被释放。当先前的过程停止但未终止时,会发生这种情况。请在此处查看我的答案。

Your GPU memory is not getting freed. This happens when the previous process is stopped but not terminated. See my answer here.

这篇关于检查失败:错误== cudaSuccess(2 vs. 0)内存不足的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆