check nvidia-smi before anything else

This commit is contained in:
Michael Yang 2023-11-21 17:07:41 -08:00
parent 31488be1e3
commit b84115f777

View File

@ -125,11 +125,6 @@ if available systemctl; then
configure_systemd
fi
if ! available lspci && ! available lshw; then
warning "Unable to detect NVIDIA GPU. Install lspci or lshw to automatically detect and install NVIDIA CUDA drivers."
exit
fi
check_gpu() {
case $1 in
lspci) available lspci && lspci -d '10de:' | grep -q 'NVIDIA' || return 1 ;;
@ -143,6 +138,11 @@ if check_gpu nvidia-smi; then
exit
fi
if ! available lspci && ! available lshw; then
warning "Unable to detect NVIDIA GPU. Install lspci or lshw to automatically detect and install NVIDIA CUDA drivers."
exit
fi
if ! check_gpu lspci && ! check_gpu lshw; then
install_success
warning "No NVIDIA GPU detected. Ollama will run with CPU."