1 ubuntu 安裝CUDA
1.關(guān)閉主板BIOS的Secure Boot選項(xiàng)
2.執(zhí)行NIVIDIA官網(wǎng)給出的命令
wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/cuda-ubuntu1804.pinsudo
mv cuda-ubuntu1804.pin /etc/apt/preferences.d/cuda-repository-pin-600
wget http://developer.download.nvidia.com/compute/cuda/10.2/Prod/local_installers/cuda-repo-ubuntu1804-10-2-local-10.2.89-440.33.01_1.0-1_amd64.deb
sudo dpkg -i cuda-repo-ubuntu1804-10-2-local-10.2.89-440.33.01_1.0-1_amd64.deb
sudo apt-key add /var/cuda-repo-10-2-local-10.2.89-440.33.01/7fa2af80.pub
sudo apt-get updatesudo apt-get -y install cuda
2.ubuntu安裝ffmpeg
1.添加ffmpeg顯卡支持
git clone https://git.videolan.org/git/ffmpeg/nv-codec-headers.git
cd nv-codec-headers/
make
sudo make installhttps://blog.csdn.net/lupengCSDN/article/details/80279177
2.下載ffmpeg
從ffmpeg官網(wǎng):http://ffmpeg.org/download.html下載最新的ffmpeg安裝包抱婉,并解壓
3.安裝yasm
下載:yasm的下載鏈接
2)解壓:把下載下來(lái)的壓縮包進(jìn)行解壓
3)切換路徑: cd yasm-1.3.0
4)執(zhí)行配置: ./configure
5)編譯:make
6)安裝:sudo make install
4.編譯和配置
cd ffmpeg-4.2.2/
ls
apt list |grep x264
sudo apt-get install libx264-dev
sudo apt-get install libx265-dev
apt list|grep sdl2
./configure --help
export PATH=$PATH:/usr/local/cuda/bin
./configure --enable-cuvid --enable-nvenc --enable-libx264 --enable-libx265 --enable-opengl --enable-cuda-nvcc --disable-debug --disable-static --enable-shared --enable-avresample --enable-gpl --enable-nonfree --enable-version3 --enable-libnpp --extra-cflags=-I/usr/local/cuda/include --extra-ldflags=-L/usr/local/cuda/lib64
#6表示cpu核心
make -j6
sudo make install
sudo ldconfig
3.ubuntu安裝opencv
https://blog.csdn.net/kingroc/article/details/93893828
cmake -D CMAKE_BUILD_TYPE=RELEASE \
-D PYTHON_DEFAULT_EXECUTABLE=$(python -c "import sys; print(sys.executable)") \
-D PYTHON3_EXECUTABLE=$(python -c "import sys; print(sys.executable)") \
-D PYTHON3_NUMPY_INCLUDE_DIRS=$(python -c "import numpy; print (numpy.get_include())") \
-D PYTHON3_PACKAGES_PATH=$(python -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())") \
-D CMAKE_CXX_FLAGS="-std=c++11" \
-D CUDA_NVCC_FLAGS="--compiler-options "-std=c++03"" \
-D WITH_TBB=ON -D BUILD_NEW_PYTHON_SUPPORT=ON -D WITH_V4L=ON -D INSTALL_C_EXAMPLES=ON -D INSTALL_PYTHON_EXAMPLES=ON -D BUILD_EXAMPLES=ON -D \ WITH_QT=ON -D WITH_GTK=ON -D WITH_OPENGL=ON ..
1.從官網(wǎng)下載源碼文件
apt list |grep cmake
sudo apt install cmake
sudo apt install cmake-curses-gui
cd opencv-4.3.0/
mkdir build
cd build/
ccmake ..
apt list|grep cmake
sudo apt install cmake-qt-gui
cmake-gui ..
make -j 6
sudo make install
2.解決opencv沒(méi)有代碼提示的問(wèn)題
將cv2.cpython-36m-x86_64-linux-gnu.so 復(fù)制到python的site-package目錄下即可
Docker相關(guān)配置
1.install https://docs.docker.com/engine/install/ubuntu/
2.sudo vim /etc/docker/daemon.json
{
"runtimes": {
"nvidia": {
"path": "nvidia-container-runtime",
"runtimeArgs": []
}
},
"registry-mirrors": [
"https://yc08i7bu.mirror.aliyuncs.com"
],
"insecure-registries": [
"192.168.x.x/24"
]
}
sudo systemctl restart dockerd
sudo systemctl restart docker
Nvidia-docker支持
https://github.com/NVIDIA/nvidia-docker
#### Test nvidia-smi with the latest official CUDA image
docker run --gpus all nvidia/cuda:10.0-base nvidia-smi
# Start a GPU enabled container on two GPUs
docker run --gpus 2 nvidia/cuda:10.0-base nvidia-smi
# Starting a GPU enabled container on specific GPUs
docker run --gpus '"device=1,2"' nvidia/cuda:10.0-base nvidia-smi
docker run --gpus '"device=UUID-ABCDEF,1"' nvidia/cuda:10.0-base nvidia-smi
# Specifying a capability (graphics, compute, ...) for my container
# Note this is rarely if ever used this way
docker run --gpus all,capabilities=utility nvidia/cuda:10.0-base nvidia-smi
pytorch 安裝
1.conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/
2.conda install pytorch torchvision cudatoolkit=10.0
python 通過(guò)cython打包wheel
python setup.py bdist_wheel
curl 添加代理
curl --socks5 {ip}:{port} -L https://graphics.ethz.ch/Downloads/Data/Davis/DAVIS-data.zip -o DAVIS-data.zip
shurufa sougou
https://blog.csdn.net/lupengCSDN/article/details/80279177