-
pytorch与cuda版本兼容性问题
- 这个问题主要在复现MAttNets[2]这篇论文时发现
- 非常致命
-
环境
- cuda = 9.2
- pytorch = 0.4.1
- cudnn = 7.1.4
-
问题1描述
- Found GPU0 TITAN V which requires CUDA_VERSION >= 9000 for optimal performance and fast startup time, but your PyTorch was compiled with CUDA_VERSION 8000. Please install the correct PyTorch binary using instructions from http://pytorch.org warnings.warn(incorrect_binary_warn % (d, name, 9000, CUDA_VERSION))
- CUDA版本高于pytorch
- 单纯的警告,程序并不会终止
-
问题2描述
- RuntimeError:CuDNN error:CUDNN_STATUS_SUCCESS
- 这个问题是一个运行时错误
- 程序会终止
-
解决
- 问题1
- 因为考虑到是一个警告,而一般来说程序运行时的警告都是无关紧要的。但这个警告非常致命
- 至少自己在复现MAttNets时碰到的问题有
- 模型载入GPU非常缓慢,2M2M的增长
- 即使只创建一个tensor.cuda变量都异常缓慢(这也是自己发现这个问题的起源)
- 各种随机错误,如莫名out of memory、empty result…直接人没了~
- 随后更换pytorch版本,这里又需要注意
- 在conda环境下,先使用
conda list
查看- [外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-9xt1zgJH-1608606871002)(C:\Users\LQY\AppData\Roaming\Typora\typora-user-images\image-20201222110959488.png)]
- 重点看build选项
- [外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-LYUONgs6-1608606871004)(C:\Users\LQY\AppData\Roaming\Typora\typora-user-images\image-20201222111045989.png)]
- 上面是问题1、2都解决的版本,可以看到,此时的pytorch是适应
- python2.7
- cuda9.2
- cudnn7.1
- 在conda环境下,先使用
- 此时问题1会得到解决
- 问题2一样
- 问题1
-
玄学时间
- 有时候pytorch会闹脾气,只适配某一种cuda版本
- 如果出现这种情况,不要犹豫,用cuda9.2版本下的pytorch
- 233333
-
TensorFlow用得少,以后更新~
-[1]. Win10+Anaconda+CUDA11.0+cuDNN8.0.1+RTX2060深度学习_pytorch环境配置. https://blog.csdn.net/lp1003/article/details/107240520
-[2]. MAttNet: Modular Attention Network for Referring Expression Comprehension in CVPR 2018