解决50系显卡编译droid backend的一些注意事项

setup.py后面必须加上


setup(
    name='droid_backends',
    ext_modules=[
        CUDAExtension('droid_backends',
            include_dirs=[osp.join(ROOT, 'thirdparty/eigen')],
            sources=[
                'src/droid.cpp', 
                'src/droid_kernels.cu',
                'src/correlation_kernels.cu',
                'src/altcorr_kernel.cu',
            ],
            extra_compile_args={
                'cxx': ['-O3'],
                'nvcc': ['-O3',
                    '-gencode=arch=compute_60,code=sm_60',
                    '-gencode=arch=compute_61,code=sm_61',
                    '-gencode=arch=compute_70,code=sm_70',
                    '-gencode=arch=compute_75,code=sm_75',
                    '-gencode=arch=compute_80,code=sm_80',
                    '-gencode=arch=compute_86,code=sm_86',
        "-gencode=arch=compute_90,code=sm_90",  # RTX 50 系列(添加此行支持 RTX 5090)
        "-gencode=arch=compute_90,code=compute_90",  # 确保向前兼容
    "-gencode=arch=compute_120,code=sm_120",  # 添加 RTX 5090 的 sm_120 支持
    "-gencode=arch=compute_120,code=compute_120",                  
                ]
            }),
    ],
    cmdclass={ 'build_ext' : BuildExtension }
)

表示对50系显卡的支持。

如果返回at::DeprecatedTypeProperties
源代码:

constexpr const char* at_dispatch_name = "sampler_forward_kernel";
at::ScalarType _st = ::detail::scalar_type(the_type);  // 转换失败

后面要改得:

// 删除const auto& the_type = volume.type(); 这一行
constexpr const char* at_dispatch_name = "sampler_forward_kernel";
at::ScalarType _st = volume.scalar_type();  // 直接获取c10::ScalarType,无需转换

类似这种都这么改就行了
运行的时候发现了这个错误,搞了两天才高定:
File “/home/xxx/HI-SLAM2/hislam2/modules/corr.py”, line 47, in call
corr = CorrSampler.apply(self.corr_pyramid[i], coords/2**i, self.radius)
~~^
torch.AcceleratorError: CUDA error: no kernel image is available for execution on the device
Compile with TORCH_USE_CUDA_DSA to enable device-side assertions.

我通过

 import droind_backends
 print(droid_backends.__file__)

找到了这个文件的相应的位置,然后运行ls -l /home/xxx/anaconda3/envs/hislam2/lib/python3.11/site-packages/droid_backends-0.0.0-py3.11-linux-x86_64.egg/droid_backends.cpython-311-x86_64-linux-gnu.so
发现这个东西是好几天之前的,而不是自己刚刚编译的。我把他删除之后重新编译一遍,就好了。

评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值