@@ -39,6 +39,18 @@ check_install_jq_tar() {
3939 fi
4040}
4141
42+ determine_avx_support () {
43+ if grep -q avx512 /proc/cpuinfo; then
44+ echo " -avx512"
45+ elif grep -q avx2 /proc/cpuinfo; then
46+ echo " -avx2"
47+ elif grep -q avx /proc/cpuinfo; then
48+ echo " -avx"
49+ else
50+ echo " "
51+ fi
52+ }
53+
4254# Function to download and install nitro
4355install_nitro () {
4456 rm -rf /tmp/nitro
@@ -73,8 +85,10 @@ create_uninstall_script() {
7385
7486# Determine OS and architecture
7587OS=$( uname -s)
88+ ARCH=$( uname -m)
7689VERSION=" latest"
7790GPU=" "
91+ AVX=" "
7892
7993check_install_jq_tar
8094
91105 shift
92106 shift
93107 ;;
108+ --avx)
109+ AVX=" -avx"
110+ shift
111+ ;;
112+ --avx2)
113+ AVX=" -avx2"
114+ shift
115+ ;;
116+ --avx512)
117+ AVX=" -avx512"
118+ shift
119+ ;;
94120 esac
95121done
96122
126152# Construct download URL based on OS, ARCH, GPU and VERSION
127153case $OS in
128154 Linux)
129- FILE_NAME=" nitro-${VERSION} -linux-amd64${GPU}${CUDA_VERSION} .tar.gz"
155+ if [ -z " $AVX " ]; then
156+ AVX=$( determine_avx_support)
157+ fi
158+ FILE_NAME=" nitro-${VERSION} -linux-amd64${AVX}${GPU}${CUDA_VERSION} .tar.gz"
130159 ;;
131160 Darwin)
132161 ARCH_FORMAT=" mac-universal"
@@ -140,6 +169,16 @@ esac
140169
141170DOWNLOAD_URL=" https://github.com/janhq/nitro/releases/download/v${VERSION} /${FILE_NAME} "
142171
172+ # Check AVX support
173+ if [ -z " $AVX " ] && [ " $OS " == " Linux" ]; then
174+ echo " AVX is not supported on this system."
175+ exit 1
176+ fi
177+
178+ # Remove existing Nitro installation
179+ echo " Removing existing Nitro installation..."
180+ rm -rf /usr/local/bin/nitro
181+
143182# Download, install, and create uninstall script
144183install_nitro " $DOWNLOAD_URL "
145184create_uninstall_script
0 commit comments