NVIDIA相关软件
nvidia 440.100 + cuda 10.2 + cudnn 8.0
适合于: GTX 2080, GTX1650Ti等显卡
文件列表如下:
NVIDIA-Linux-x86_64-440.100.run
cuda-repo-ubuntu1604-10-2-local-10.2.89-440.33.01_1.0-1_amd64.deb
cudnn-10.2-linux-x64-v8.0.2.39.tgz
TensorRT-7.1.3.4.Ubuntu-16.04.x86_64-gnu.cuda-10.2.cudnn8.0.tar.gz
1.1 软件安装:
1:进入
Ctrl +Alt+F1 进入命令行模式
或者 sudo lightdm service stop
2: 添加
编辑文件 blacklist.conf
sudo vim /etc/modprobe.d/blacklist.conf 在文件最后部分插入以下内容
blacklist nouveau
options nouveau modeset=0
3:跟新
sudo update-initramfs -u
4:查看是否禁用, 无输出,则正常
lsmod | grep nouveau
5:安装
sudo ./NVIDIA-Linux-x86_64-418.56.run -no-x-check -no-opengl-files
-no-x-check:安装驱动时关闭 X 服务
-no-opengl-files:只安装驱动文件,不安装 OpenGL 文件
6:查看,安装
nvidia-smi 查看
Method 2:
sudo add-apt-repository
ppa:graphics-drivers #添加源
sudo apt-get update
sudo apt-cache search nvidia #查找安装包
//会输出 info
sudo ubuntu-drivers devices sudo apt-get install nvidia-390
nvidia-settings nvidia-prime #安装驱动
2.1 软件安装:
sudo dpkg -i cuda-repo-ubuntu1604-10-2-local-10.2.89-440.33.01_1.0-1_amd64.deb
//上一步会输出 接下来的命令,如:
sudo apt-key add /var/*
sudo dpkg -i cuda-repo-ubuntu1604-10-2-local-10.2.89-440.33.01_1.0-1_amd64.deb
//然后进行安装
sudo apt-get update
sudo apt-get install cuda
如果之前安装过,卸载不干净,
CUDA完全卸载的方法:
sudo apt-get --purge remove “cublas” “cuda*”
sudo apt-get --purge remove “nvidia”
sudo apt-get purge nvidia*
sudo apt-get autoremove
sudo apt-get autoclean
sudo rm -rf /usr/local/cuda*
2.2 环境安装:
添加CUDA路径,运行gedit ~/.bashrc
export LD_LIBRARY_PATH=/usr/local/cuda/lib64:$LD_LIBRARY_PATH
export CUDA_HOME=/usr/local/cuda-10.2
export LD_LIBRARY_PATH=/usr/local/cuda-10.2/lib64:$LD_LIBRARY_PATH
export PATH=/usr/local/cuda-10.2/bin:$PATH
接下来运行source ~/.bashrc使设置生效。
2.3 检查CUDA版本
cd /usr/local/cuda-10.2/samples/1_Utilities/deviceQuery
make
sudo ./deviceQuery
若输出最后一行为Result=PASS,则验证成功。
查看环境对不对
echo $LD_LIBRARY_PATH
下载的是cudnn-*tgz的压缩包时,按下方指令进行安装:
首先解压缩下的cudnn压缩包文件
执行安装,其实就是拷贝头文件和库文件并给予权限
3.1 解压及copy
tar -xzvf cudnn-10.2-linux-x64-v8.0.2.39.tgz
# copy cudnn头文件
sudo cp cuda/include/* /usr/local/cuda/include/
# copy cudnn的库
sudo cp cuda/lib64/* /usr/local/cuda/lib64/
# add 可执行权限
sudo chmod +x /usr/local/cuda/include/cudnn.h
sudo chmod +x /usr/local/cuda/lib64/libcudnn*
3.2 验证安装是否成功
//旧版本
cat /usr/local/cuda/include/cudnn.h | grep CUDNN_MAJOR -A 2
// 新版本
cat /usr/local/cuda/include/cudnn_version.h | grep CUDNN_MAJOR -A 2
如果显示
#define CUDNN_MAJOR 7
#define CUDNN_MINOR 6
#define CUDNN_PATCHLEVEL 2
--
#define CUDNN_VERSION (CUDNN_MAJOR * 1000 + CUDNN_MINOR * 100 + CUDNN_PATCHLEVEL)
则cudnn安装成功
tar zvxf ******.tar.gz cd protobuf-****** ./configure –prefix=/usr/local/ sudo make #编译时间很长 sudo make check sudo make install
1、下载python。网址https://www.python.org/
tar xfz Python-3.6.1.tgzcd Python-3.6.1/
./configure --prefix=/usr/bin/python3.6
sudo make
sudo make install
需要删除原有的Python链接文件:
sduo rm -rf /usr/bin/python9、建立指向Python3.6的链接:
susdo ln -s /usr/bin/python3.6/bin/python3.6
/usr/bin/pythonOK
https://tensorflow.google.cn/install/source#linux
目前tensorflow2.2官方标配cuda10.1,
官方在github给出方案,修改cuda软链接即可,非常简单。不影响pytorch1.5(cuda10.2)的继续使用。
重点是这二步:
完成软链接
cd /usr/local/cuda-10.2/targets/x86_64-linux/lib/
ln -s libcudart.so.10.2.89 libcudart.so.10.1
cd /usr/local/cuda-10.2/extras/CUPTI/lib64
ln -s libcupti.so.10.2.75 libcupti.so.10.1
# 检查添加路径:
vim /etc/profile
export CUDA_HOME=/usr/local/cuda-10.2
export LD_LIBRARY_PATH=${
CUDA_HOME}/lib64:${
CUDA_HOME}/extras/CUPTI/lib64
export PATH=${
CUDA_HOME}/bin:${
PATH}
source /etc/profile
# 检查GPU:
>python
>>>import tensorflow as tf
>>>tf.__version__
2.2.0
>>>tf.test.is_gpu_available()
True
>>>tf.config.list_physical_devices('GPU')
[PhysicalDevice(name='/physical_device:GPU:0', device_type='GPU'),
PhysicalDevice(name='/physical_device:GPU:1', device_type='GPU'),
PhysicalDevice(name='/physical_device:GPU:2', device_type='GPU'),
PhysicalDevice(name='/physical_device:GPU:3', device_type='GPU')]
conda install pytorch1.5.0 torchvision0.6.0 cudatoolkit=10.2 -c
pytorch
测试pytorch和cuda加速是否安装成功:
python3
import torch
torch.cuda.is_available()
#返回True代表cuda加速成功
下载链接:https://developer.nvidia.com/tensorrt
tar -xvzf TensorRT-7.1.3.4.Ubuntu-16.04.x86_64-gnu.cuda-10.2.cudnn8.0.tar.gz
cd data
python3 ./download_pgms.py
cd sample
pip install pillow
../bin/sample_mnist
export LD_LIBRARY_PATH=/home/cs/TensorRT-7.1.3.4/lib:$LD_LIBRARY_PATH
cd /TensorRT-7.1.3.4/python
python3.6 -m pip install tensorrt-7.1.3.4-cp36-none-linux_x86_64.whl
将TensorRT中的链接文件.so文件复制到/usr/lib/文件夹中,比如
1) ImportError: libnvinfer.so.6: cannot open shared object file:
Nosuch file or directory2)ImportError: libnvonnxparser.so.6: cannot open shared object file:No
such file or directory解决办法:
1) sudo cp TensorRT-6.01/targets/x86_64-linux-gnu/lib/libnvinfer.so.6
/usr/lib/2)sudo cp
TensorRT-6.01/targets/x86_64-linux-gnu/lib/libnvonnxparser.so.6
/usr/lib/
出现pycuda问题
ModuleNotFoundError: No module named ‘pycuda’sudo pip3.6 install pycuda== 2019.1.2 -i
https://pypi.tuna.tsinghua.edu.cn/simple
// 不用sudo
pip3.6 install pycuda -i https://pypi.tuna.tsinghua.edu.cn/simple
出现 is not a symbolic link
sbin/ldconfig.real: /usr/local/cuda-11.1/targets/x86_64-linux/lib/libcudnn_ops_
infer.so.8 is not a symbolic link
sudo ln -sf libcudnn.so.8.0.2 libcudnn.so.8
解决办法:
sudo ln -sf /usr/local/cuda-11.1/targets/x86_64-linux/lib/libcudnn.so.8.0.4 /usr/local/cuda-11.1/targets/x86_64-linux/lib/libcudnn.so.8
解决办法:
sudo ln -sf /usr/local/cuda-11.1/targets/x86_64-linux/lib/libcudnn.so.8.0.4 /usr/local/cuda-11.1/targets/x86_64-linux/lib/libcudnn.so.8
python3.6 -m venv .
source bin/activate
pip3.6 install opencv-python -i
https://pypi.tuna.tsinghua.edu.cn/simple 错误 ModuleNotFoundError: No
module named ‘skbuild’1,安装cmake sudo apt install cmake
2,pip3 install scikit-build
三、OpenCV安装
OpenCV选择源码安装,版本最好3以上,因为OpenCV2到3之间差别很大,我是安装了4.2,先是安装依赖:
> sudo apt-get install build-essential sudo apt-get install cmake git
> libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev
> sudo apt-get install python-dev python-numpy libtbb2 libtbb-dev
> libjpeg-dev libpng-dev libtiff-dev libjasper-dev libdc1394-22-dev
> 然后安装包:
>
> git clone https://github.com/opencv/opencv.git opencv-4.2.0 cd
> opencv-4.2.0 mkdir build && cd build cmake -D CMAKE_BUILD_TYPE=Release
> -D CMAKE_INSTALL_PREFIX=/usr/local .. make -j4 sudo make install
method 1:
https://code.visualstudio.com/Download#
sudo dpkg -i code_1.41.1-1576681836_amd64.deb
method 2:
1.安装步骤
1.1.安装Ubuntu Make 使用命令
sudo add-apt-repository ppa:ubuntu-desktop/ubuntu-make sudo apt-get
update sudo apt-get install ubuntu-make
1.2.安装Visual Studio Code
使用命令 umake ide visual-studio-code
/opt/ros/kinetic/lib/x86_64-linux-gnu/libopencv_imgcodecs3.so.3.3.1:
undefined reference to `TIFFGetField@LIBTIFF_4.0’则输入: ldd
/opt/ros/kinetic/lib/x86_64-linux-gnu/libopencv_imgcodecs3.so.3.3.1 |
grep tiff 则输出: libtiff.so.5 => /usr/local/lib/libtiff.so.5
(0x00007fc7fca4c000)解决方法: target_link_libraries(lidarNode /usr/local/lib/libtiff.so.5
${catkin_LIBRARIES} ${OpenCV_LIBRARIES} -ljsoncpp)
The specified base path "/home/ubuntu/catkin_ws" contains a CMakeLists.txt but "catkin_make" must be invoked in the root of workspace
unlink /home/ubuntu/catkin_ws/CMakeLists.txt
adar_object.cpp:82:26: required from here
/usr/include/eigen3/Eigen/src/Core/AssignEvaluator.h:745:3: error: static assertion failed: YOU_MIXED_DIFFERENT_NUMERIC_TYPES__YOU_NEED_TO_USE_THE_CAST_METHOD_OF_MATRIXBASE_TO_CAST_NUMERIC_TYPES_EXPLICITLY
可能是定义赋值数据类型不一致 Eigen::Vector3d local_loc Eigen::Vector3f local
eigen
/usr/include/eigen3/Eigen/src/Core/DenseStorage.h:128:
Eigen::internal::plain_array32>::plain_array() [with T = double; int Size = 4; int
MatrixOrArrayOptions = 0]: Assertion
`(reinterpret_cast(eigen_unaligned_array_assert_workaround_gcc47(array))
& (31)) == 0 && “this assertion is explained here: "
“http://eigen.tuxfamily.org/dox-devel/group__TopicUnalignedArrayAssert.html”
" **** READ THIS WEB PAGE !!! ****”’ failed.
https://blog.csdn.net/wojiushixiangshi/article/details/78356271
class AdaptiveKalmanFilter : public BaseFilter {
public:
EIGEN_MAKE_ALIGNED_OPERATOR_NEW