Faster-rcnn.pytorch编译问题error: command'...\\CUDA\\v9.0\\bin\\nvcc.exe' failed with exit status 1
参考代码:https://github.com/potterhsu/easy-faster-rcnn.pytorch最近在实现Faster RCNN过程中,遇到了不少问题,最令人头疼的问题就是很多GitHub上的源码都在linux系统下编译的,windows系统上会报错,尤其是需要编译C++模块时。运行easy-faster-rcnn.pytorch-master/support/setup...
参考代码:https://github.com/potterhsu/easy-faster-rcnn.pytorch
最近在实现Faster RCNN过程中,遇到了不少问题,最令人头疼的问题就是很多GitHub上的源码都在linux系统下编译的,windows系统上会报错,尤其是需要编译C++模块时。
运行easy-faster-rcnn.pytorch-master/support/setup.py时,报错如下:
F:/study/easy-faster-rcnn.pytorch-master/support/src/cuda/ROIAlign_cuda.cu(280): error: no instance of function template "THCCeilDiv" matches the argument list
argument types are: (long long, long)
F:/study/easy-faster-rcnn.pytorch-master/support/src/cuda/ROIAlign_cuda.cu(280): error: no instance of overloaded function "std::min" matches the argument list
argument types are: (<error-type>, long)
F:/study/easy-faster-rcnn.pytorch-master/support/src/cuda/ROIAlign_cuda.cu(327): error: no instance of function template "THCCeilDiv" matches the argument list
argument types are: (int64_t, long)
F:/stud/easy-faster-rcnn.pytorch-master/support/src/cuda/ROIAlign_cuda.cu(327): error: no instance of overloaded function "std::min" matches the argument list
argument types are: (<error-type>, long)
4 errors detected in the compilation of "C:/Users/����֮/AppData/Local/Temp/tmpxft_000032d8_00000000-10_ROIAlign_cuda.cpp1.ii".
ROIAlign_cuda.cu
error: command 'C:\\Program Files\\NVIDIA GPU Computing Toolkit\\CUDA\\v9.0\\bin\\nvcc.exe' failed with exit status 1
出现这个错误的原因是,数据类型不对,无法编译通过。
解决方案如下:
打开easy-faster-rcnn.pytorch-master/support/src/cuda/ROIAlign_cuda.cu
// line14
/* added function */
int ceil_div_2(int a, int b){
return (a + b - 1) / b;
}
// line275
dim3 grid(std::min(ceil_div((int)output_size, 512), 4096));
// line 320
dim3 grid(std::min(ceil_div((int)grad.numel(), 512), 4096));
参考:https://github.com/facebookresearch/maskrcnn-benchmark/issues/254
具体代码改动在这里
还有另外一种简单的改动方法:
// line 275
dim3 grid(std::min(THCCeilDiv((long)output_size, 512L), 4096L));
// line 320
dim3 grid(std::min(THCCeilDiv((long)grad.numel(), 512L), 4096L));
参考:https://github.com/facebookresearch/maskrcnn-benchmark/pull/409
具体代码在这里
强制类型转换之后数据类型不会报错了。
又出现了新的错误
copying build\lib.win-amd64-3.6\support\_C.cp36-win_amd64.pyd -> support
error: could not create 'support\_C.cp36-win_amd64.pyd': No such file or directory
目前还没针对这个问题的方案,记录下,有了解决方案再来更新。
更多推荐
所有评论(0)