-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathpreparenspawngpu
More file actions
executable file
·50 lines (40 loc) · 1.59 KB
/
preparenspawngpu
File metadata and controls
executable file
·50 lines (40 loc) · 1.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/bin/bash
/sbin/modprobe nvidia
if [ "$?" -eq 0 ]; then
# Count the number of NVIDIA controllers found.
NVDEVS=`lspci | grep -i NVIDIA`
N3D=`echo "$NVDEVS" | grep "3D controller" | wc -l`
NVGA=`echo "$NVDEVS" | grep "VGA compatible controller" | wc -l`
N=`expr $N3D + $NVGA - 1`
for i in `seq 0 $N`; do
mknod -m 666 /dev/nvidia$i c 195 $i
done
mknod -m 666 /dev/nvidiactl c 195 255
else
exit 1
fi
/sbin/modprobe nvidia-uvm
if [ "$?" -eq 0 ]; then
# Find out the major device number used by the nvidia-uvm driver
D=`grep nvidia-uvm /proc/devices | awk '{print $1}'`
mknod -m 666 /dev/nvidia-uvm c $D 0
else
exit 1
fi
# required if the screen is not connected to the NVIDIA GPU(s) and uses e.g. a iGPU
mknod -m 755 /dev/nvidia-caps c $(cat /proc/devices | grep nvidia-caps | awk '{print $1}') 80
mknod -m 755 /dev/nvidia-uvm-tools c $(cat /proc/devices | grep nvidia-uvm | awk '{print $1}') 80
## that's how it should look like on the host
## required IF GPU is not used for the screen but just for number crunching
## then while booting not all entries below /dev are created
##
## ls -la /dev|grep nvidia
#crw-rw-rw- 1 root root 195, 0 17. Jul 12:14 nvidia0
#crw-rw-rw- 1 root root 195, 1 17. Jul 12:14 nvidia1
#drwxr-xr-x 2 root root 80 17. Jul 12:21 nvidia-caps
#crw-rw-rw- 1 root root 195, 255 17. Jul 12:14 nvidiactl
#crw-rw-rw- 1 root root 195, 254 17. Jul 12:14 nvidia-modeset
#crw-rw-rw- 1 root root 235, 0 17. Jul 12:14 nvidia-uvm
#crw-rw-rw- 1 root root 235, 1 17. Jul 12:21 nvidia-uvm-tools
echo -e "success."
exit 0