Improve NVIDIA device detection for container passthrough (#9670)
This commit is contained in:
parent
316082eaaa
commit
d2e9997d0d
@ -2442,9 +2442,16 @@ build_container() {
|
|||||||
msg_custom "🎮" "${GN}" "Detected NVIDIA GPU"
|
msg_custom "🎮" "${GN}" "Detected NVIDIA GPU"
|
||||||
|
|
||||||
# Simple passthrough - just bind /dev/nvidia* devices if they exist
|
# Simple passthrough - just bind /dev/nvidia* devices if they exist
|
||||||
for d in /dev/nvidia* /dev/nvidiactl /dev/nvidia-modeset /dev/nvidia-uvm /dev/nvidia-uvm-tools; do
|
# Only include character devices (-c), skip directories like /dev/nvidia-caps
|
||||||
[[ -e "$d" ]] && NVIDIA_DEVICES+=("$d")
|
for d in /dev/nvidia*; do
|
||||||
|
[[ -c "$d" ]] && NVIDIA_DEVICES+=("$d")
|
||||||
done
|
done
|
||||||
|
# Also check for devices inside /dev/nvidia-caps/ directory
|
||||||
|
if [[ -d /dev/nvidia-caps ]]; then
|
||||||
|
for d in /dev/nvidia-caps/*; do
|
||||||
|
[[ -c "$d" ]] && NVIDIA_DEVICES+=("$d")
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
if [[ ${#NVIDIA_DEVICES[@]} -gt 0 ]]; then
|
if [[ ${#NVIDIA_DEVICES[@]} -gt 0 ]]; then
|
||||||
msg_custom "🎮" "${GN}" "Found ${#NVIDIA_DEVICES[@]} NVIDIA device(s) for passthrough"
|
msg_custom "🎮" "${GN}" "Found ${#NVIDIA_DEVICES[@]} NVIDIA device(s) for passthrough"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user