-
Notifications
You must be signed in to change notification settings - Fork 2
/
xpu_verify.sh
executable file
·196 lines (177 loc) · 6.19 KB
/
xpu_verify.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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
#!/bin/bash
remove_local_repo() {
echo "remove local repo"
echo "==================================================="
./fixes/remove_local_repo.sh
echo ""
}
check_fix_scaling_governer() {
echo "check and fix scaling governor"
echo "==================================================="
./fixes/check_fix_scaling_governor.sh
echo ""
}
fix_set_render_group() {
echo "check if user in render group and fix if not"
echo "==================================================="
./fixes/check_set_render_group.sh
echo ""
}
install_intel_basekit() {
echo "check if intel basekit is installed and fix if not"
echo "==================================================="
./install/intel_basekit.sh
echo ""
}
install_miniconda_and_envs() {
echo "check if miniconda and environments are installed and fix if not"
echo "==================================================="
./install/miniconda_and_envs.sh
echo ""
}
install_pytorch_xpu() {
echo "check if pytorch-xpu is installed and fix if not"
echo "==================================================="
./install/pytorch_xpu.sh
echo ""
}
install_tensorflow_xpu() {
echo "check if tensorflow-xpu is installed and fix if not"
echo "==================================================="
./install/tensorflow_xpu.sh
echo ""
}
install_openvino_xpu() {
echo "check if openvino is installed and fix if not"
echo "==================================================="
./install/openvino_xpu.sh
echo ""
}
install_ai_xpu() {
install_openvino_xpu
install_pytorch_xpu
install_tensorflow_xpu
}
check_all() {
all_tests_passed=true
check_functions=(
"./check_os_kernel.sh"
"./check_scaling_governor.sh"
"./check_device.sh"
"./check_compute_drivers.sh"
"./check_render_group.sh"
"./check_intel_basekit.sh"
"./syclls.sh --force"
"./check_sycl.sh"
"./check_pytorch.sh"
"./check_tensorflow.sh"
)
check_names=(
"check OS and kernel version"
"check scaling governor"
"check kernel and i915 config"
"check for compute drivers"
"check if user in render group"
"check if Intel Basekit is installed"
"check if syclls can list the GPU devices"
"compile and execute SYCL programs on the device"
"check if PyTorch can see the GPU (XPU) device"
"check if TensorFlow can see the GPU (XPU) device"
)
for index in "${!check_functions[@]}"; do
check_function=${check_functions[index]}
check_name=${check_names[index]}
echo "Running ${check_name}"
echo "==================================================="
${check_function}
result=$?
echo "result of $check_name test is: $result"
if [ ${result} -ne 0 ] && [ "$check_name" != "check for compute drivers" ]; then
all_tests_passed=false
elif [ ${result} -ne 0 ] && [ "$check_name" == "check for compute drivers" ]; then
missing_runtime_drivers=$(./check_compute_drivers.sh | grep "The following required drivers are missing")
if [ -z "$missing_runtime_drivers" ]; then
all_tests_passed=true
else
all_tests_passed=false
fi
fi
done
if $all_tests_passed; then
echo "All checks ran successfully."
else
echo "Some checks have failed. Please review the output for more information."
fi
}
# check and fix options
while getopts "cfpi:" opt; do
case "$opt" in
c)
check_all
exit 0
;;
f)
fix_set_render_group
check_fix_scaling_governer
remove_local_repo
./check_intel_basekit.sh
intel_basekit_status=$?
if [ $intel_basekit_status -eq 0 ]; then
echo ""
else
echo "intel-basekit is not installed, installing..."
install_intel_basekit
fi
exit 0
;;
p)
check_all
fix_set_render_group
check_fix_scaling_governer
remove_local_repo
./check_intel_basekit.sh
intel_basekit_status=$?
if [ $intel_basekit_status -eq 0 ]; then
echo ""
else
echo "intel-basekit is not installed, installing..."
install_intel_basekit
fi
exit 0
;;
i)
IFS=',' read -ra INSTALL_OPTS <<< "$OPTARG"
for i in "${INSTALL_OPTS[@]}"; do
./check_os_kernel.sh
os_kernel_check_status=$?
./check_compute_drivers.sh
compute_drivers_check_status=$?
./check_intel_basekit.sh
intel_basekit_check_status=$?
install_miniconda_and_envs
if [ $os_kernel_check_status -eq 0 ] && [ $compute_drivers_check_status -eq 0 ] && [ $intel_basekit_check_status -eq 0 ]; then
case "$i" in
openvino_xpu) install_miniconda_and_envs && install_openvino_xpu ;;
pytorch_xpu) install_miniconda_and_envs && install_pytorch_xpu ;;
tensorflow_xpu) install_miniconda_and_envs && install_tensorflow_xpu ;;
ai_xpu) install_ai_xpu ;;
*) echo "Invalid installation option: $i" ;;
esac
else
echo "Please use '-c' with the script to ensure that the system has the correct OS kernel, compute drivers, and Intel basekit installed before installing XPU libraries."
fi
done
exit 0
;;
*)
echo "Invalid option: -$OPTARG" >&2
exit 1
;;
esac
done
echo "Usage: ./check_all.sh [-c] [-f] [-p] [-i library1,library2,...]"
echo "-c: check if the system is setup correctly"
echo "-f: fix and augment with essential tools and libs"
echo "-p: check and fix"
echo "-i: install specified AI packages with XPU support (openvino_xpu, pytorch_xpu, tensorflow_xpu, ai_xpu)"
exit 1