当前位置:网站首页>RuntimeError: CUDA out of memory. Tried to allocate 32.00 MiB||查看GPU内存
RuntimeError: CUDA out of memory. Tried to allocate 32.00 MiB||查看GPU内存
2022-07-20 23:16:00 【Claire_Shang】
RuntimeError: CUDA out of memory. Tried to allocate 32.00 MiB (GPU 0; 6.00 GiB total capacity; 4.40 GiB already allocated; 0 bytes free; 4.43 GiB reserved in total by PyTorch)
Traceback (most recent call last):
File "D:/Papers to read/2022.07/DeamNet-main/DeamNet-main/train.py", line 170, in <module>
train(epoch)
File "D:/Papers to read/2022.07/DeamNet-main/DeamNet-main/train.py", line 73, in train
prediction = model(input)
................
File "D:\ProgramData\Anaconda3\envs\python36\lib\site-packages\torch\nn\functional.py", line 1136, in relu
result = torch.relu(input)
RuntimeError: CUDA out of memory. Tried to allocate 32.00 MiB (GPU 0; 6.00 GiB total capacity; 4.40 GiB already allocated; 0 bytes free; 4.43 GiB reserved in total by PyTorch)
Process finished with exit code 1
查到的方法
1. 查看电脑GPU内存 在cmd下输入:
nvidia-smi.exe -h
然后再输入
nvidia-smi.exe -i 0
可以看到电脑的运行内存,
关于搜到的调用GPU的方法,源代码里有,所以不是这个问题
os.environ["CUDA_DEVICE_ORDER"] = "PCI_BUS_ID"
os.environ["CUDA_VISIBLE_DEVICES"] = "0,1"
device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu") #修改:增加此行. 判断CUDA是否能使用,不可以就使用CPU
2. 另一个方法是修改batchsize
batchsize原来是8,改为1,可以运行了
parser.add_argument('--batchSize', type=int, default=1, help='training batch size')
边栏推荐
猜你喜欢
Power Bi ---- slicer to make the report more beautiful
Huawei wireless device configuration WMM and priority mapping
235. 二叉搜索树的最近公共祖先-dfs法
Ultra simple three tube inductive brushless three-phase motor drive board
JS -- loop -- guess numbers (generate random numbers with decimal math.random)
我用Redis分布式锁,抢了瓶茅台,然后GG了~~
封装全局input组件,并通过v-model绑定父子数据
Weekly recommended short videos: does the development of the Internet of things pose a greater challenge?
How to apply @transactional transaction annotation to perfection?
[interview: concurrent Article 19: multithreading: Park & unpark]
随机推荐
Find in 2D array
如何将服务器上的文件_按自定义的层级关系_进行压缩并下载
[基础架构] [Flink] Flink/Flink-CDC代码实现业务接入
mysql 常用操作和基础查询
Huawei wireless devices are configured with ACL based message filtering
如何分析并设计性能测试场景
Work experience summary 1
【无标题】今年值得关注的神书,豆瓣评分高达9.0分,京东当当有售
Solve the problem that @valid list parameters cannot be verified
卷积神经网络单图超分辨率的深度学习方法
JS-添加方式(行内 内嵌 外部)
Ultra simple three tube inductive brushless three-phase motor drive board
华为无线设备漫游配置同一业务VLAN的AP间非快速漫游
静态通讯录的实现
工作经验总结1
最新微服务组件选型
JS -- basic grammar
Power Bi ---- slicer to make the report more beautiful
Analysis of tars source code 25
进程的创建(创建原语,引起其发生的事件)