Conda environment export requirements.txt.
conda activate <env>
conda install pip
pip freeze > requirements.txtFor those getting odd path references in requirements.txt, use:
pip list --format=freeze > requirements.txt
Conda environment export requirements.txt.
conda activate <env>
conda install pip
pip freeze > requirements.txtFor those getting odd path references in requirements.txt, use:
pip list --format=freeze > requirements.txt
https://docs.docker.com/engine/install/ubuntu/
https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/latest/install-guide.html
https://jingluwang.blogspot.com/2020/12/fix-docker-got-permission-denied-while.html
Reference:
On your local computer, generate a SSH key pair by typing:
- ssh-keygen
OutputGenerating public/private rsa key pair.
Enter file in which to save the key (/home/username/.ssh/id_rsa):
The utility will prompt you to select a location for the keys that will be generated. By default, the keys will be stored in the ~/.ssh directory within your user’s home directory. The private key will be called id_rsa and the associated public key will be called id_rsa.pub.
The full command will look like this:
- cat ~/.ssh/id_rsa.pub | ssh username@remote_host "mkdir -p ~/.ssh && cat >> ~/.ssh/authorized_keys"
You may see a message like this:
OutputThe authenticity of host '203.0.113.1 (203.0.113.1)' can't be established.
ECDSA key fingerprint is fd:fd:d4:f9:77:fe:73:84:e1:55:00:ad:d6:6d:22:fe.
Are you sure you want to continue connecting (yes/no)? yes
This means that your local computer does not recognize the remote host. This will happen the first time you connect to a new host. Type yes and press ENTER to continue.
Error:
"cpp_extension.py", line 1561, in _get_cuda_arch_flags
arch_list[-1] += '+PTX'
IndexError: list index out of rangeTried to investigate a bit this issue since I've faced the same problem in one of my Docker container.
If you're currently running your code through a setup.py , you should first add TORCH_CUDA_ARCH_LIST="YOUR_GPUs_CC+PTX" to run:
python TORCH_CUDA_ARCH_LIST="YOUR_GPUs_CC+PTX" setup.py install
(or an ARG TORCH_CUDA_ARCH_LIST="YOUR_GPUs_CC+PTX" in your Dockerfile for instance )
Additional infos. can be found here: https://pytorch.org/docs/stable/cpp_extension.html
CUDA_VERSION=$(/usr/local/cuda/bin/nvcc --version | sed -n 's/^.*release \([0-9]\+\.[0-9]\+\).*$/\1/p')
if [[ ${CUDA_VERSION} == 9.0* ]]; then
export TORCH_CUDA_ARCH_LIST="3.5;5.0;6.0;7.0+PTX"
elif [[ ${CUDA_VERSION} == 9.2* ]]; then
export TORCH_CUDA_ARCH_LIST="3.5;5.0;6.0;6.1;7.0+PTX"
elif [[ ${CUDA_VERSION} == 10.* ]]; then
export TORCH_CUDA_ARCH_LIST="3.5;5.0;6.0;6.1;7.0;7.5+PTX"
elif [[ ${CUDA_VERSION} == 11.0* ]]; then
export TORCH_CUDA_ARCH_LIST="3.5;5.0;6.0;6.1;7.0;7.5;8.0+PTX"
elif [[ ${CUDA_VERSION} == 11.* ]]; then
export TORCH_CUDA_ARCH_LIST="3.5;5.0;6.0;6.1;7.0;7.5;8.0;8.6+PTX"
else
echo "unsupported cuda version."
exit 1
fi
If the gpu driver is loaded correctly, execute the following statement in the python console
>>> torch.cuda.get_device_capability(0)
(6, 1)
that means TORCH_CUDA_ARCH_LIST="6.1". However, in most cases, cuda is unavailable because you have specified gpu incorrectly.
~$ sudo apt --fix-broken install
Reading package lists... DoneBuilding dependency treeReading state information... DoneCorrecting dependencies... failed.The following packages have unmet dependencies:nvidia-dkms-530 : Depends: nvidia-kernel-common-530 (>= 530.41.03) but 530.30.02-0ubuntu1 is installednvidia-driver-530 : Depends: nvidia-kernel-common-530 (>= 530.41.03) but 530.30.02-0ubuntu1 is installedRecommends: libnvidia-compute-530:i386 (= 530.41.03-0ubuntu0.20.04.2)Recommends: libnvidia-decode-530:i386 (= 530.41.03-0ubuntu0.20.04.2)Recommends: libnvidia-encode-530:i386 (= 530.41.03-0ubuntu0.20.04.2)Recommends: libnvidia-fbc1-530:i386 (= 530.41.03-0ubuntu0.20.04.2)Recommends: libnvidia-gl-530:i386 (= 530.41.03-0ubuntu0.20.04.2)E: Error, pkgProblemResolver::Resolve generated breaks, this may be caused by held packages.E: Unable to correct dependencies
~$ sudo dpkg --purge --force-depends nvidia-dkms-530
To remove cuda toolkit:
sudo apt-get --purge remove "*cublas*" "cuda*" "nsight*"
To remove Nvidia drivers:
sudo apt-get --purge remove "*nvidia*"
If you have installed via source files (assuming the default location to be /usr/local) then remove it using:
sudo rm -rf /usr/local/cuda*
Official doc:
https://docs.nvidia.com/deeplearning/cudnn/install-guide/index.html#package-manager-ubuntu-install
Download header and libs
https://developer.nvidia.com/rdp/cudnn-download
$ tar -xvf cudnn-linux-x86_64-8.x.x.x_cudaX.Y-archive.tar.xz
$ sudo cp cudnn-*-archive/include/cudnn*.h /usr/local/cuda/include $ sudo cp -P cudnn-*-archive/lib/libcudnn* /usr/local/cuda/lib64 $ sudo chmod a+r /usr/local/cuda/include/cudnn*.h /usr/local/cuda/lib64/libcudnn*