Ensure nvidia
and nvidia_uvm
kernel modules are loaded in install.sh
script and at startup (#4652)
* ensure kernel modules are loaded in `install.sh` script and at startup * indentation * use `SUDO` variable * restart if nouveau is detected * consistent success message for AMD
This commit is contained in:
parent
485016bfbb
commit
c79f8c9c39
1 changed files with 23 additions and 18 deletions
|
@ -153,11 +153,6 @@ 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."
|
||||||
|
@ -181,7 +176,7 @@ if check_gpu lspci amdgpu || check_gpu lshw amdgpu; then
|
||||||
curl --fail --show-error --location --progress-bar "https://ollama.com/download/ollama-linux-amd64-rocm.tgz${VER_PARAM}" \
|
curl --fail --show-error --location --progress-bar "https://ollama.com/download/ollama-linux-amd64-rocm.tgz${VER_PARAM}" \
|
||||||
| $SUDO tar zx --owner ollama --group ollama -C /usr/share/ollama/lib/rocm .
|
| $SUDO tar zx --owner ollama --group ollama -C /usr/share/ollama/lib/rocm .
|
||||||
install_success
|
install_success
|
||||||
status "AMD GPU dependencies installed."
|
status "AMD GPU ready."
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -288,15 +283,25 @@ 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
|
|
||||||
|
|
||||||
$SUDO modprobe nvidia
|
|
||||||
$SUDO modprobe nvidia_uvm
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
$SUDO modprobe nvidia
|
||||||
|
$SUDO modprobe nvidia_uvm
|
||||||
|
|
||||||
status "NVIDIA CUDA drivers installed."
|
# make sure the NVIDIA modules are loaded on boot with nvidia-persistenced
|
||||||
|
if command -v nvidia-persistenced > /dev/null 2>&1; then
|
||||||
|
$SUDO touch /etc/modules-load.d/nvidia.conf
|
||||||
|
MODULES="nvidia nvidia-uvm"
|
||||||
|
for MODULE in $MODULES; do
|
||||||
|
if ! grep -qxF "$MODULE" /etc/modules-load.d/nvidia.conf; then
|
||||||
|
echo "$MODULE" | sudo tee -a /etc/modules-load.d/nvidia.conf > /dev/null
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
|
if lsmod | grep -q nouveau; then
|
||||||
|
status 'Reboot to complete NVIDIA CUDA driver install.'
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
status "NVIDIA GPU ready."
|
||||||
|
|
Loading…
Reference in a new issue