fix nvidia detection in install script (#4683)
This commit is contained in:
parent
d7339fad52
commit
b7d316d98d
1 changed files with 14 additions and 9 deletions
|
@ -153,6 +153,11 @@ check_gpu() {
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if check_gpu nvidia-smi; then
|
||||||
|
status "NVIDIA GPU installed."
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
if ! check_gpu lspci nvidia && ! check_gpu lshw nvidia && ! check_gpu lspci amdgpu && ! check_gpu lshw amdgpu; then
|
if ! check_gpu lspci nvidia && ! check_gpu lshw nvidia && ! check_gpu lspci amdgpu && ! check_gpu lshw amdgpu; then
|
||||||
install_success
|
install_success
|
||||||
warning "No NVIDIA/AMD GPU detected. Ollama will run in CPU-only mode."
|
warning "No NVIDIA/AMD GPU detected. Ollama will run in CPU-only mode."
|
||||||
|
@ -269,7 +274,7 @@ if ! check_gpu nvidia-smi || [ -z "$(nvidia-smi | grep -o "CUDA Version: [0-9]*\
|
||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! lsmod | grep -q nvidia; then
|
if ! lsmod | grep -q nvidia || ! lsmod | grep -q nvidia_uvm; then
|
||||||
KERNEL_RELEASE="$(uname -r)"
|
KERNEL_RELEASE="$(uname -r)"
|
||||||
case $OS_NAME in
|
case $OS_NAME in
|
||||||
rocky) $SUDO $PACKAGE_MANAGER -y install kernel-devel kernel-headers ;;
|
rocky) $SUDO $PACKAGE_MANAGER -y install kernel-devel kernel-headers ;;
|
||||||
|
@ -283,10 +288,15 @@ if ! lsmod | grep -q nvidia; then
|
||||||
if [ -n "$NVIDIA_CUDA_VERSION" ]; then
|
if [ -n "$NVIDIA_CUDA_VERSION" ]; then
|
||||||
$SUDO dkms install $NVIDIA_CUDA_VERSION
|
$SUDO dkms install $NVIDIA_CUDA_VERSION
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if lsmod | grep -q nouveau; then
|
||||||
|
status 'Reboot to complete NVIDIA CUDA driver install.'
|
||||||
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
$SUDO modprobe nvidia
|
$SUDO modprobe nvidia
|
||||||
$SUDO modprobe nvidia_uvm
|
$SUDO modprobe nvidia_uvm
|
||||||
|
fi
|
||||||
|
|
||||||
# make sure the NVIDIA modules are loaded on boot with nvidia-persistenced
|
# make sure the NVIDIA modules are loaded on boot with nvidia-persistenced
|
||||||
if command -v nvidia-persistenced > /dev/null 2>&1; then
|
if command -v nvidia-persistenced > /dev/null 2>&1; then
|
||||||
|
@ -299,9 +309,4 @@ if command -v nvidia-persistenced > /dev/null 2>&1; then
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if lsmod | grep -q nouveau; then
|
|
||||||
status 'Reboot to complete NVIDIA CUDA driver install.'
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
status "NVIDIA GPU ready."
|
status "NVIDIA GPU ready."
|
||||||
|
|
Loading…
Reference in a new issue