Skip to content

Commit 9aa5029

Browse files
committed
[SYCL] Fix windows OpenCL CPU RT install script
- Allow to run out of directory where it is located; - Fix version check and diagnostics; - Update GetStarted.md to fix naming and highlight TBB installation on windows.
1 parent 282289b commit 9aa5029

File tree

2 files changed

+50
-36
lines changed

2 files changed

+50
-36
lines changed

sycl/doc/GetStartedGuide.md

Lines changed: 26 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -161,16 +161,18 @@ which contains all the symbols required.
161161
To run DPC++ applications on OpenCL devices, OpenCL implementation(s) must be
162162
present in the system.
163163

164-
The `GPU` and `CPU` runtimes as well as TBB runtime which are needed to run
165-
DPC++ application on Intel `GPU` or Intel `CPU` devices can be downloaded using
166-
links in [the dependency configuration file](../../buildbot/dependency.conf)
167-
and installed following the instructions below. The same versions are used in PR testing.
168-
169-
Intel `CPU` runtime for OpenCL devices can be switched into Intel FPGA
170-
Emulation device for OpenCL. The following parameter should be set in `cl.cfg`
171-
file (available in directory containing CPU runtime for OpenCL) or environment
172-
variable with the same name. The following value should be set to switch OpenCL device
173-
mode:
164+
The OpenCL RT for `GPU`, OpenCL RT for `CPU` and TBB runtime which are needed
165+
to run DPC++ application on Intel `GPU` or Intel `CPU` devices can be
166+
downloaded using links in
167+
[the dependency configuration file](../../buildbot/dependency.conf)
168+
and installed following the instructions below. The same versions are used in
169+
PR testing.
170+
171+
Intel OpenCL RT for `CPU` devices can be switched into OpenCL runtime for
172+
Intel FPGA Emulation. The following parameter should be set in `cl.cfg` file
173+
(available in directory containing CPU runtime for OpenCL) or environment
174+
variable with the same name. The following value should be set to switch
175+
OpenCL device mode:
174176

175177
```bash
176178
CL_CONFIG_DEVICES = fpga-emu
@@ -226,18 +228,25 @@ folder:
226228

227229
**Windows (64-bit)**:
228230

229-
1) If you need `GPU` as well, then update/install it first. Do it **before**
230-
installing `CPU` runtime as `GPU` runtime installer may re-write some important
231-
files or settings and make existing `CPU` runtime not working properly.
231+
1) If you need OpenCL runtime for Intel `GPU` as well, then update/install it
232+
first. Do it **before** installing OpenCL runtime for Intel `CPU` runtime as
233+
OpenCL runtime for Intel `GPU` installer may re-write some important
234+
files or settings and make existing OpenCL runtime for Intel `CPU` runtime
235+
not working properly.
236+
237+
2) Extract the archive with OpenCL runtime for Intel `CPU` using links in
238+
[the dependency configuration file](../../buildbot/dependency.conf). For
239+
example, to `c:\oclcpu_rt_<cpu_version>`.
232240

233-
2) Extract the archive to some folder. For example, to
234-
`c:\oclcpu_rt_<cpu_version>` and `c:\tbb_<tbb_version>`.
241+
3) Extract the archive with TBB runtime using links in
242+
[the dependency configuration file](../../buildbot/dependency.conf). For
243+
example, to `c:\tbb_<tbb_version>`.
235244

236-
3) Run `Command Prompt` as `Administrator`. To do that click `Start` button,
245+
4) Run `Command Prompt` as `Administrator`. To do that click `Start` button,
237246
type `Command Prompt`, click the Right mouse button on it, then click
238247
`Run As Administrator`, then click `Yes` to confirm.
239248

240-
4) In the opened windows run `install.bat` provided with the extracted files
249+
5) In the opened windows run `install.bat` provided with the extracted files
241250
to install runtime to the system and setup environment variables. So, if the
242251
extracted files are in `c:\oclcpu_rt_<cpu_version>\` folder, then type the
243252
command:

sycl/tools/install.bat

Lines changed: 24 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,20 @@ echo ### 1. Save and update OpenCL.dll available in the system
77
echo ###
88
set TMP_FILE=%TEMP%\install.bat.tmp
99

10+
11+
set SYSTEM_OCL_ICD_LOADER=C:\Windows\System32\OpenCL.dll
12+
set NEW_OCL_ICD_LOADER=%OCL_RT_DIR%\OpenCL.dll
1013
set INSTALL_ERRORS=0
1114

12-
PowerShell -Command "& {(Get-Command .\OpenCL.dll).FileVersionInfo.FileVersion}" > %TMP_FILE%1
15+
PowerShell -Command "& {(Get-Command %NEW_OCL_ICD_LOADER%).FileVersionInfo.FileVersion}" > %TMP_FILE%1
1316
set /p DOWNLOADED_OPENCL_VER= < %TMP_FILE%1
14-
echo Downloaded OpenCL.dll verison: %DOWNLOADED_OPENCL_VER%
1517

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%
18+
IF EXIST %SYSTEM_OCL_ICD_LOADER% (
19+
echo %SYSTEM_OCL_ICD_LOADER% is present. Checking version.
20+
PowerShell -Command "& {(Get-Command %SYSTEM_OCL_ICD_LOADER%).FileVersionInfo.FileVersion}" > %TMP_FILE%2
21+
set /p SYSTEM_OPENCL_VER=<%TMP_FILE%2
2022

21-
PowerShell -Command "& {[version]($Env:SYSTEM_OPENCL_VER) -lt ([version]$Env:DOWNLOADED_OPENCL_VER)}" > %TMP_FILE%3
23+
PowerShell -Command "& {([version]$Env:SYSTEM_OPENCL_VER) -lt ([version]$Env:DOWNLOADED_OPENCL_VER)}" > %TMP_FILE%3
2224
set /p NEED_OPENCL_UPGRADE= < %TMP_FILE%3
2325
set /p NEED_OPENCL_BACKUP= < %TMP_FILE%3
2426
) else (
@@ -27,17 +29,20 @@ IF EXIST C:\Windows\System32\OpenCL.dll (
2729
set NEED_OPENCL_BACKUP=False
2830
)
2931

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 Downloaded OpenCL.dll version: %DOWNLOADED_OPENCL_VER%
33+
echo System OpenCL.dll version: %SYSTEM_OPENCL_VER%
34+
35+
echo Need to backup %SYSTEM_OCL_ICD_LOADER% : %NEED_OPENCL_BACKUP%
36+
echo Need to update %SYSTEM_OCL_ICD_LOADER% : %NEED_OPENCL_UPGRADE%
3237
echo.
3338

3439
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%
40+
echo Save system OpenCL.dll: %SYSTEM_OCL_ICD_LOADER% to %SYSTEM_OCL_ICD_LOADER%.%SYSTEM_OPENCL_VER%
41+
copy /Y %SYSTEM_OCL_ICD_LOADER% %SYSTEM_OCL_ICD_LOADER%.%SYSTEM_OPENCL_VER%
3742
IF ERRORLEVEL 1 (
3843
echo !!! Cannot save the original file C:\Windows\System32\OpenCL.dll
3944
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%
45+
echo !!! %SYSTEM_OCL_ICD_LOADER% to %SYSTEM_OCL_ICD_LOADER%.%SYSTEM_OPENCL_VER%
4146
echo !!! Or run this script as Administrator.
4247
set INSTALL_ERRORS=1
4348
) ELSE (
@@ -47,17 +52,17 @@ IF %NEED_OPENCL_BACKUP% == True (
4752
)
4853

4954
IF %NEED_OPENCL_UPGRADE% == True (
50-
echo Replace C:\Windows\System32\OpenCL.dll with the new downloaded OpenCL.dll
55+
echo Replace %SYSTEM_OCL_ICD_LOADER% with the new downloaded %NEW_OCL_ICD_LOADER%
5156

5257
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; }"
58+
PowerShell -Command "& {$acl = Get-Acl %SYSTEM_OCL_ICD_LOADER%; $AccessRule = New-Object System.Security.AccessControl.FileSystemAccessRule(\"Users\",\"FullControl\",\"Allow\"); $acl.SetAccessRule($AccessRule); $acl | Set-Acl %SYSTEM_OCL_ICD_LOADER%; }"
5459

5560

56-
copy /Y %OCL_RT_DIR%OpenCL.dll C:\Windows\System32\
61+
copy /Y %NEW_OCL_ICD_LOADER% %SYSTEM_OCL_ICD_LOADER%
5762
IF ERRORLEVEL 1 (
58-
echo !!! Cannot copy new OpenCL.dll to C:\Windows\System32\OpenCL.dll
63+
echo !!! Cannot copy %NEW_OCL_ICD_LOADER% to %SYSTEM_OCL_ICD_LOADER%
5964
echo !!! Try copying the file manually using File Explorer:
60-
echo !!! %OCL_RT_DIR%OpenCL.dll to C:\Windows\System32\
65+
echo !!! %NEW_OCL_ICD_LOADER% to %SYSTEM_OCL_ICD_LOADER%
6166
echo !!! Or run this script as Administrator.
6267
set INSTALL_ERRORS=1
6368
) ELSE (
@@ -130,8 +135,8 @@ echo.
130135
IF %INSTALL_ERRORS% == 1 (
131136
echo Installation finished WITH ERRORS!
132137
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
138+
echo 1. Save %SYSTEM_OCL_ICD_LOADER% to %SYSTEM_OCL_ICD_LOADER%.%SYSTEM_OPENCL_VER%
139+
echo 2. Copy %NEW_OCL_ICD_LOADER% to %SYSTEM_OCL_ICD_LOADER%
135140
echo 3. Add/set the environment variable OCL_ICD_FILENAMES to %OCL_RT_DIR%intelocl64.dll
136141
echo 4. Copy TBB libraries or create symbolic links in %OCL_RT_DIR%tbb.
137142
echo 5. Add/set the environment variable PATH to %OCL_RT_DIR%tbb

0 commit comments

Comments
 (0)