“thrust“ has no member “device“

背景

安装nvidia的MinkowskiEngine库时,报错:“thrust” has no member “device”(其实还有其他错误,这些错误的本质原因是一样的)

# 安装代码
mkdir -p /workspace
cd /workspace
git clone https://github.com/NVIDIA/MinkowskiEngine.git
cd /workspace/MinkowskiEngine
TORCH_CUDA_ARCH_LIST="7.5 8.0 8.9" python3 setup.py install --blas=openblas --force_cuda

原因分析

  1. 笔者的环境是CUDA12.1
  2. 错误的原因很简单,cuda版本太新,thrust库的使用发生了变化
  3. 解决方法很简单:在对应文件中加入需要的头文件,比如src/3rdparty/concurrent_unordered_map.cuh中报标题中的错误,则只需要添加:include <thrust/execution_policy.h>即可

解决方案

mkdir -p /workspace
cd /workspace
git clone https://github.com/NVIDIA/MinkowskiEngine.git
cd /workspace/MinkowskiEngine
# <thrust/execution_policy.h>头文件是解决编译报错问题:error: namespace "thrust" has no member "device"
# <thrust/unique.h>、<thrust/sort.h>是解决类似的问题
sed -i '31i #include <thrust/execution_policy.h>' ./src/convolution_kernel.cuh
sed -i '39i #include <thrust/unique.h>\n#include <thrust/remove.h>' ./src/coordinate_map_gpu.cu
sed -i '38i #include <thrust/execution_policy.h>\n#include <thrust/reduce.h>\n#include <thrust/sort.h>' ./src/spmm.cu
sed -i '38i #include <thrust/execution_policy.h>' ./src/3rdparty/concurrent_unordered_map.cuh

TORCH_CUDA_ARCH_LIST="7.5 8.0 8.9" python3 setup.py install --blas=openblas --force_cuda
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值