From c9062d1f88e39d9b0e7084c71efdd00af53e1671 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ruilong=20Li=28=E6=9D=8E=E7=91=9E=E9=BE=99=29?= Date: Fri, 13 Oct 2023 10:18:58 -0700 Subject: [PATCH] some helper files for build test (#39) Co-authored-by: Ruilong Li <397653553@qq.com> --- .github/workflows/cuda/Linux-env.sh | 44 ++++++++++++++++++ .github/workflows/cuda/Linux.sh | 64 +++++++++++++++++++++++++++ .github/workflows/cuda/Windows-env.sh | 38 ++++++++++++++++ .github/workflows/cuda/Windows.sh | 47 ++++++++++++++++++++ 4 files changed, 193 insertions(+) create mode 100644 .github/workflows/cuda/Linux-env.sh create mode 100644 .github/workflows/cuda/Linux.sh create mode 100644 .github/workflows/cuda/Windows-env.sh create mode 100644 .github/workflows/cuda/Windows.sh diff --git a/.github/workflows/cuda/Linux-env.sh b/.github/workflows/cuda/Linux-env.sh new file mode 100644 index 000000000..543f4a37f --- /dev/null +++ b/.github/workflows/cuda/Linux-env.sh @@ -0,0 +1,44 @@ +#!/bin/bash + +# Took from https://github.com/pyg-team/pyg-lib/ + +case ${1} in + cu118) + export CUDA_HOME=/usr/local/cuda-11.8 + export LD_LIBRARY_PATH=${CUDA_HOME}/lib64:${LD_LIBRARY_PATH} + export PATH=${CUDA_HOME}/bin:${PATH} + export TORCH_CUDA_ARCH_LIST="3.5;5.0+PTX;6.0;7.0;7.5;8.0;8.6" + ;; + cu117) + export CUDA_HOME=/usr/local/cuda-11.7 + export LD_LIBRARY_PATH=${CUDA_HOME}/lib64:${LD_LIBRARY_PATH} + export PATH=${CUDA_HOME}/bin:${PATH} + export TORCH_CUDA_ARCH_LIST="3.5;5.0+PTX;6.0;7.0;7.5;8.0;8.6" + ;; + cu116) + export CUDA_HOME=/usr/local/cuda-11.6 + export LD_LIBRARY_PATH=${CUDA_HOME}/lib64:${LD_LIBRARY_PATH} + export PATH=${CUDA_HOME}/bin:${PATH} + export TORCH_CUDA_ARCH_LIST="3.5;5.0+PTX;6.0;7.0;7.5;8.0;8.6" + ;; + cu115) + export CUDA_HOME=/usr/local/cuda-11.5 + export LD_LIBRARY_PATH=${CUDA_HOME}/lib64:${LD_LIBRARY_PATH} + export PATH=${CUDA_HOME}/bin:${PATH} + export TORCH_CUDA_ARCH_LIST="3.5;5.0+PTX;6.0;7.0;7.5;8.0;8.6" + ;; + cu113) + export CUDA_HOME=/usr/local/cuda-11.3 + export LD_LIBRARY_PATH=${CUDA_HOME}/lib64:${LD_LIBRARY_PATH} + export PATH=${CUDA_HOME}/bin:${PATH} + export TORCH_CUDA_ARCH_LIST="3.5;5.0+PTX;6.0;7.0;7.5;8.0;8.6" + ;; + cu102) + export CUDA_HOME=/usr/local/cuda-10.2 + export LD_LIBRARY_PATH=${CUDA_HOME}/lib64:${LD_LIBRARY_PATH} + export PATH=${CUDA_HOME}/bin:${PATH} + export TORCH_CUDA_ARCH_LIST="3.5;5.0+PTX;6.0;7.0;7.5" + ;; + *) + ;; +esac \ No newline at end of file diff --git a/.github/workflows/cuda/Linux.sh b/.github/workflows/cuda/Linux.sh new file mode 100644 index 000000000..738bbfe32 --- /dev/null +++ b/.github/workflows/cuda/Linux.sh @@ -0,0 +1,64 @@ +#!/bin/bash + +# Took from https://github.com/pyg-team/pyg-lib/ + +OS=ubuntu2004 + +case ${1} in + cu118) + CUDA=11.8 + APT_KEY=${OS}-${CUDA/./-}-local + FILENAME=cuda-repo-${APT_KEY}_${CUDA}.0-520.61.05-1_amd64.deb + URL=https://developer.download.nvidia.com/compute/cuda/${CUDA}.0/local_installers + ;; + cu117) + CUDA=11.7 + APT_KEY=${OS}-${CUDA/./-}-local + FILENAME=cuda-repo-${APT_KEY}_${CUDA}.1-515.65.01-1_amd64.deb + URL=https://developer.download.nvidia.com/compute/cuda/${CUDA}.1/local_installers + ;; + cu116) + CUDA=11.6 + APT_KEY=${OS}-${CUDA/./-}-local + FILENAME=cuda-repo-${APT_KEY}_${CUDA}.2-510.47.03-1_amd64.deb + URL=https://developer.download.nvidia.com/compute/cuda/${CUDA}.2/local_installers + ;; + cu115) + CUDA=11.5 + APT_KEY=${OS}-${CUDA/./-}-local + FILENAME=cuda-repo-${APT_KEY}_${CUDA}.2-495.29.05-1_amd64.deb + URL=https://developer.download.nvidia.com/compute/cuda/${CUDA}.2/local_installers + ;; + cu113) + CUDA=11.3 + APT_KEY=${OS}-${CUDA/./-}-local + FILENAME=cuda-repo-${APT_KEY}_${CUDA}.0-465.19.01-1_amd64.deb + URL=https://developer.download.nvidia.com/compute/cuda/${CUDA}.0/local_installers + ;; + cu102) + CUDA=10.2 + APT_KEY=${CUDA/./-}-local-${CUDA}.89-440.33.01 + FILENAME=cuda-repo-${OS}-${APT_KEY}_1.0-1_amd64.deb + URL=https://developer.download.nvidia.com/compute/cuda/${CUDA}/Prod/local_installers + ;; + *) + echo "Unrecognized CUDA_VERSION=${1}" + exit 1 + ;; +esac + +wget -nv https://developer.download.nvidia.com/compute/cuda/repos/${OS}/x86_64/cuda-${OS}.pin +sudo mv cuda-${OS}.pin /etc/apt/preferences.d/cuda-repository-pin-600 +wget -nv ${URL}/${FILENAME} +sudo dpkg -i ${FILENAME} + +if [ "${1}" = "cu117" ] || [ "${1}" = "cu118" ]; then + sudo cp /var/cuda-repo-${APT_KEY}/cuda-*-keyring.gpg /usr/share/keyrings/ +else + sudo apt-key add /var/cuda-repo-${APT_KEY}/7fa2af80.pub +fi + +sudo apt-get update +sudo apt-get -y install cuda + +rm -f ${FILENAME} \ No newline at end of file diff --git a/.github/workflows/cuda/Windows-env.sh b/.github/workflows/cuda/Windows-env.sh new file mode 100644 index 000000000..ca1500bcd --- /dev/null +++ b/.github/workflows/cuda/Windows-env.sh @@ -0,0 +1,38 @@ +#!/bin/bash + +# Took from https://github.com/pyg-team/pyg-lib/ + +case ${1} in + cu118) + CUDA_HOME=/c/Program\ Files/NVIDIA\ GPU\ Computing\ Toolkit/CUDA/v11.8 + PATH=${CUDA_HOME}/bin:$PATH + PATH=/c/Program\ Files\ \(x86\)/Microsoft\ Visual\ Studio/2017/BuildTools/MSBuild/15.0/Bin:$PATH + export TORCH_CUDA_ARCH_LIST="6.0+PTX" + ;; + cu117) + CUDA_HOME=/c/Program\ Files/NVIDIA\ GPU\ Computing\ Toolkit/CUDA/v11.7 + PATH=${CUDA_HOME}/bin:$PATH + PATH=/c/Program\ Files\ \(x86\)/Microsoft\ Visual\ Studio/2017/BuildTools/MSBuild/15.0/Bin:$PATH + export TORCH_CUDA_ARCH_LIST="6.0+PTX" + ;; + cu116) + CUDA_HOME=/c/Program\ Files/NVIDIA\ GPU\ Computing\ Toolkit/CUDA/v11.6 + PATH=${CUDA_HOME}/bin:$PATH + PATH=/c/Program\ Files\ \(x86\)/Microsoft\ Visual\ Studio/2017/BuildTools/MSBuild/15.0/Bin:$PATH + export TORCH_CUDA_ARCH_LIST="6.0+PTX" + ;; + cu115) + CUDA_HOME=/c/Program\ Files/NVIDIA\ GPU\ Computing\ Toolkit/CUDA/v11.5 + PATH=${CUDA_HOME}/bin:$PATH + PATH=/c/Program\ Files\ \(x86\)/Microsoft\ Visual\ Studio/2017/BuildTools/MSBuild/15.0/Bin:$PATH + export TORCH_CUDA_ARCH_LIST="6.0+PTX" + ;; + cu113) + CUDA_HOME=/c/Program\ Files/NVIDIA\ GPU\ Computing\ Toolkit/CUDA/v11.3 + PATH=${CUDA_HOME}/bin:$PATH + PATH=/c/Program\ Files\ \(x86\)/Microsoft\ Visual\ Studio/2017/BuildTools/MSBuild/15.0/Bin:$PATH + export TORCH_CUDA_ARCH_LIST="6.0+PTX" + ;; + *) + ;; +esac \ No newline at end of file diff --git a/.github/workflows/cuda/Windows.sh b/.github/workflows/cuda/Windows.sh new file mode 100644 index 000000000..d780afaa3 --- /dev/null +++ b/.github/workflows/cuda/Windows.sh @@ -0,0 +1,47 @@ +#!/bin/bash + +# Took from https://github.com/pyg-team/pyg-lib/ + +# Install NVIDIA drivers, see: +# https://github.com/pytorch/vision/blob/master/packaging/windows/internal/cuda_install.bat#L99-L102 +curl -k -L "https://drive.google.com/u/0/uc?id=1injUyo3lnarMgWyRcXqKg4UGnN0ysmuq&export=download" --output "/tmp/gpu_driver_dlls.zip" +7z x "/tmp/gpu_driver_dlls.zip" -o"/c/Windows/System32" + +case ${1} in + cu118) + CUDA_SHORT=11.8 + CUDA_URL=https://developer.download.nvidia.com/compute/cuda/${CUDA_SHORT}.0/local_installers + CUDA_FILE=cuda_${CUDA_SHORT}.0_522.06_windows.exe + ;; + cu117) + CUDA_SHORT=11.7 + CUDA_URL=https://developer.download.nvidia.com/compute/cuda/${CUDA_SHORT}.1/local_installers + CUDA_FILE=cuda_${CUDA_SHORT}.1_516.94_windows.exe + ;; + cu116) + CUDA_SHORT=11.3 + CUDA_URL=https://developer.download.nvidia.com/compute/cuda/${CUDA_SHORT}.0/local_installers + CUDA_FILE=cuda_${CUDA_SHORT}.0_465.89_win10.exe + ;; + cu115) + CUDA_SHORT=11.3 + CUDA_URL=https://developer.download.nvidia.com/compute/cuda/${CUDA_SHORT}.0/local_installers + CUDA_FILE=cuda_${CUDA_SHORT}.0_465.89_win10.exe + ;; + cu113) + CUDA_SHORT=11.3 + CUDA_URL=https://developer.download.nvidia.com/compute/cuda/${CUDA_SHORT}.0/local_installers + CUDA_FILE=cuda_${CUDA_SHORT}.0_465.89_win10.exe + ;; + *) + echo "Unrecognized CUDA_VERSION=${1}" + exit 1 + ;; +esac + +curl -k -L "${CUDA_URL}/${CUDA_FILE}" --output "${CUDA_FILE}" +echo "" +echo "Installing from ${CUDA_FILE}..." +PowerShell -Command "Start-Process -FilePath \"${CUDA_FILE}\" -ArgumentList \"-s nvcc_${CUDA_SHORT} cuobjdump_${CUDA_SHORT} nvprune_${CUDA_SHORT} cupti_${CUDA_SHORT} cublas_dev_${CUDA_SHORT} cudart_${CUDA_SHORT} cufft_dev_${CUDA_SHORT} curand_dev_${CUDA_SHORT} cusolver_dev_${CUDA_SHORT} cusparse_dev_${CUDA_SHORT} thrust_${CUDA_SHORT} npp_dev_${CUDA_SHORT} nvrtc_dev_${CUDA_SHORT} nvml_dev_${CUDA_SHORT}\" -Wait -NoNewWindow" +echo "Done!" +rm -f "${CUDA_FILE}" \ No newline at end of file