Pytorch运行官方maskrcnn-benchmark报错: no instance of function template "THCCeilDiv" matches

Pytorch运行官方maskrcnn-benchmark,

 

问题

和官网上的位置不同,我的报错在这个位置,SigmoidFocalLoss_cuda.cu,报错内容如下,

....

e:/AMaskRCNN/maskrcnn-benchmark/maskrcnn_benchmark/csrc/cuda/SigmoidFocalLoss_cuda.cu(120): error: no instance of function template "THCCeilDiv" matches the argument list
            argument types are: (long long, long)

e:/AMaskRCNN/maskrcnn-benchmark/maskrcnn_benchmark/csrc/cuda/SigmoidFocalLoss_cuda.cu(120): error: no instance of overloaded function "std::min" matches the argument list
            argument types are: (<error-type>, long)

e:/AMaskRCNN/maskrcnn-benchmark/maskrcnn_benchmark/csrc/cuda/SigmoidFocalLoss_cuda.cu(164): error: no instance of function template "THCCeilDiv" matches the argument list
            argument types are: (long long, long)

e:/AMaskRCNN/maskrcnn-benchmark/maskrcnn_benchmark/csrc/cuda/SigmoidFocalLoss_cuda.cu(164): 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/ADMINI~1/AppData/Local/Temp/tmpxft_00000788_00000000-10_SigmoidFocalLoss_cuda.cpp1.ii".

....

首先说一下官网的解决方案

https://github.com/facebookresearch/maskrcnn-benchmark/issues/254

https://github.com/danpe1327/remember_doc/blob/master/build%20maskrcnn-benchmark%20for%20win10%2Bvs2017.md

该解决方案主要是针对ROIAlign_cuda.cu和ROIPool_cuda.cu,目前我刚编译的版本这两个文件没有出现问题。

 

解决方案

修改了SigmoidFocalLoss_cuda.cu的3个地方:

/*  added function in the front part of the file*/
int  ceil_div(int a, int b){ 
    return  (a + b - 1) / b; 
}

  /* replace the line/row 120 in function : SigmoidFocalLoss_forward_cuda*/
  dim3  grid(std::min(ceil_div((int)losses_size, 512), 4096));  
  //dim3 grid(std::min(THCCeilDiv(losses_size, 512L), 4096L));

  /*replace the second line/row 164 in function: SigmoidFocalLoss_backward_cuda*/
  dim3 grid(std::min(ceil_div((int)d_logits_size, 512), 4096));
  //dim3 grid(std::min(THCCeilDiv(d_logits_size, 512L), 4096L));

然后把maskrcnn-benchmark下面那个build里面的东西删除干净(前面生成没能成功的文件在这里会造成干扰,删除掉!!!)

就可以正常安装了,

python setup.py install

如果想对其中的python源码进行调试,则需要用指令,

python setup.py build develop

当然,在已经install的前提下,你不需要重新编译,因为文件其实都是已经准备好了的,你只需要build develop一下,完成拷贝链接即可。

  • 6
    点赞
  • 10
    收藏
    觉得还不错? 一键收藏
  • 4
    评论
评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值