Fixed the Cuda detection and fallback logic
On systems where CUDA_VERSION=12.4 the script was incorrectly labeling it as 12.6 by default
This commit is contained in:
19
install.sh
19
install.sh
@@ -88,21 +88,24 @@ fi
|
||||
DETECTED_CUDA="$(nvidia-smi | grep 'CUDA Version' | sed 's/.*CUDA Version: *\([0-9.]*\).*/\1/')"
|
||||
log "Detected CUDA capability: ${DETECTED_CUDA}"
|
||||
|
||||
choose_cuda() {
|
||||
for v in "${SUPPORTED_CUDA[@]}"; do
|
||||
if [[ "$DETECTED_CUDA" == "$v"* ]]; then
|
||||
choose_cuda() {
|
||||
# Pick highest supported version <= detected CUDA capability
|
||||
for v in $(printf '%s\n' "${SUPPORTED_CUDA[@]}" | sort -rV); do
|
||||
if [ "$(printf '%s\n%s\n' "$v" "$DETECTED_CUDA" | sort -V | head -n1)" = "$v" ]; then
|
||||
echo "$v"
|
||||
return
|
||||
fi
|
||||
done
|
||||
echo ""
|
||||
}
|
||||
|
||||
# fallback: highest <= detected
|
||||
for v in $(printf '%s\n' "${SUPPORTED_CUDA[@]}" | sort -rV); do
|
||||
if [[ "$(printf '%s\n%s\n' "$v" "$DETECTED_CUDA" | sort -V | head -n1)" == "$v" ]]; then
|
||||
echo "$v"
|
||||
return
|
||||
if [ -z "$CUDA_VERSION" ]; then
|
||||
warn "Could not auto-match CUDA version, defaulting to highest supported"
|
||||
CUDA_VERSION="$(printf '%s\n' "${SUPPORTED_CUDA[@]}" | sort -V | tail -n1)"
|
||||
else
|
||||
log "Selected CUDA image version: ${CUDA_VERSION}"
|
||||
fi
|
||||
done
|
||||
|
||||
echo ""
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user