Get Started

  • 2021.2
  • 03/26/2021
  • Public Content

Get Started with the
Intel® oneAPI

Intel® oneAPI
provides optimizations that help your applications to run faster on Intel® 64 and IA-32 (Windows* and Linux* only) architectures, with support for the latest C, C++, and DPC++ language standards (including C++17). This compiler produces optimized code that can run significantly faster by taking advantage of the ever-increasing core count and vector register width in Intel® Xeon® processors and compatible processors. The Intel® Compiler will help you boost application performance through superior optimizations and Single Instruction Multiple Data (SIMD) vectorization, integration with Intel® Performance Libraries, and by leveraging the latest OpenMP* 5.0 parallel programming model.
Intel® oneAPI
compiles C++-based SYCL* source files for a wide range of compute accelerators.
Intel® oneAPI
is part of the Intel® oneAPI Toolkits.

Before You Begin

The compiler integrates into the following versions of Microsoft Visual Studio*:
  • Visual Studio* 2019
  • Visual Studio* 2017
For full functionality within Visual Studio, including debugging and development, Visual Studio* Community Edition or higher is required. Visual Studio* Express Edition allows only command-line builds. For all versions, Microsoft C++ support must be selected as part of the Visual Studio install. For Visual Studio* 2015 and later, you must use a custom install to select this option.
You typically do not need to set the environment variables on Windows*, as the compiler command-line window sets these variables for you automatically. If you need to set the environment variables, run the environment script as described in the suite-specific Get Started documentation.
is the installation directory. By default, it is
C:\Program Files (x86)\IntelSWTools
Before you can use the compiler, you must first set the environment variables by sourcing the environment script using the initialization utility to initialize all the tools in one step:
  1. Determine your installation directory,
    1. If your compiler was installed in the default location by a root user or sudo user, the compiler will be installed under
      . In this case,
    2. For non-root users, your home directory under
      is used. In this case,
      will be
    3. For cluster or enterprise users, your admin team may have installed the compilers on a shared network file system. Check with your local admin staff for the location of installation (
  2. Source the environment-setting script for your shell:
    1. bash:
      source <install_dir>/bin/ intel64
    2. csh/tcsh:
      source <install_dir>/bin/setvars.csh intel64
  3. If you want to use the 32bit ia32 compiler instead of the default 64bit compiler, replace
    in the source command above with
    . For example:
    1. bash:
      source <install_dir>/bin/ ia32
    2. csh/tcsh:
      source <install_dir>/bin/setvars.csh ia32

Compile and Execute SYCL Code

Use the steps below to compile and execute SYCL code.
  1. A sample SYCL program is shown below and captured in the file
    #include <CL/sycl.hpp> int main() { // Creating SYCL queue cl::sycl::queue Queue; // Creating buffer of 4 ints cl::sycl::buffer<cl::sycl::cl_int, 1> Buffer(4); // Size of index space for kernel cl::sycl::range<1> NumOfWorkItems{Buffer.get_count()}; // Submitting command group to queue Queue.submit([&](cl::sycl::handler &cgh) { // Getting write only access to the buffer on a device auto Accessor = Buffer.get_access<cl::sycl::access::mode::write>(cgh); // Executing kernel cgh.parallel_for<class FillBuffer>( NumOfWorkItems, [=](cl::sycl::id<1> WIid) { // Fill buffer with indexes Accessor[WIid] = (cl::sycl::cl_int)WIid.get(0); }); }); // Getting read only access to the buffer on the host const auto HostAccessor = Buffer.get_access<cl::sycl::access::mode::read>(); // Check that the results are correct bool MismatchFound = false; for (size_t I = 0; I < Buffer.get_count(); ++I) { if (HostAccessor[I] != I) { std::cout << "The result is incorrect for element: " << I << " , expected: " << I << " , got: " << HostAccessor[I] << std::endl; MismatchFound = true; } } if (!MismatchFound) { std::cout << "The results are correct!" << std::endl; } return MismatchFound; }
  2. To build the
    run the following command:
    dpcpp simple-sycl-app.cpp -o simple-sycl-app
  3. To run the
    , use:
    You will see the following output:
    The results are correct!
The SYCL host device is not fully supported.

How to Specify a SYCL Device (optional)

To specify the device, SYCL provides the abstract
class, which you can subclass to define how the runtime selects the device. The method operator() of the SYCL
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 and provide a logic for selecting a SYCL device. The SYCL runtime uses the device with the highest returned score. This object can be passed to the
This example illustrates how to use the
to create a device and queue objects that are bound to a GPU:
#include <CL/sycl.hpp> int main() { class NEOGPUDeviceSelector : public cl::sycl::device_selector { public: int operator()(const cl::sycl::device &Device) const override { using namespace cl::sycl::info; const std::string DeviceName = Device.get_info<device::name>(); const std::string DeviceVendor = Device.get_info<device::vendor>(); return Device.is_gpu() && (DeviceName.find("HD Graphics NEO") != std::string::npos); } }; NEOGPUDeviceSelector Selector; try { cl::sycl::queue Queue(Selector); cl::sycl::device Device(Selector); } catch (cl::sycl::invalid_parameter_error &E) { std::cout << E.what() << std::endl; } }
You can specify the SYCL device used for execution with one of the following device selectors:
  • cl::sycl::intel::fpga_selector
  • cl::sycl::intel::fpga_emulator_selector
  • cl::sycl::cpu_selector
  • cl::sycl::gpu_selector

Invoke the Compiler

Start using the compiler from the command line, as outlined above, or within an IDE.

Use the Command Line on Windows*

Follow the steps below to invoke the compiler using the command line from within Microsoft Visual Studio*.
You must have a version of Microsoft Visual Studio* installed to use the compiler.
Step 1: Open a command prompt.
Step 2: Invoke the compiler.
Use the command below to invoke the compiler from the command line:
  • With C++ Classic:
    icl [options...] inputfile(s) [/link link_options]
  • With C++:
    icx [options...] inputfile(s) [/link link_options]
  • With DPC++:
    dpcpp [options...] inputfile(s) [/link link_options]
  • With DPC++ (HPC toolkit only):
    icx -fsycl [options...] inputfile(s) [/link link_options]
Use the command below to display all available compiler options:
  • With C++ Classic:
    icl /help
  • With C++:
    icx /help
  • With DPC++:
    dpcpp /help

Use the Command Line on Linux*

Use the commands below to invoke the compiler from the command line.
  • For C source files:
    icx helloworld.c
  • For C++ Classic source files:
  • For C++ source files:
  • For DPC++ source files (Base Toolkit):
  • For DPC++ source files (HPC Toolkit):
    icx -sycl

Use Microsoft Visual Studio* on Windows*

Follow the steps below to invoke the compiler from within Microsoft Visual Studio*.
Step 1: Build a binary:
  1. Launch Microsoft Visual Studio*
  2. Open an existing project or solution
  3. Right click on
    Solution Explorer > Intel Compiler > Use Intel oneAPI DPC++/C++ Compiler
  4. Select
  5. Select
    Build > Rebuild Solution
Step 2: Set build configurations.
  1. Right click on
    Solution Explorer > Properties
  2. Locate C/C++ in the list and expand the heading
  3. Walk through the available properties to select your configuration
Switch to the Intel® oneAPI DPC++/C++ Compiler from the Microsoft Visual Studio* C++ Compiler
  1. Launch Microsoft Visual Studio* and open a solution or project
  2. Select
    Project > Intel Compiler > Use Intel oneAPI DPC++/C++
  3. Select
  4. Select
    Build > Rebuild Solution
Switch to the Microsoft Visual Studio* C++ Compiler from the Intel® oneAPI DPC++/C++ Compiler
This action updates the solution file to use the Microsoft Visual Studio C++ compiler. All configurations of affected projects are automatically cleaned unless you select
Do not clean project(s)
. If you choose not to clean projects, you will need to rebuild updated projects to ensure all source files are compiled with the new compiler.
  1. Launch Microsoft Visual Studio* and open a solution or project
  2. Select
    Project > Intel Compiler > Use Visual C++
To change the compiler version in Microsoft Visual Studio*, navigate to
Tools > Options > Intel Compilers and Libraries > C++ > Compilers

Option 2: Use the Eclipse* CDT on Linux*

Follow the steps below to invoke the compiler from within the Eclipse* CDT.
Step 1: Install the Intel® Compiler Eclipse CDT plugin.
  1. Start Eclipse
  2. Select
    Help > Install New Software
  3. Select
    to open the Add Site dialog
  4. Select
    , browse to the directory
    , select the .zip file that starts with
    , then select
  5. Select the options beginning with Intel, select
    , then follow the installation instructions
  6. When asked if you want to restart Eclipse*, select
Step 2: Build a new project or open an existing project.
  1. Open Existing Project or Create New Project on Eclipse
  2. Right click on
    Project > Properties > C/C++ Build > Tool chain Editor
  3. Select
    Intel DPC++/C++ Compiler
    from the right panel
Step 3: Set build configurations.
  1. Open Existing Project on Eclipse
  2. Right click on
    Project > Properties > C/C++ Build > Settings
  3. Create or manage build configurations in the right panel

Next Steps

Find More

Description and Links
Visit the Release Notes page for known issues and the most up-to-date information.
Provides details on the
Intel® oneAPI
programming model, including details about
, programming for various target accelerators, and introductions to the
Intel® oneAPI
Intel® oneAPI
features and setup and get more detailed information about compiler options, attributes, and more.
SYCL Specification Version 1.2.1 PDF
The SYCL Specification PDF, explains how SYCL integrates OpenCL devices with modern C++:
SYCL Overview site
An overview of SYCL:
The GNU* C++ Library
Using dual ABI:

Notices and Disclaimers

Intel technologies may require enabled hardware, software or service activation.
No product or component can be absolutely secure.
Your costs and results may vary.
© Intel Corporation. Intel, the Intel logo, and other Intel marks are trademarks of Intel Corporation or its subsidiaries. Other names and brands may be claimed as the property of others.
No license (express or implied, by estoppel or otherwise) to any intellectual property rights is granted by this document.
The products described may contain design defects or errors known as errata which may cause the product to deviate from published specifications. Current characterized errata are available on request.
Intel disclaims all express and implied warranties, including without limitation, the implied warranties of merchantability, fitness for a particular purpose, and non-infringement, as well as any warranty arising from course of performance, course of dealing, or usage in trade.

Product and Performance Information


Performance varies by use, configuration and other factors. Learn more at