win10编译DCNv2

环境:win10x64 , vs2019 , pytorch1.7(虚拟环境),python3.7 ,cuda10.1 update2

背景:运行centernet demo中的DLA和DCN预训练模型效果,但是DCN需要先编译才能使用

编译过程:

1、下载DCNv2的github源码:https://github.com/lbin/DCNv2/tree/pytorch_1.7

放在centernet的库目录下:

 这有好几个文件夹:DCNv2是centerNet自带的,算是比较老的版本,只支持pytorch0.41之前的版本,DCNv21-DCNv23分别代表了支持pytorch1.5-pytorch1.7的DCNv2,尝试了pytorch1.5版本,提示编译错误(c10之类的error),应该是编译器vs2019太新导致的,又按照网上提示,用vs2015本地命令行工具,还是提示cl相关错误,网上查到的原因说是:pytorch1.5以后的版本至少需要vs2017编译。因此又换回了vs2019。又尝试pytorch1.6和pytorch1.7版本的编译,都提示错误:

C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.29.30037/include\yvals_core.h(531): fatal error C1189: #error:
STL1002: Unexpected compiler version, expected CUDA 10.1 Update 2 or newer.
error: command 'C:\\Program Files\\NVIDIA GPU Computing Toolkit\\CUDA\\v10.1\\bin\\nvcc.exe' failed with exit status 2

提示需要cuda10.1 update2或更新版本,所以重新下载安装cuda10.1 update 2,编译通过。

猜你喜欢

转载自blog.csdn.net/sinat_33486980/article/details/118595986