Skip to content

Commit 4c57d4d

Browse files
authored
[NFC] Update OpenCL installation process (#2201)
This version supports side-by-side installation of OpenCL RT for Intel CPU and OpenCL RT for Intel FPGA emulation.
1 parent 215f591 commit 4c57d4d

File tree

2 files changed

+69
-23
lines changed

2 files changed

+69
-23
lines changed

sycl/doc/GetStartedGuide.md

Lines changed: 37 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -166,37 +166,37 @@ To run DPC++ applications on Level Zero devices, Level Zero implementation(s)
166166
must be present in the system. You can find the link to the Level Zero spec in
167167
the following section [Find More](#find-more).
168168

169-
The Level Zero RT for `GPU`, OpenCL RT for `GPU`, OpenCL RT for `CPU` and TBB runtime
170-
which are needed to run DPC++ application on Intel `GPU` or Intel `CPU` devices can be
171-
downloaded using links in
169+
The Level Zero RT for `GPU`, OpenCL RT for `GPU`, OpenCL RT for `CPU`, FPGA
170+
emulation RT and TBB runtime which are needed to run DPC++ application
171+
on Intel `GPU` or Intel `CPU` devices can be downloaded using links in
172172
[the dependency configuration file](../../buildbot/dependency.conf)
173173
and installed following the instructions below. The same versions are used in
174174
PR testing.
175175

176-
Intel OpenCL RT for `CPU` devices can be switched into OpenCL runtime for
177-
Intel FPGA Emulation. The following parameter should be set in `cl.cfg` file
178-
(available in directory containing CPU runtime for OpenCL) or environment
179-
variable with the same name. The following value should be set to switch
180-
OpenCL device mode:
181-
182-
```bash
183-
CL_CONFIG_DEVICES = fpga-emu
184-
```
185-
186176
**Linux**:
187177

188-
1) Extract the archive. For example, for the archive
189-
`oclcpu_rt_<cpu_version>.tar.gz` you would run the following commands
178+
1) Extract the archive. For example, for the archives
179+
`oclcpuexp_<cpu_version>.tar.gz` and `fpgaemu_<fpga_version>.tar.gz` you would
180+
run the following commands
190181

191182
```bash
183+
# Extract OpenCL FPGA emulation RT
184+
mkdir -p /opt/intel/oclfpgaemu_<fpga_version>
185+
cd /opt/intel/oclfpgaemu_<fpga_version>
186+
tar zxvf fpgaemu_<fpga_version>.tar.gz
187+
# Extract OpenCL CPU RT
192188
mkdir -p /opt/intel/oclcpuexp_<cpu_version>
193189
cd /opt/intel/oclcpuexp_<cpu_version>
194190
tar -zxvf oclcpu_rt_<cpu_version>.tar.gz
195191
```
196192

197-
2) Create ICD file pointing to the new runtime
193+
2) Create ICD file pointing to the new runtime (requires root access)
198194

199195
```bash
196+
# OpenCL FPGA emulation RT
197+
echo /opt/intel/oclfpgaemu_<fpga_version>/x64/libintelocl_emu.so >
198+
/etc/OpenCL/vendors/intel_fpgaemu.icd
199+
# OpenCL CPU RT
200200
echo /opt/intel/oclcpuexp_<cpu_version>/x64/libintelocl.so >
201201
/etc/OpenCL/vendors/intel_expcpu.icd
202202
```
@@ -213,6 +213,16 @@ CL_CONFIG_DEVICES = fpga-emu
213213
folder:
214214

215215
```bash
216+
# OpenCL FPGA emulation RT
217+
ln -s /opt/intel/tbb_<tbb_version>/tbb/lib/intel64/gcc4.8/libtbb.so
218+
/opt/intel/oclfpgaemu_<fpga_version>/x64
219+
ln -s /opt/intel/tbb_<tbb_version>/tbb/lib/intel64/gcc4.8/libtbbmalloc.so
220+
/opt/intel/oclfpgaemu_<fpga_version>/x64
221+
ln -s /opt/intel/tbb_<tbb_version>/tbb/lib/intel64/gcc4.8/libtbb.so.2
222+
/opt/intel/oclfpgaemu_<fpga_version>/x64
223+
ln -s /opt/intel/tbb_<tbb_version>/tbb/lib/intel64/gcc4.8/libtbbmalloc.so.2
224+
/opt/intel/oclfpgaemu_<fpga_version>/x64
225+
# OpenCL CPU RT
216226
ln -s /opt/intel/tbb_<tbb_version>/tbb/lib/intel64/gcc4.8/libtbb.so
217227
/opt/intel/oclcpuexp_<cpu_version>/x64
218228
ln -s /opt/intel/tbb_<tbb_version>/tbb/lib/intel64/gcc4.8/libtbbmalloc.so
@@ -223,10 +233,12 @@ folder:
223233
/opt/intel/oclcpuexp_<cpu_version>/x64
224234
```
225235

226-
5) Configure library paths
236+
5) Configure library paths (requires root access)
227237

228238
```bash
229-
echo /opt/intel/oclcpuexp_<cpu_version>/x64 >
239+
echo /opt/intel/oclfpgaemu_<fpga_version>/x64 >
240+
/etc/ld.so.conf.d/libintelopenclexp.conf
241+
echo /opt/intel/oclcpuexp_<cpu_version>/x64 >>
230242
/etc/ld.so.conf.d/libintelopenclexp.conf
231243
ldconfig -f /etc/ld.so.conf.d/libintelopenclexp.conf
232244
```
@@ -239,7 +251,8 @@ OpenCL runtime for Intel `GPU` installer may re-write some important
239251
files or settings and make existing OpenCL runtime for Intel `CPU` runtime
240252
not working properly.
241253

242-
2) Extract the archive with OpenCL runtime for Intel `CPU` using links in
254+
2) Extract the archive with OpenCL runtime for Intel `CPU` and/or for Intel
255+
`FPGA` emulation using links in
243256
[the dependency configuration file](../../buildbot/dependency.conf). For
244257
example, to `c:\oclcpu_rt_<cpu_version>`.
245258

@@ -257,6 +270,11 @@ extracted files are in `c:\oclcpu_rt_<cpu_version>\` folder, then type the
257270
command:
258271
259272
```bash
273+
# Install OpenCL FPGA emulation RT
274+
# Answer N to clean previous OCL_ICD_FILENAMES configuration
275+
c:\oclfpga_rt_<fpga_version>\install.bat c:\tbb_<tbb_version>\tbb\bin\intel64\vc14
276+
# Install OpenCL CPU RT
277+
# Answer Y to setup CPU RT side-bi-side with FPGA RT
260278
c:\oclcpu_rt_<cpu_version>\install.bat c:\tbb_<tbb_version>\tbb\bin\intel64\vc14
261279
```
262280

sycl/tools/install.bat

Lines changed: 32 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,38 @@
11
@echo off
2-
2+
setlocal EnableDelayedExpansion
33
set OCL_RT_DIR=%~dp0
44

55
echo ###
66
echo ### 1. Save and update OpenCL.dll available in the system
77
echo ###
88
set TMP_FILE=%TEMP%\install.bat.tmp
99

10+
set OCL_RT_ENTRY_LIB=%OCL_RT_DIR%intelocl64.dll
11+
IF NOT EXIST %OCL_RT_ENTRY_LIB% (
12+
set OCL_RT_ENTRY_LIB=%OCL_RT_DIR%intelocl64_emu.dll
13+
)
14+
15+
IF "%OCL_ICD_FILENAMES%" == "" (
16+
set EXTENDEXISTING=N
17+
) else (
18+
echo OCL_ICD_FILENAMES is present and contains %OCL_ICD_FILENAMES%
19+
:USERINPUT
20+
set /P "EXTENDEXISTING=Should the OpenCL RT extend existing configuration (Y/N): "
21+
)
22+
IF "%EXTENDEXISTING%" == "N" (
23+
echo Clean up previous configuration
24+
set OCL_ICD_FILENAMES=%OCL_RT_ENTRY_LIB%
25+
) else (
26+
IF "%EXTENDEXISTING%" == "Y" (
27+
28+
set OCL_ICD_FILENAMES=%OCL_ICD_FILENAMES%;%OCL_RT_ENTRY_LIB%
29+
echo Extend previous configuration to %OCL_ICD_FILENAMES%;%OCL_RT_ENTRY_LIB%
30+
) else (
31+
echo WARNING: Incorrect input %EXTENDEXISTING%. Only Y and N are allowed.
32+
goto USERINPUT
33+
)
34+
)
35+
1036

1137
set SYSTEM_OCL_ICD_LOADER=C:\Windows\System32\OpenCL.dll
1238
set NEW_OCL_ICD_LOADER=%OCL_RT_DIR%\OpenCL.dll
@@ -73,11 +99,13 @@ IF %NEED_OPENCL_UPGRADE% == True (
7399
echo System OpenCL.dll is already new, no need to upgrade it.
74100
)
75101

102+
103+
76104
echo.
77105
echo ###
78106
echo ### 3. Set the environment variable OCL_ICD_FILENAMES to %OCL_ICD_FILENAMES%
79107
echo ###
80-
REG ADD "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment" /v OCL_ICD_FILENAMES /d "%OCL_ICD_FILENAMES%"
108+
REG ADD "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment" /f /v OCL_ICD_FILENAMES /d "%OCL_ICD_FILENAMES%"
81109
IF ERRORLEVEL 1 (
82110
echo !!! Cannot set the environment variable OCL_ICD_FILENAMES
83111
set INSTALL_ERRORS=1
@@ -137,7 +165,7 @@ IF %INSTALL_ERRORS% == 1 (
137165
echo See recommendations printed above and perform the following actions manually:
138166
echo 1. Save %SYSTEM_OCL_ICD_LOADER% to %SYSTEM_OCL_ICD_LOADER%.%SYSTEM_OPENCL_VER%
139167
echo 2. Copy %NEW_OCL_ICD_LOADER% to %SYSTEM_OCL_ICD_LOADER%
140-
echo 3. Add/set the environment variable OCL_ICD_FILENAMES to %OCL_RT_DIR%intelocl64.dll
168+
echo 3. Add/set the environment variable OCL_ICD_FILENAMES to %OCL_RT_ENTRY_LIB%
141169
echo 4. Copy TBB libraries or create symbolic links in %OCL_RT_DIR%tbb.
142170
echo 5. Add/set the environment variable PATH to %OCL_RT_DIR%tbb
143171
echo Or try running this batch file as Administrator.
@@ -147,5 +175,5 @@ IF %INSTALL_ERRORS% == 1 (
147175
echo.
148176

149177
endlocal& ^
150-
set OCL_ICD_FILENAMES=%OCL_RT_DIR%intelocl64.dll
178+
set OCL_ICD_FILENAMES=%OCL_ICD_FILENAMES%
151179
set "PATH=%PATH%;%OCL_RT_DIR%\tbb"

0 commit comments

Comments
 (0)