すっぴんのUbuntu 20.04 LTSにCUDA入れるメモ
まず以下を確認
https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/
sudo wget -O /etc/apt/preferences.d/cuda-repository-pin-600 https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/cuda-ubuntu2004.pin
sudo apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/7fa2af80.pub
sudo add-apt-repository "deb http://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/ /"
sudo apt -y install cuda-11-4
export CUDA_PATH=/usr/local/cuda-11.4
echo 'export CUDA_PATH=/usr/local/cuda-11.4' >> ${HOME}/.bashrc
export LD_LIBRARY_PATH=/usr/local/cuda-11.4/lib64:${LD_LIBRARY_PATH}
echo 'export LD_LIBRARY_PATH=/usr/local/cuda-11.4/lib64:${LD_LIBRARY_PATH}' >> ${HOME}/.bashrc
export PATH=/usr/local/cuda-11.4/bin:${PATH}
echo 'export PATH=/usr/local/cuda-11.4/bin:${PATH}' >> ${HOME}/.bashrc
以下は機械学習系(TensorRTなど)
sudo apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu2004/x86_64/7fa2af80.pub
sudo add-apt-repository "deb https://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu2004/x86_64/ /"
sudo apt-get install libnvinfer-dev libnvonnxparsers-dev libnvparsers-dev libnvinfer-plugin-dev
sudo apt-get install zip unzip