Skip to content

Commit 8591036

Browse files
authored
[CI] Improve driver management (#5680)
Refactor scripts to be more re-usable.
1 parent 977f22d commit 8591036

File tree

2 files changed

+126
-44
lines changed

2 files changed

+126
-44
lines changed

devops/containers/ubuntu2004_intel_drivers.Dockerfile

+3-44
Original file line numberDiff line numberDiff line change
@@ -15,52 +15,11 @@ ARG cpu_tag=latest
1515
RUN apt update && apt install -yqq wget
1616

1717
COPY scripts/get_release.py /
18-
19-
# Install IGC, CM and NEO
20-
RUN python3 /get_release.py intel/intel-graphics-compiler $igc_tag \
21-
| grep ".*deb" \
22-
| wget -qi - && \
23-
python3 /get_release.py intel/compute-runtime $compute_runtime_tag \
24-
| grep -E ".*((deb)|(sum))" \
25-
| wget -qi - && \
26-
sha256sum -c *.sum &&\
27-
python3 /get_release.py intel/cm-compiler $cm_tag \
28-
| grep ".*deb" \
29-
| wget -qi - && \
30-
dpkg -i *.deb && rm *.deb *.sum
18+
COPY scripts/install_drivers.sh /
3119

3220
RUN mkdir /runtimes
33-
34-
# Install TBB
35-
RUN cd /runtimes && \
36-
python3 /get_release.py oneapi-src/onetbb $tbb_tag \
37-
| grep -E ".*-lin.tgz" \
38-
| wget -qi - && \
39-
tar -xf *.tgz && rm *.tgz && mv oneapi-tbb-* oneapi-tbb
40-
41-
# Install Intel FPGA Emulator
42-
RUN cd /runtimes && \
43-
python3 /get_release.py intel/llvm $fpgaemu_tag \
44-
| grep -E ".*fpgaemu.*tar.gz" \
45-
| wget -qi - && \
46-
mkdir fpgaemu && tar -xf *.tar.gz -C fpgaemu && rm *.tar.gz && \
47-
if [ -e /runtimes/fpgaemu/install.sh ]; then \
48-
bash -x /runtimes/fpgaemu/install.sh ; \
49-
else \
50-
echo /runtimes/fpgaemu/x64/libintelocl_emu.so > /etc/OpenCL/vendors/intel_fpgaemu.icd ; \
51-
fi
52-
53-
# Install Intel OpenCL CPU Runtime
54-
RUN cd /runtimes && \
55-
python3 /get_release.py intel/llvm $cpu_tag \
56-
| grep -E ".*oclcpuexp.*tar.gz" \
57-
| wget -qi - && \
58-
mkdir oclcpu && tar -xf *.tar.gz -C oclcpu && rm *.tar.gz && \
59-
if [ -e /runtimes/oclcpu/install.sh ]; then \
60-
bash -x /runtimes/oclcpu/install.sh ; \
61-
else \
62-
echo /runtimes/oclcpu/x64/libintelocl.so > /etc/OpenCL/vendors/intel_oclcpu.icd ; \
63-
fi
21+
ENV INSTALL_LOCATION=/runtimes
22+
RUN /install_drivers.sh --all
6423

6524
COPY scripts/drivers_entrypoint.sh /drivers_entrypoint.sh
6625

devops/scripts/install_drivers.sh

+123
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
#!/bin/bash
2+
3+
CR_TAG=$compute_runtime_tag
4+
IGC_TAG=$igc_tag
5+
CM_TAG=$cm_tag
6+
TBB_TAG=$tbb_tag
7+
FPGA_TAG=$fpgaemu_tag
8+
CPU_TAG=$cpu_tag
9+
10+
TBB_INSTALLED=false
11+
12+
LOCATION=$(dirname -- "$(readlink -f "${BASH_SOURCE}")")
13+
14+
if [[ -v INSTALL_LOCATION ]]; then
15+
INSTALL_LOCATION=$(realpath "$INSTALL_LOCATION")
16+
echo "Installing to $INSTALL_LOCATION"
17+
else
18+
INSTALL_LOCATION="/opt/runtimes/"
19+
echo "Install location not specified. Installing to $INSTALL_LOCATION"
20+
fi;
21+
22+
InstallTBB () {
23+
if [ "$TBB_INSTALLED" = false ]; then
24+
cd $INSTALL_LOCATION
25+
echo "Installing TBB..."
26+
echo "TBB version $TBB_TAG"
27+
python3 $LOCATION/get_release.py oneapi-src/onetbb $TBB_TAG \
28+
| grep -E ".*-lin.tgz" \
29+
| wget -qi -
30+
tar -xf *.tgz && rm *.tgz && mv oneapi-tbb-* oneapi-tbb
31+
32+
TBB_INSTALLED=true
33+
fi
34+
}
35+
36+
InstallIGFX () {
37+
echo "Installing Intel Graphics driver..."
38+
echo "Compute Runtime version $CR_TAG"
39+
echo "IGC version $IGC_TAG"
40+
echo "CM compiler version $CM_TAG"
41+
python3 $LOCATION/get_release.py intel/intel-graphics-compiler $IGC_TAG \
42+
| grep ".*deb" \
43+
| wget -qi -
44+
python3 $LOCATION/get_release.py intel/compute-runtime $CR_TAG \
45+
| grep -E ".*((deb)|(sum))" \
46+
| wget -qi -
47+
sha256sum -c *.sum && \
48+
python3 $LOCATION/get_release.py intel/cm-compiler $CM_TAG \
49+
| grep ".*deb" \
50+
| wget -qi -
51+
dpkg -i *.deb && rm *.deb *.sum
52+
}
53+
54+
InstallCPURT () {
55+
echo "Installing Intel OpenCL CPU Runtime..."
56+
echo "CPU Runtime version $CPU_TAG"
57+
cd $INSTALL_LOCATION
58+
if [ -d "$INSTALL_LOCATION/oclcpu" ]; then
59+
echo "$INSTALL_LOCATION/oclcpu exists and will be removed!"
60+
rm -Rf $INSTALL_LOCATION/oclcpu;
61+
fi
62+
python3 $LOCATION/get_release.py intel/llvm $CPU_TAG \
63+
| grep -E ".*oclcpuexp.*tar.gz" \
64+
| wget -qi -
65+
mkdir oclcpu && tar -xf *.tar.gz -C oclcpu && rm *.tar.gz
66+
if [ -e $INSTALL_LOCATION/oclcpu/install.sh ]; then \
67+
bash -x $INSTALL_LOCATION/oclcpu/install.sh
68+
else
69+
echo $INSTALL_LOCATION/oclcpu/x64/libintelocl.so > /etc/OpenCL/vendors/intel_oclcpu.icd
70+
fi
71+
}
72+
73+
InstallFPGAEmu () {
74+
echo "Installing Intel FPGA Fast Emulator..."
75+
echo "FPGA Emulator version $FPGA_TAG"
76+
cd $INSTALL_LOCATION
77+
if [ -d "$INSTALL_LOCATION/fpgaemu" ]; then
78+
echo "$INSTALL_LOCATION/fpgaemu exists and will be removed!"
79+
rm -Rf $INSTALL_LOCATION/oclcpu;
80+
fi
81+
python3 /get_release.py intel/llvm $FPGA_TAG \
82+
| grep -E ".*fpgaemu.*tar.gz" \
83+
| wget -qi - && \
84+
mkdir fpgaemu && tar -xf *.tar.gz -C fpgaemu && rm *.tar.gz
85+
if [ -e /runtimes/fpgaemu/install.sh ]; then
86+
bash -x /runtimes/fpgaemu/install.sh
87+
else
88+
echo /runtimes/fpgaemu/x64/libintelocl_emu.so > /etc/OpenCL/vendors/intel_fpgaemu.icd
89+
fi
90+
}
91+
92+
if [[ $# -eq 0 ]] ; then
93+
echo "No options were specified. Please, specify one or more of the following:"
94+
echo "--all - Install all Intel drivers"
95+
echo "--igfx - Install Intel Graphics drivers"
96+
echo "--cpu - Install Intel CPU OpenCL runtime"
97+
echo "--fpga-emu - Install Intel FPGA Fast emulator"
98+
echo "Set INSTALL_LOCATION env variable to specify install location"
99+
exit 0
100+
fi
101+
102+
while [ "${1:-}" != "" ]; do
103+
case "$1" in
104+
"--all")
105+
InstallIGFX
106+
InstallTBB
107+
InstallCPURT
108+
InstallFPGAEmu
109+
;;
110+
"--igfx")
111+
InstallIGFX
112+
;;
113+
"--cpu")
114+
InstallTBB
115+
InstallCPURT
116+
;;
117+
"--fpga-emu")
118+
InstallTBB
119+
InstallFPGAEmu
120+
;;
121+
esac
122+
shift
123+
done

0 commit comments

Comments
 (0)