RTX3070
Ubuntu 20.4
Nvidia driver: 470
cuda: 11.1
cudnn: 8.0.5
pytorch: 1.9.1+cu111
sudo sh cuda_11.1.1_455.32.00_linux.run
如果已经安装driver,可以不要选driver
cuda toolkit自带driver,如果之前已经安装过了driver可以不用安装。(如何取消?光标位于Driver处按空格键取消选择该选项)
sudo gedit ~/.bashrc
export CUDA_HOME=/usr/local/cuda
export PATH=/usr/local/cuda/bin${PATH:+:${PATH}}
export LD_LIBRARY_PATH=/usr/local/cuda/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
source ~/.bashrc
验证
cd ~/NVIDIA_CUDA-11.1_Samples/1_Utilities/deviceQuery
sudo make
./deviceQuery
# or
nvcc -V
如果安装错了删除cuda
cd /usr/local/cuda-11.0/bin/
sudo ./cuda-uninstaller
sudo rm -rf /usr/local/cuda-11.0
tar -xzvf cudnn-11.1-linux-x64-v8.0.5.39.tgz
sudo cp cuda/include/cudnn.h /usr/local/cuda/include
sudo cp cuda/include/cudnn_version.h /usr/local/cuda/include #一定要加不然后面安装spconv会识别不出cudnn版本
sudo cp cuda/lib64/libcudnn* /usr/local/cuda/lib64
sudo chmod a+r /usr/local/cuda/include/cudnn.h /usr/local/cuda/lib64/libcudnn*
sudo dpkg -i libcudnn8_8.0.5.39-1+cuda11.1_amd64.deb
sudo dpkg -i libcudnn8-dev_8.0.5.39-1+cuda11.1_amd64.deb
sudo dpkg -i libcudnn8-samples_8.0.5.39-1+cuda11.1_amd64.deb
cp -r /usr/src/cudnn_samples_v8/ ~
cd ~/cudnn_samples_v8/mnistCUDNN/
make clean && make
./mnistCUDNN
make clean && make的结果
./mnistCUDNN指令结果如果是**Test passed!**则cudnn也安装成功!
# 查看cuda是否安装了正确版本
dpkg -l |grep cuda
如果安装错了删除cudnn
sudo rm -rf /usr/local/cuda/include/cudnn.h
sudo rm -rf /usr/local/cuda/lib64/libcudnn*
sudo rm -rf /usr/include/cudnn.h
sudo rm -rf /usr/lib/x86_64-linux-gnu/libcudnn*
参考教程
bash Anaconda3-2020.07-Linux-x86_64.sh
vim ~/.bashrc
export PATH=$PATH:【你的安装目录】
source ~/.bashrc
conda --version
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/
conda config --set show_channel_urls yes
conda create -n pytorch_gpu python=3.6
# 并且激活
source activate pytorch_gpu
conda install scikit-image scipy numba pillow matplotlib numpy
pip install fire tensorboardX protobuf opencv-python
pip3 install torch==1.9.1+cu111 torchvision==0.10.1+cu111 torchaudio==0.9.1 -f https://download.pytorch.org/whl/torch_stable.html
在线安装会很慢,可能会安装失败,如果失败就离线安装,下载
pip install torch-1.9.0+cu111-cp38-cp38-linux_x86_64.whl
pip install torchvision-0.10.0+cu111-cp38-cp38-linux_x86_64.whl
>>> import torch
>>> print(torch.__version__)
1.9.1
>>> print(torch.cuda.is_available())
True
# 说明pytorch安装完成
conda 指令参考
conda create -n myenv python=3 # 创建一个名为myenv的环境并指定python版本为3
conda remove -n myenv --all # 删除环境及下属所有包
activate myenv # 切换到myenv环境
deactivate myenv # 推出环境myenv
activate # 进入默认的base环境
conda env list # 列出所有环境
conda list # 列出当前环境的所有包
# 以pandas为例,安装,卸载,更新
conda search pandas # 查找可安装的包
conda install pandas # 安装包
conda remove pandas # 卸载包
conda update pandas # 更新包
#cuda,cudnn 在conda环境里
conda install cudatoolkit=11.1
conda install cudnn=8.1.0 -c https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
# 删除环境
conda remove -n your_env_name --all
$tar -zxvf xx.tar.gz
$./bootstrap
$make
$make install
sudo apt-get install libssl-dev
sudo make install
spconv github
git clone https://github.com/traveller59/spconv.git --recursive
sudo apt-get install libboost-all-dev
cd spconv
python setup.py bdist_wheel
cd ./dist
pip install spconv-1.2.1-cp38-cp38-linux_x86_64.whl
新版本cudnn的版本信息包含在cudnn_version.h中,而不是cudnn.h中
ERROR问题是识别不到版本,说明没有把版本头文件加入到本地的cuda/include中
sudo cp cuda/include/cudnn_version.h /usr/local/cuda/include
python
>>import spconv
git clone https://github.com/open-mmlab/OpenPCDet.git
cd OpenPCDet
pip install -r requirements.txt
python setup.py develop
前CUDA算力高于当前PyTorch版本支持的CUDA算力的问题
nvcc fatal : Unsupported gpu architecture ‘compute_86
但我用网上的方法(export TORCH_CUDA_ARCH_LIST=“8.0”),不能解决,export这行代码对我的机器没有任何影响
给出我的方法成功了
sudo TORCH_CUDA_ARCH_LIST="8.0" python setup.py develop
conda install vtk=8.2.0
pip install mayavi
去gihub上下在一个.pth与训练文件,然后按下面步骤跑一下demo
cd OpenPCDet/tools
python demo.py --cfg_file cfgs/kitti_models/pv_rcnn.yaml --ckpt pv_rcnn_8369.pth --data_path ${
POINT_CLOUD_DATA}
github 官方解释: This results from an incompatibility between the recently released Traits 6.3.0 and the most recent release of Mayavi. Either upgrade to Traits 6.3.1, or use Traits 6.2.0 for now.
改成6.2.0有效
pip uninstall traits
pip install traits=6.2.0