Get Started on Linux*

Before You Begin

Before you can use the compiler, you must first set the environment variables by sourcing the environment script using the initialization utility. This initializes all the tools in one step.

  1. Determine your installation directory,<install_dir>:
    1. If your compiler was installed in the default location by a root user or sudo user, the compiler will be installed under/opt/intel/oneapi. In this case, <install_dir> is /opt/intel/oneapi.
    2. For non-root users, your home directory under intel/oneapi is used. In this case, <install_dir> will be $HOME/intel/oneapi.
    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 (<install_dir>).
  2. Source the environment-setting script for your shell:
    1. bash: source <install_dir>/setvars.sh intel64
    2. csh/tcsh: source <install_dir>/setvars.csh intel64

Option 1: Use the Command Line

Invoke the compiler from the command line using the following syntax:

C/C++

{icx|icpx} [options] file1 [file2...]

SYCL

icpx -fsycl [options] file1 [file2...]

For example, the sample SYCL code provided in this guide is compiled with the following command:

icpx -fsycl simple-sycl-app.cpp -o simple-sycl-app

Note

When using -fsycl, -fsycl-targets=spir64 is assumed unless the -fsycl-targets is explicitly set in the command.

For more information about compiler drivers, visit Invoke the Compiler

Option 2: Use the Eclipse* CDT

Follow these steps to invoke the compiler from within the Eclipse* CDT.

Install the Intel® Compiler Eclipse CDT plugin.

  1. Start Eclipse
  2. Select Help > Install New Software
  3. Select Add to open the Add Site dialog
  4. Select Archive, browse to the directory <install_dir>/compiler/<version>/linux/ide_support, select the .zip file that starts with com.intel.dpcpp.compiler, then select OK
  5. Select the options beginning with Intel, select Next, then follow the installation instructions
  6. When asked if you want to restart Eclipse*, select Yes

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

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

Build a Program From the Command Line

Follow the steps in Compile and Execute Sample SYCL Code to test your compiler installation.