“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 即可

解决方案

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

TORCH_CUDA_ARCH_LIST="7.5 8.0 8.9" python3 setup.py install --blas=openblas --force_cuda

你可能感兴趣的:(NVIDIA,GPU,pytorch,NVIDIA,thrust)