硬件:
CPU:i7-9700
显卡:GTX 1050 Ti
1-安装ROS
2-安装显卡驱动
1-删除旧版显卡驱动
sudo apt-get remove --purge nvidia*
2-查看可供安装的驱动
sudo add-apt-repository ppa:graphics-drivers/ppa
sudo apt-get update
sudo apt-get upgrade
ubuntu-drivers devices #查看自己的显卡及可以安装的驱动版本
3-安装驱动,并重启
sudo apt install nvidia-driver-510
4-查看显卡驱动安装效果
nvidia-smi
3-查看cmake版本
cmake --version
4-安装eigen-3.3.7
1-查看当前版本
查看结果为3.3.4,需要升级到3.3.7
vim /usr/include/eigen3/Eigen/src/Core/util/Macros.h
2-下载/安装/编译
自己别的方式下载也可以,这里我随手敲的,可能命令有错误
wget http://bitbucket.org/eigen/eigen/get/3.3.7.tar.gz
tar -xzvf eigen-3.3.7.tar.gz
mkdir build && cd build && cmake .. && make && sudo make install
3-更改软链接
sudo rm -rf /usr/include/eigen3/
sudo rm -rf /usr/include/Eigen
sudo cp -r /usr/local/include/eigen3/Eigen /usr/include
sudo cp -r /usr/local/include/eigen3 /usr/include
sudo ln -s /usr/include/eigen3 /usr/local/include/eigen3
sudo ln -s /usr/include/Eigen/ /usr/local/include/Eigen
cd /usr/lib/cmake/eigen3/
sudo rm ./*
sudo cp /usr/local/share/eigen3/cmake/* ./
sudo updatedb
4-查看版本
vim /usr/include/eigen3/Eigen/src/Core/util/Macros.h
5-安装qt5.14.2
1-下载
https://download.qt.io/archive/qt/5.14/5.14.2/
2-安装
sudo chmod a+x ./qt-opensource-linux-x64-5.14.0.run
./qt-opensource-linux-x64-5.14.0.run
6-安装CUDA10.0
1-下载
https://developer.nvidia.com/cuda-10.0-download-archive?target_os=Linux
2-安装
sudo sh cuda_10.0.130_410.48_linux.run #第一个安装驱动是n,其他的为y
安装完毕:
3-添加环境变量
sudo gedit ~/.bashrc
export PATH=$PATH:/usr/local/cuda/bin
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda/lib64
export LIBRARY_PATH=$LIBRARY_PATH:/usr/local/cuda/lib64
4-版本查看
source ~/.bashrc
nvcc --version
cat /usr/local/cuda/version.txt
5-测试
cd /usr/local/cuda/samples/1_Utilities/deviceQuery
sudo make
./deviceQuery
界面出现PASS证明正常。
6-安装CUDNN7.6.5
1-下载
百度网盘 ,密码:c5p7
官方网址
2-拷贝安装
sudo cp cuda/include/cudnn.h /usr/local/cuda/include/
sudo cp cuda/lib64/libcudnn* /usr/local/cuda/lib64/
sudo chmod a+r /usr/local/cuda/include/cudnn.h
sudo chmod a+r /usr/local/cuda/lib64/libcudnn*
3-验证
cat /usr/local/cuda/include/cudnn.h | grep CUDNN_MAJOR -A 2
7-安装Qt5.14.2
1-下载:qt
2-安装
chmod a+x ./qt-opensource-linux-x64-5.14.0.run
./qt-opensource-linux-x64-5.14.0.run
注意:不安装android sources script
8-算力
NVIDIA GPU算力表:链接
9-编译
1-安装库
sudo apt update
sudo apt install -y python-catkin-pkg python-rosdep ros-$ROS_DISTRO-catkin
sudo apt install -y python3-pip python3-colcon-common-extensions python3-setuptools python3-vcstool
pip3 install -U setuptools
rosdep update
rosdep install -y --from-paths src --ignore-src --rosdistro $ROS_DISTRO
2-编译命令
GPU编译CUDA加速:
AUTOWARE_COMPILE_WITH_CUDA=1 colcon build --cmake-args -DCMAKE_BUILD_TYPE=Release
单独编译一个包:
AUTOWARE_COMPILE_WITH_CUDA=1 colcon build --cmake-args -DCMAKE_BUILD_TYPE=Release --packages-select adi_driver
10-参考链接:
链接1 链接2 链接3 链接4 链接5 链接6