Google Code Block

2018年4月24日

Switch CUDA between (8.0 / 9.0 / 9.1) quickly with bash script

Download bash script : switch_cuda.sh


#!/bin/bash
echo "------------- Current Cuda Version -------------"
nvcc --version
NVCC_VER="$(nvcc --version)"
NVCC_VER_D=$(echo $NVCC_VER | cut -d',' -f 3,4)
echo ""
echo "Cuda ="$NVCC_VER_D
V91="V9.1"
V90="V9.0"
V80="V8.0"
current_ver=""
if [[ $NVCC_VER_D == *"$V90"* ]]; then
read -p "Switch to (8.0 / 9.1) ? " tar_cuda_ver
current_ver="9.0"
elif [[ $NVCC_VER_D == *"$V80"* ]]; then
read -p "Switch to (9.0 / 9.1) ? " tar_cuda_ver
current_ver="8.0"
elif [[ $NVCC_VER_D == *"$V91"* ]]; then
read -p "Switch to (8.0 / 9.0) ? " tar_cuda_ver
current_ver="9.1"
fi
CUDA_PATH="/usr/local/cuda-"$tar_cuda_ver
if [ -d $CUDA_PATH ]; then
full_tar_ver=V$tar_cuda_ver
if [[ $NVCC_VER_D == *"$full_tar_ver"* ]]; then
echo "You are already in use of Cuda"$NVCC_VER_D
else
echo "Switching to Cuda "$full_tar_ver" ..."
sudo ln -sfn $CUDA_PATH /usr/local/cuda
echo "Switch to Cuda" $tar_cuda_ver " Success !!"
fi
else
echo "Incorrect Cuda Version "$tar_cuda_ver
fi
echo ""
echo "------------- Current Cuda Version -------------"
nvcc --version


ps. Tensorflow Version Sheet
VersioncuDNNCUDA
tensorflow_gpu-1.7.079
tensorflow_gpu-1.6.079
tensorflow_gpu-1.5.079
tensorflow_gpu-1.4.068
tensorflow_gpu-1.3.068
tensorflow_gpu-1.2.05.18
tensorflow_gpu-1.1.05.18
tensorflow_gpu-1.0.05.18

1 則留言:

張貼留言