一、问题描述:
在显存充足的情况下爆显存~
代码在另台电脑上能正常运行。
RuntimeError: CUDA out of memory.
Tried to allocate 8.14 GiB
(GPU 0; 10.76 GiB total capacity; 895.27 MiB already allocated; 8.14 GiB free;
1.73 GiB reserved in total by PyTorch)
If reserved memory is >> allocated memory try setting max_split_size_mb to avoid fragmentation.
See documentation for Memory Management and PYTORCH_CUDA_ALLOC_CONF
二、解决方法
检查代码发现有两句代码比较可疑:
cudnn.enabled = True #确保cudnn确实在寻找最优算法
cudnn.benchmark = True #对cudnn进行优化
表面上是进行优化的代码,但是注释掉代码就能正常运行啦~
三、原因分析
原因等有时间再看看,先占坑,或者有大佬知道的话请解答一下栓Q