亮哥提供的spconv 1.x初版,spconv 2.x版本后续更新
openpcdet依赖spconv,首先需要安装配置spconv:GitHub - traveller59/spconv: Spatial Sparse Convolution Library
创建anaconda虚拟环境
按照显卡驱动版本,安装conda与pytorch(建议完全通过conda安装),此处以pytorch 1.9,cuda版本11.1为例。
conda create -n openpcdet python=3.8
conda install pytorch torchvision torchaudio cudatoolkit=11.1 -c pytorch -c nvidia
这里注意测试一下pytorch是否工作正常,使用脚本tst.py
#检查配置的cuda版本是否一致,测试不报错即可
import torch
print(torch.version.cuda)
print(torch.cuda.is_available())
print(torch.backends.cudnn.version())
a = torch.tensor([0])
print(a.cuda().device)
安装spconv
首先创建一个依赖项配置脚本:spconv_config.sh
#!/bin/bash
# change these path,这些一般集群share文件夹都有
# 注意spconv要求的cmake版本好像是>3.21
CUDA_ROOT=/"个人路径"/cuda-11.1
GCC=/"个人路径"/gcc/gcc-5.4
BOOST=/"个人路径"/boost_1_65_1
CMAKE=/"个人路径"/cmake3.8/bin/
export CUDA_HOME=${CUDA_ROOT}
export CC=${GCC}/bin/gcc
export CXX=${GCC}/bin/g++
export PATH=${GCC}/bin:${CUDA_ROOT}/bin:${CMAKE}:${PATH}
export CPLUS_INCLUDE_PATH=${BOOST}/include:${CPLUS_INCLUDE_PATH}
export LD_LIBRARY_PATH=${BOOST}/lib:${CUDA_ROOT}/lib64:${LD_LIBRARY_PATH}
git clone 官方spconv代码
git clone --recursive https://github.com/traveller59/spconv
# 配置环境
source spconv_config.sh
python setup.py bdist_wheel
cd dist
pip install xxx.whl
没有报错的话,开始安装openpcdet
cd OpenPCDet
python setup.py develop
至此OpenPCDet配置结束!
可能出现的错误
File "/user/x/libs/anaconda3/envs/test1/lib/python3.8/site-packages/torch/utils/cpp_extension.py", line 1561, in _get_cuda_arch_flags
arch_list[-1] += '+PTX'
IndexError: list index out of range
可在编译openpcdet之前,设置环境变量
export TORCH_CUDA_ARCH_LIST="5.2 6.0 6.1 7.0 7.5 8.0 8.6+PTX"
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)