error: ROIAlign_cuda.cu(275): error: no instance of function template “THCCeilDiv“ matches

解决ROIAlign_cuda.cu和ROIPool_cuda.cu编译错误(遇到的两个问题)

报错1:

D:/python/frankmocap-master/frankmocap-master/detectors/hand_object_detector/lib/model/csrc/cuda/ROIAlign_cuda.cu(275): error: no instance of function template "THCCeilDiv" matches the argument list
            argument types are: (long long, long)

D:/python/frankmocap-master/frankmocap-master/detectors/hand_object_detector/lib/model/csrc/cuda/ROIAlign_cuda.cu(275): error: no instance of overloaded function "std::min" matches the argument list
            argument types are: (<error-type>, long)

D:/python/frankmocap-master/frankmocap-master/detectors/hand_object_detector/lib/model/csrc/cuda/ROIAlign_cuda.cu(320): error: no instance of function template "THCCeilDiv" matches the argument list
            argument types are: (int64_t, long)

D:/python/frankmocap-master/frankmocap-master/detectors/hand_object_detector/lib/model/csrc/cuda/ROIAlign_cuda.cu(320): 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/18295/AppData/Local/Temp/tmpxft_00003514_00000000-10_ROIAlign_cuda.cpp1.ii"

解决方法:

修改maskscoring_rcnn/maskrcnn_benchmark/csrc/cuda/ROIAlign_cuda.cu第275行:

//原代码: dim3 grid(std::min(THCCeilDiv(output_size, 512L), 4096L));
dim3 grid(std::min(((int)output_size + 512 -1) / 512, 4096));

修改maskscoring_rcnn/maskrcnn_benchmark/csrc/cuda/ROIAlign_cuda.cu第320行:

//原代码: dim3 grid(std::min(THCCeilDiv(grad.numel(), 512L), 4096L));
dim3 grid(std::min(((int)(grad.numel()) + 512 -1) / 512, 4096));

修改maskscoring_rcnn/maskrcnn_benchmark/csrc/cuda/ROIPool_cuda.cu第129行:

// dim3 grid(std::min(THCCeilDiv(output_size, 512L), 4096L));
dim3 grid(std::min(((int)output_size + 512 -1) / 512, 4096));

修改maskscoring_rcnn/maskrcnn_benchmark/csrc/cuda/ROIPool_cuda.cu第176行:

//dim3 grid(std::min(THCCeilDiv(grad.numel(), 512L), 4096L));
dim3 grid(std::min(((int)(grad.numel()) + 512 -1) / 512, 4096));

修改完毕后再执行python setup.py build develop即可

报错2:

error: ROIAlign_cuda.cu和ROIPool_cuda.cu文件中"__floorf"和"__ceilf"错误

error: calling a __host__ function("__floorf") from a __device__ 
function("get_coordinate_weight<float> ") is not allowed
error: identifier "__floorf" is undefined in device code

error: calling a __host__ function("__ceilf") from a __global__ 
function("detectron2::RoIAlignRotatedForward<float> ") is not allowed
error: identifier "__ceilf" is undefined in device code

解决方法:

找到ROIAlign_cuda.cu和ROIPool_cuda.cu文件,把里面的ceilfloor后面都加上f,即ceil改为ceilffloor改为floorf
执行成功如下:
在这里插入图片描述

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

L-Dreams

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值