Skip to content

Commit

Permalink
feat(entrypoint): detect GPU
Browse files Browse the repository at this point in the history
Signed-off-by: Ettore Di Giacinto <[email protected]>
  • Loading branch information
mudler committed Mar 2, 2024
1 parent 1c31268 commit e1a1b57
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,30 @@ else
echo "@@@@@"
fi

GPU_ACCELERATION=false
case "$(uname -s)" in
Linux)
if lspci | grep -E 'VGA|3D' | grep -iq nvidia; then
echo "NVIDIA GPU detected"
GPU_ACCELERATION=true
elif lspci | grep -E 'VGA|3D' | grep -iq amd; then
echo "AMD GPU detected"
GPU_ACCELERATION=true
elif lspci | grep -E 'VGA|3D' | grep -iq intel; then
echo "Intel GPU detected"
GPU_ACCELERATION=true
fi
;;
Darwin)
if system_profiler SPDisplaysDataType | grep -iq 'Metal'; then
echo "Apple Metal supported GPU detected"
GPU_ACCELERATION=true
fi
;;
esac

if [ "$GPU_ACCELERATION" = "false" ]; then
echo "!!! No GPU detected, running with CPU only !!!"
fi

./local-ai "$@"

0 comments on commit e1a1b57

Please sign in to comment.