-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathknow-your-gpus.sh
executable file
·78 lines (64 loc) · 2.41 KB
/
know-your-gpus.sh
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#!/bin/bash
#
# Copyright 2019 Mani Sarkar
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
set -e
set -u
set -o pipefail
SUDO_CMD=""
if [[ -f "/etc/sudoers" ]]; then
SUDO_CMD=sudo
fi
echo ""; echo "~~~~~ Check using /dev" >&2
ls -la /dev | grep nvidia >&2 || true
echo ""; echo "~~~~~ Check using /opt" >&2
ls /opt/ || true
ls /opt/nvidia_installers || true
echo ""; echo "~~~~~ Check using /usr/local/" >&2
ls /usr/local/ || true
echo ""; echo "~~~~~ Check using mesa-utils (might not inside a container)" >&2
# expected to have run ${SUDO_CMD} apt-get install mesa-utils
glxinfo >&2 || true
glxinfo | grep OpenGL >&2 || true
echo "~~~~~~~~~~~~~~~~~~~"
echo ""; echo "~~~~~ Check using lshw" >&2
${SUDO_CMD} lshw -C display >&2 || true
${SUDO_CMD} lshw -numeric -C display >&2 || true
${SUDO_CMD} lshw -c video | grep configuration || true
echo "~~~~~~~~~~~~~~~~~~~" >&2
echo ""; echo "~~~~~ Check using lspci" >&2
${SUDO_CMD} lspci -v -s "$(lspci | grep ' VGA ' | cut -d" " -f 1)" >&2 || true
${SUDO_CMD} lspci -vnn | grep VGA -A 12 >&2 || true
echo "~~~~~~~~~~~~~~~~~~~" >&2
${SUDO_CMD} lspci | grep -i nvidia >&2 || true
echo "~~~~~~~~~~~~~~~~~~~" >&2
echo ""; echo "~~~~~ Check using nvidia-smi (should be part of the container runtime)" >&2
which -v nvidia-smi || true
whereis nvidia-smi || true
nvidia-smi -q || true
echo "~~~~~~~~~~~~~~~~~~~" >&2
echo ""; echo "~~~~~ Check using clinfo" >&2
# expected to have run ${SUDO_CMD} apt-get install clinfo
clinfo >&2 || true
echo "~~~~~~~~~~~~~~~~~~~" >&2
echo ""; echo "~~~~~ Check using glxgears (might not work inside a container)" >&2
glxgears >&2 || true
echo "~~~~~~~~~~~~~~~~~~~" >&2
echo ""; echo "~~~~~ Check using glmark2 (might not inside a container)" >&2
# expected to have run ${SUDO_CMD} apt-get install glmark2
glmark2 >&2 || true
echo "~~~~~~~~~~~~~~~~~~~" >&2
echo ""; echo "~~~~~ Examining your environment variables" >&2
env | grep -i nvidia >&2 || true