赞
踩
sr failed: CUDA out of memory. Tried to allocate 370.00 MiB. GPU 0 has a total capacty of 12.00 GiB of which 8.66 GiB is free. Of the allocated memory 969.24 MiB is allocated by PyTorch, and 306.76 MiB is reserved by PyTorch but unallocated. If reserved but unallocated memory is large try setting max_split_size_mb to avoid fragmentation. See documentation for Memory Management and PYTORCH_CUDA_ALLOC_CONF
0 Solvay_conference_1927
如下图:
这个报错信息表明你的CUDA程序在执行时遇到了内存不足的问题。以下是报错信息的解释:
sr failed: CUDA out of memory.
:CUDA是用于进行GPU加速的计算框架,这里报告了CUDA内存不足的错误。
Tried to allocate 370.00 MiB.
:尝试分配了370.00兆字节(MiB)的内存。
GPU 0 has a total capacity of 12.00 GiB of which 8.66 GiB is free.
:GPU 0的总内存容量为12.00吉字节(GiB),其中有8.66 GiB是空闲的。
Of the allocated memory 969.24 MiB is allocated by PyTorch, and 306.76 MiB is reserved by PyTorch but unallocated.
:已经分配的内存中,969.24 MiB被PyTorch使用,而另外的306.76 MiB被PyTorch保留但尚未分配。
If reserved but unallocated memory is large try setting max_split_size_mb to avoid fragmentation.
:如果保留但未分配的内存很大,可以尝试设置max_split_size_mb
以避免碎片化。这是一个建议,你可以尝试调整一些相关的参数来优化内存分配。
See documentation for Memory Management and PYTORCH_CUDA_ALLOC_CONF
:查看内存管理和PYTORCH_CUDA_ALLOC_CONF的文档,以获取更多关于内存管理和配置的信息。
提示的是与gpu内存有关,根据本机环境查看本机gpu内存,如下图:
当前的 gpu总内存总12G,只有了3.7G,还有8G左右,与上面的错误描述对得上,部分gpu内存被占用,先清找出占用gpu内存进程优化掉先。
找出占用gpu的app,如下图:
优化掉占用gpu的app后,gpu内存占用情况如下图:
再次运行项目,这时不会出现报“sr failed: CUDA out of memory”显存不够错误 ,成功解决该问题。
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。