Skip to content

Commit 810312b

Browse files
authored
[SYCL] Update installation of TBB libraries.
It is expected that TBB libraries are moved out of Intel experimental runtime for OpenCL and should be installaed from github.com/intel/tbb. Installation procedure and script are changed. Signed-off-by: Vladimir Lazarev <[email protected]>
1 parent dba1c20 commit 810312b

File tree

2 files changed

+174
-3
lines changed

2 files changed

+174
-3
lines changed

sycl/doc/GetStartedWithSYCLCompiler.md

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,11 @@ asset/archive should be downloaded from
133133
[SYCL Compiler and Runtime updates](../ReleaseNotes.md) and installed using
134134
the following procedure.
135135

136+
Intel `CPU` runtime for OpenCL depends on Threading Building Blocks library
137+
which should be downloaded from [Threading Building Blocks (TBB)
138+
GitHub repository](https://github.com/intel/tbb) and installed following
139+
procedure below.
140+
136141
**Linux**
137142

138143
1) Extract the archive. For example, for the archive
@@ -146,7 +151,23 @@ tar -zxvf oclcpu_rt_<new_version>.tar.gz
146151
```bash
147152
echo /opt/intel/oclcpuexp/x64/libintelocl.so > /etc/OpenCL/vendors/intel_expcpu.icd
148153
```
149-
3) Configure library paths
154+
155+
3) Extract TBB libraries. For example, for the archive tbb2019_<version>oss_lin.tgz
156+
157+
```bash
158+
mkdir -p /opt/intel/tbb
159+
cd /opt/intel/tbb
160+
tar -zxvf tbb2019_<version>oss_lin.tgz
161+
```
162+
163+
4) Copy files from or create symbolic links to TBB libraries in OpenCL RT folder:
164+
```bash
165+
ln -s /opt/intel/tbb/lib/intel64/gcc4.8/libtbb.so /opt/intel/oclcpuexp/x64/libtbb.so
166+
ln -s /opt/intel/tbb/lib/intel64/gcc4.8/libtbbmalloc.so
167+
/opt/intel/oclcpuexp/x64/libtbbmalloc.so
168+
```
169+
170+
5) Configure library paths
150171
```bash
151172
echo /opt/intel/oclcpuexp/x64 > /etc/ld.so.conf.d/libintelopenclexp.conf
152173
ldconfig -f /etc/ld.so.conf.d/libintelopenclexp.conf
@@ -156,7 +177,8 @@ ldconfig -f /etc/ld.so.conf.d/libintelopenclexp.conf
156177
installing `CPU` runtime as `GPU` runtime installer may re-write some important
157178
files or settings and make existing `CPU` runtime not working properly.
158179

159-
2) Extract the archive to some folder. For example, to `c:\oclcpu_rt_<new_version>`.
180+
2) Extract the archive to some folder. For example, to `c:\oclcpu_rt_<new_version>`
181+
and `c:\tbb2019_<version>oss`.
160182

161183
3) Run `Command Prompt` as `Administrator`. To do that click `Start` button,
162184
type `Command Prompt`, click the Right mouse button on it, then click
@@ -165,7 +187,10 @@ type `Command Prompt`, click the Right mouse button on it, then click
165187
4) In the opened windows run `install.bat` provided with the extracted files
166188
to install runtime to the system and setup environment variables. So, if the
167189
extracted files are in `c:\oclcpu_rt_<new_version>\` folder, then type the
168-
command: `c:\oclcpu_rt_<new_version>\install.bat`
190+
command:
191+
```bash
192+
c:\oclcpu_rt_<new_version>\install.bat c:\tbb2019_<version>oss\bin\intel64\vc14
193+
```
169194

170195
## Test SYCL toolchain
171196

sycl/tools/install.bat

Lines changed: 146 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,146 @@
1+
@echo off
2+
3+
set OCL_RT_DIR=%~dp0
4+
5+
echo ###
6+
echo ### 1. Save and update OpenCL.dll available in the system
7+
echo ###
8+
set TMP_FILE=%TEMP%\install.bat.tmp
9+
10+
set INSTALL_ERRORS=0
11+
12+
PowerShell -Command "& {(Get-Command .\OpenCL.dll).FileVersionInfo.FileVersion}" > %TMP_FILE%1
13+
set /p DOWNLOADED_OPENCL_VER= < %TMP_FILE%1
14+
echo Downloaded OpenCL.dll verison: %DOWNLOADED_OPENCL_VER%
15+
16+
IF EXIST C:\Windows\System32\OpenCL.dll (
17+
PowerShell -Command "& {(Get-Command C:\Windows\System32\OpenCL.dll).FileVersionInfo.FileVersion}" > %TMP_FILE%2
18+
set /p SYSTEM_OPENCL_VER= < %TMP_FILE%2
19+
echo System OpenCL.dll version: %SYSTEM_OPENCL_VER%
20+
21+
PowerShell -Command "& {[version]($Env:SYSTEM_OPENCL_VER) -lt ([version]$Env:DOWNLOADED_OPENCL_VER)}" > %TMP_FILE%3
22+
set /p NEED_OPENCL_UPGRADE= < %TMP_FILE%3
23+
set /p NEED_OPENCL_BACKUP= < %TMP_FILE%3
24+
) else (
25+
echo System OpenCL.dll does not exist.
26+
set NEED_OPENCL_UPGRADE=True
27+
set NEED_OPENCL_BACKUP=False
28+
)
29+
30+
echo Need to backup C:\Windows\System32\OpenCL.dll : %NEED_OPENCL_BACKUP%
31+
echo Need to update C:\Windows\System32\OpenCL.dll : %NEED_OPENCL_UPGRADE%
32+
echo.
33+
34+
IF %NEED_OPENCL_BACKUP% == True (
35+
echo Save system OpenCL.dll: C:\Windows\System32\OpenCL.dll to C:\Windows\System32\OpenCL.dll.%SYSTEM_OPENCL_VER%
36+
copy /Y C:\Windows\System32\OpenCL.dll C:\Windows\System32\OpenCL.dll.%SYSTEM_OPENCL_VER%
37+
IF ERRORLEVEL 1 (
38+
echo !!! Cannot save the original file C:\Windows\System32\OpenCL.dll
39+
echo !!! Try saving the file manually using File Explorer:
40+
echo !!! C:\Windows\System32\OpenCL.dll to C:\Windows\System32\OpenCL.dll.%SYSTEM_OPENCL_VER%
41+
echo !!! Or run this script as Administrator.
42+
set INSTALL_ERRORS=1
43+
) ELSE (
44+
echo Copy done.
45+
)
46+
echo.
47+
)
48+
49+
IF %NEED_OPENCL_UPGRADE% == True (
50+
echo Replace C:\Windows\System32\OpenCL.dll with the new downloaded OpenCL.dll
51+
52+
rem CHANGE THE FILE ATTRIBUTES. OTHERWISE, IT CANNOT BE REPLACED by regular MOVE, DEL, COPY commands.
53+
PowerShell -Command "& {$acl = Get-Acl C:\Windows\System32\OpenCL.dll; $AccessRule = New-Object System.Security.AccessControl.FileSystemAccessRule(\"Users\",\"FullControl\",\"Allow\"); $acl.SetAccessRule($AccessRule); $acl | Set-Acl c:\Windows\System32\OpenCL.dll; }"
54+
55+
56+
copy /Y %OCL_RT_DIR%OpenCL.dll C:\Windows\System32\
57+
IF ERRORLEVEL 1 (
58+
echo !!! Cannot copy new OpenCL.dll to C:\Windows\System32\OpenCL.dll
59+
echo !!! Try copying the file manually using File Explorer:
60+
echo !!! %OCL_RT_DIR%OpenCL.dll to C:\Windows\System32\
61+
echo !!! Or run this script as Administrator.
62+
set INSTALL_ERRORS=1
63+
) ELSE (
64+
echo Copy done.
65+
)
66+
echo.
67+
) ELSE (
68+
echo System OpenCL.dll is already new, no need to upgrade it.
69+
)
70+
71+
echo.
72+
echo ###
73+
echo ### 3. Set the environment variable OCL_ICD_FILENAMES to %OCL_ICD_FILENAMES%
74+
echo ###
75+
REG ADD "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment" /v OCL_ICD_FILENAMES /d "%OCL_ICD_FILENAMES%"
76+
IF ERRORLEVEL 1 (
77+
echo !!! Cannot set the environment variable OCL_ICD_FILENAMES
78+
set INSTALL_ERRORS=1
79+
)
80+
81+
echo.
82+
echo ###
83+
echo ### 4. Create symbolink links to TBB files in %OCL_RT_DIR%tbb
84+
echo ###
85+
if "%1" == "" (
86+
echo No TBB libraries path is specified
87+
echo Create symbolic link or copy tbb.dll and tbbmalloc.tbb to %OCL_RT_DIR%tbb\ after installation
88+
) else (
89+
IF EXIST %OCL_RT_DIR%tbb (
90+
rmdir %OCL_RT_DIR%tbb
91+
)
92+
mkdir %OCL_RT_DIR%tbb
93+
IF ERRORLEVEL 1 (
94+
echo !!! Cannot create mkdir %OCL_RT_DIR%tbb
95+
set INSTALL_ERRORS=1
96+
)
97+
echo on
98+
mklink %OCL_RT_DIR%tbb\tbbmalloc.dll %1\tbbmalloc.dll
99+
IF ERRORLEVEL 1 (
100+
echo !!! Cannot create symbolic link for tbbmalloc.dll
101+
set INSTALL_ERRORS=1
102+
)
103+
mklink %OCL_RT_DIR%tbb\tbb.dll %1\tbb.dll
104+
IF ERRORLEVEL 1 (
105+
echo !!! Cannot create symbolic link for tbb.dll
106+
set INSTALL_ERRORS=1
107+
)
108+
echo off
109+
)
110+
111+
echo.
112+
echo ###
113+
echo ### 5. Set the environment variable PATH to %OCL_RT_DIR%tbb
114+
echo ###
115+
PowerShell -Command "& { [Environment]::SetEnvironmentVariable(\"Path\", $env:Path + \";%OCL_RT_DIR%tbb\", [EnvironmentVariableTarget]::Machine) }"
116+
117+
IF ERRORLEVEL 1 (
118+
echo !!! Cannot set the environment variable PATH
119+
set INSTALL_ERRORS=1
120+
)
121+
122+
IF ERRORLEVEL 1 (
123+
echo !!! Cannot set the environment variable PATH
124+
set INSTALL_ERRORS=1
125+
)
126+
127+
del %TMP_FILE%*
128+
129+
echo.
130+
IF %INSTALL_ERRORS% == 1 (
131+
echo Installation finished WITH ERRORS!
132+
echo See recommendations printed above and perform the following actions manually:
133+
echo 1. Save C:\Windows\System32\OpenCL.dll to C:\Windows\System32\OpenCL.dll.%SYSTEM_OPENCL_VER%
134+
echo 2. Copy %OCL_RT_DIR%OpenCL.dll to C:\Windows\System32\OpenCL.dll
135+
echo 3. Add/set the environment variable OCL_ICD_FILENAMES to %OCL_RT_DIR%intelocl64.dll
136+
echo 4. Copy TBB libraries or create symbolic links in %OCL_RT_DIR%tbb.
137+
echo 5. Add/set the environment variable PATH to %OCL_RT_DIR%tbb
138+
echo Or try running this batch file as Administrator.
139+
) else (
140+
echo Installation Done SUCCESSFULLY.
141+
)
142+
echo.
143+
144+
endlocal& ^
145+
set OCL_ICD_FILENAMES=%OCL_RT_DIR%intelocl64.dll
146+
set "PATH=%PATH%;%OCL_RT_DIR%\tbb"

0 commit comments

Comments
 (0)