From b94bdc8fddf04b4fef9a8bc8b1033daecb2abb9f Mon Sep 17 00:00:00 2001 From: Bowen Ma Date: Tue, 28 Dec 2021 15:37:13 +0800 Subject: [PATCH] update cuda with pip install script on ubuntu 18.04 --- scripts/install/purge-cuda.sh | 9 +++++ scripts/install/ubuntu-gpu-pip.sh | 66 +++++++++++++++++++++++++++++++ 2 files changed, 75 insertions(+) create mode 100644 scripts/install/purge-cuda.sh create mode 100644 scripts/install/ubuntu-gpu-pip.sh diff --git a/scripts/install/purge-cuda.sh b/scripts/install/purge-cuda.sh new file mode 100644 index 0000000000..a62b46a562 --- /dev/null +++ b/scripts/install/purge-cuda.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +sudo apt-get --purge remove nvidia-* +sudo apt-get --purge remove cuda-* +sudo apt-get --purge remove cudnn-* +sudo apt-get --purge remove libnvidia-* +sudo apt-get --purge remove libcuda-* +sudo apt-get --purge remove libcudnn-* +sudo apt-get autoremove \ No newline at end of file diff --git a/scripts/install/ubuntu-gpu-pip.sh b/scripts/install/ubuntu-gpu-pip.sh new file mode 100644 index 0000000000..053e639323 --- /dev/null +++ b/scripts/install/ubuntu-gpu-pip.sh @@ -0,0 +1,66 @@ +#!/bin/bash +set -ex + + + +PYTHON_VERSION=${PYTHON_VERSION:-3.7.5} +MINDSPORE_VERSION=${MINDSPORE_VERSION:-1.5.0} + +declare -A map + + +if [[ "${PYTHON_VERSION}" == "3.7.5" ]]; then +VERSION="${MINDSPORE_VERSION}-cp37-cp37m" +else +VERSION="${MINDSPORE_VERSION}-cp39-cp39m" +fi + +#use huaweicloud mirror in China +sudo sed -i "s@http://.*archive.ubuntu.com@http://repo.huaweicloud.com@g" /etc/apt/sources.list +sudo sed -i "s@http://.*security.ubuntu.com@http://repo.huaweicloud.com@g" /etc/apt/sources.list +sudo apt-get update + +# install python 3.7 and make it default +sudo apt-get install gcc-7 libgmp-dev curl python3.7 openssl -y +sudo update-alternatives --install /usr/bin/python python /usr/bin/python3.7 100 + +cd /tmp +curl -O https://bootstrap.pypa.io/get-pip.py +sudo python get-pip.py + + +# install cuda + +# cd /tmp +# wget https://developer.download.nvidia.com/compute/cuda/11.1.0/local_installers/cuda_11.1.0_455.23.05_linux.run + + +wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/cuda-ubuntu1804.pin +sudo mv cuda-ubuntu1804.pin /etc/apt/preferences.d/cuda-repository-pin-600 +wget -c https://developer.download.nvidia.com/compute/cuda/11.1.1/local_installers/cuda-repo-ubuntu1804-11-1-local_11.1.1-455.32.00-1_amd64.deb +sudo dpkg -i cuda-repo-ubuntu1804-11-1-local_11.1.1-455.32.00-1_amd64.deb +sudo apt-key add /var/cuda-repo-ubuntu1804-11-1-local/7fa2af80.pub +sudo apt-get update +sudo apt-get -y install cuda + +# cuda to add path + +cat >> ~/.bash_profile <