This sample illustrates incremental migration from OpenCL™ to SYCL* compliant code in two usage scenarios:
- A program that compiles and runs an OpenCL kernel using SYCL.
- A program that converts OpenCL objects using SYCL standards. (For more information, read Migrating OpenCL™ Designs to SYCL.)
| Property | Description |
|---|---|
| What you will learn | How OpenCL code can interact with SYCL using the Intel® oneAPI DPC++/C++ Compiler |
| Time to complete | 10 minutes |
For users migrating from OpenCL to SYCL, the sample illustrates interoperability that enables incremental migration. Simultaneous migration of existing OpenCL kernels is unnecessary.
| Optimized for | Description |
|---|---|
| OS | Ubuntu* 18.04 |
| Hardware | Skylake or newer |
| Software | Intel® oneAPI DPC++/C++ Compiler |
Common OpenCL to SYCL conversion scenarios are illustrated in the code; in sycl_with_opencl_objects.dp.cpp, the program converts OpenCL objects (Memory Objects, Platform, Context, Program, Kernel) to conform with SYCL standards and executes the program.
When working with the command-line interface (CLI), you should configure the oneAPI toolkits using environment variables. Set up your CLI environment by sourcing the setvars script every time you open a new terminal window. This practice ensures that your compiler, libraries, and tools are ready for development.
Note: If you have not already done so, set up your CLI environment by sourcing the
setvarsscript in the root of your oneAPI installation.Linux*:
- For system wide installations:
. /opt/intel/oneapi/setvars.sh- For private installations:
. ~/intel/oneapi/setvars.sh- For non-POSIX shells, like csh, use the following command:
bash -c 'source <install-dir>/setvars.sh ; exec csh'For more information on configuring environment variables, see Use the setvars Script with Linux* or macOS*.
You can use Visual Studio Code* (VS Code) extensions to set your environment, create launch configurations, and browse and download samples.
The basic steps to build and run a sample using VS Code include:
- Configure the oneAPI environment with the extension Environment Configurator for Intel Software Developer Tools.
- Download a sample using the extension Code Sample Browser for Intel Software Developer Tools.
- Open a terminal in VS Code (Terminal > New Terminal).
- Run the sample in the VS Code terminal using the instructions below.
To learn more about the extensions and how to configure the oneAPI environment, see the Using Visual Studio Code with Intel® oneAPI Toolkits User Guide.
- Build the program.
mkdir build cd build cmake .. make
Note: You might see deprecation warnings.
If an error occurs, you can get more details by running make with
the VERBOSE=1 argument:
make VERBOSE=1
If you receive an error message, troubleshoot the problem using the Diagnostics Utility for Intel® oneAPI Toolkits, which provides system checks to find missing dependencies and permissions errors. See Diagnostics Utility for Intel® oneAPI Toolkits User Guide.
- Run the program.
make run - Clean the program. (Optional)
make clean
Kernel Loading Done
Platforms Found: 3
Using Platform: Intel(R) FPGA Emulation Platform for OpenCL(TM)
Devices Found: 1
Device: Intel(R) FPGA Emulation Device
Passed!
Built target run
Code samples are licensed under the MIT license. See License.txt for details.
Third party program Licenses can be found here: third-party-programs.txt.