Skip to content

Commit b510b7e

Browse files
authored
Set the CUDA version in the release URL (#461)
1 parent a8dae94 commit b510b7e

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

install.sh

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,17 @@ if [ "$GPU" == "-cuda" ] && [ "$OS" == "Darwin" ]; then
101101
exit 1
102102
fi
103103

104+
# There are only two supported CUDA version. Let it fail if unsupported.
105+
if [ "$GPU" == "-cuda" ]; then
106+
export PATH="/usr/local/cuda/bin:$PATH"
107+
CUDA_MAJ=$(nvcc --version | grep -oP "(?<=release )\d+") || 0
108+
if [[ $CUDA_MAJ == 12 ]]; then
109+
CUDA_VERSION="-12-0";
110+
elif [[ $CUDA_MAJ == 11 ]]; then
111+
CUDA_VERSION="-11-7"
112+
fi
113+
fi
114+
104115
# Construct GitHub API URL and get latest version if not specified
105116
if [ "$VERSION" == "latest" ]; then
106117
API_URL="https://api.github.com/repos/janhq/nitro/releases/latest"
@@ -116,7 +127,7 @@ fi
116127
# Construct download URL based on OS, ARCH, GPU and VERSION
117128
case $OS in
118129
Linux)
119-
FILE_NAME="nitro-${VERSION}-linux-amd64${GPU}.tar.gz"
130+
FILE_NAME="nitro-${VERSION}-linux-amd64${GPU}${CUDA_VERSION}.tar.gz"
120131
;;
121132
Darwin)
122133
ARCH_FORMAT=$( [[ "$ARCH" == "arm64" ]] && echo "mac-arm64" || echo "mac-amd64")

0 commit comments

Comments
 (0)