You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: sycl/doc/GetStartedWithSYCLCompiler.md
+61-24
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,8 @@
1
1
# Overview
2
2
3
-
The SYCL* Compiler compiles C++\-based SYCL source files with code for both CPU and a wide range of compute accelerators. The compiler uses Khronos* OpenCL™ API to offload computations to accelerators.
3
+
The SYCL* Compiler compiles C++\-based SYCL source files with code for both CPU
4
+
and a wide range of compute accelerators. The compiler uses Khronos*
5
+
OpenCL™ API to offload computations to accelerators.
4
6
5
7
# Before You Begin
6
8
@@ -9,31 +11,48 @@ Software requirements:
9
11
Installing OpenCL 2.1 compatible software stack:
10
12
1. OpenCL headers:
11
13
12
-
a. Download the OpenCL headers from [github.com/KhronosGroup/OpenCL-Headers](https://github.com/KhronosGroup/OpenCL-Headers) to your local machine. e.g. `/usr/local/include/CL` with environment var `$OPENCL_HEADERS`.
to your local machine. e.g. `/usr/local/include/CL` with environment var
17
+
`$OPENCL_HEADERS`.
13
18
2. OpenCL runtime for CPU and GPU:
14
19
15
-
a. OpenCL runtime for GPU: follow instructions on [github.com/intel/compute-runtime/releases](https://github.com/intel/compute-runtime/releases) to install.
b. OpenCL runtime for CPU: follow instructions under section "Intel® CPU Runtime for OpenCL. Applications 18.1 for Linux* OS (64bit only)" on [https://software.intel.com/en-us/articles/opencl-drivers#cpu-section](https://software.intel.com/en-us/articles/opencl-drivers#cpu-section) and click on orange "Download" button to download & install.
24
+
b. OpenCL runtime for CPU: follow instructions under section "Intel® CPU
25
+
Runtime for OpenCL. Applications 18.1 for Linux* OS (64bit only)" on
and click on orange "Download" button to download & install.
18
28
19
29
# Build the SYCL compiler
20
30
21
-
Download the LLVM* repository with SYCL support to your local machine folder e.g. `$HOME/sycl` (assuming environment var `$SYCL_HOME`) folder using following command:
31
+
Download the LLVM* repository with SYCL support to your local machine folder
32
+
e.g. `$HOME/sycl` (assuming environment var `$SYCL_HOME`) folder using
# NOTE: The section "-include simple-sycl-app-int-header.h" includes
127
147
# integration header file, which is produced by the device compiler.
128
148
```
129
149
130
-
This `simple-sycl-app` application doesn't specify SYCL device for execution, so SYCL runtime will first try to execute on OpenCL GPU device first, if OpenCL GPU device is not found, it will try to run OpenCL CPU device; and if OpenCL CPU device is also not available, SYCL runtime will run on SYCL host device.
150
+
This `simple-sycl-app` application doesn't specify SYCL device for execution,
151
+
so SYCL runtime will first try to execute on OpenCL GPU device first, if OpenCL
152
+
GPU device is not found, it will try to run OpenCL CPU device; and if OpenCL
153
+
CPU device is also not available, SYCL runtime will run on SYCL host device.
NOTE: SYCL developer can specify SYCL device for execution using device selectors (e.g. `cl::sycl::cpu_selector`, `cl::sycl::gpu_selector`) as explained in following section [Code the program for a specific GPU](#code-the-program-for-a-specific-gpu).
160
+
NOTE: SYCL developer can specify SYCL device for execution using device
161
+
selectors (e.g. `cl::sycl::cpu_selector`, `cl::sycl::gpu_selector`) as
162
+
explained in following section [Code the program for a specific
163
+
GPU](#code-the-program-for-a-specific-gpu).
138
164
139
165
# Code the program for a specific GPU
140
166
141
-
To specify OpenCL device SYCL provides the abstract `cl::sycl::device_selector` class which the can be used to define how the runtime should select the best device.
167
+
To specify OpenCL device SYCL provides the abstract `cl::sycl::device_selector`
168
+
class which the can be used to define how the runtime should select the best
169
+
device.
142
170
143
-
The method `cl::sycl::device_selector::operator()` of the SYCL `cl::sycl::device_selector` is an abstract member function which takes a reference to a SYCL device and returns an integer score. This abstract member function can be implemented in a derived class to provide a logic for selecting a SYCL device. SYCL runtime uses the device for with the highest score is returned. Such object can be passed to `cl::sycl::queue` and `cl::sycl::device` constructors.
171
+
The method `cl::sycl::device_selector::operator()` of the SYCL
172
+
`cl::sycl::device_selector` is an abstract member function which takes a
173
+
reference to a SYCL device and returns an integer score. This abstract member
174
+
function can be implemented in a derived class to provide a logic for selecting
175
+
a SYCL device. SYCL runtime uses the device for with the highest score is
176
+
returned. Such object can be passed to `cl::sycl::queue` and `cl::sycl::device`
177
+
constructors.
144
178
145
-
The example below illustrates how to use `cl::sycl::device_selector` to create device and queue objects bound to Intel GPU device:
179
+
The example below illustrates how to use `cl::sycl::device_selector` to create
180
+
device and queue objects bound to Intel GPU device:
146
181
147
-
```
182
+
```c++
148
183
#include<CL/sycl.hpp>
149
184
150
185
intmain() {
@@ -174,12 +209,14 @@ int main() {
174
209
175
210
# Known Issues or Limitations
176
211
177
-
- SYCL device compiler fails if the same kernel was used in different translation units.
212
+
- SYCL device compiler fails if the same kernel was used in different
213
+
translation units.
178
214
- SYCL host device is not fully supported.
179
215
- SYCL works only with OpenCL implementations supporting out-of-order queues.
180
-
-`math.h` header is conflicting with SYCL headers. Please use `cmath` as a workaround for now like below:
216
+
-`math.h` header is conflicting with SYCL headers. Please use `cmath` as a
0 commit comments