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.
You can develop oneAPI applications using C++ and SYCL* that will run on Intel, AMD*, or NVIDIA* GPUs.
To develop and run applications for specific GPUs you must first install the corresponding drivers or plug-ins:
The Intel® oneAPI DPC++/C++ Compiler provides multiple drivers:
Language | Linux Drivers | Windows Drivers | Option Style | Notes |
---|---|---|---|---|
C |
icx icx-cc |
icx-cc |
Linux-style |
icx is the recommended default C driver for Linux. If you use icx with a C++ source file, it is compiled as a C++ file. Use icx to link C object files. icx-cc is the Microsoft-compatible variant of icx. |
C++ |
icpx | icpx |
Linux-style |
icpx is the recommended default C++ driver for Linux. If you use icpx with a C source file, it is compiled as an C++ file. Use icpx to link C++ object files. |
C/C++ |
icx-cl |
icx icx-cl |
Windows-style |
icx is the recommended default driver for Windows. icx-cl is the Microsoft-compatible variant of icx. On Linux, icx-cl requires the Microsoft Visual Studio package. |
Invoke the compiler using the following syntax:
{compiler driver} [option] file1 [file2...]
For example:
icpx hello-world.cpp
For SYCL compilation, use the -fsycl option with the C++ driver:
icpx -fsycl hello-world.cpp
If you are targeting an AMD or NVIDIA GPU, refer to the corresponding Codeplay plugin get started guide for detailed compilation instructions:
Follow these steps to invoke the compiler from within the Eclipse* CDT.
Install the Intel® Compiler Eclipse CDT plugin.
Build a new project or open an existing project.
Set build configurations.
Use the following steps to test your compiler installation and build a program.
#include <iostream> int main() { std::cout << “Hello, world!\n”; return 0; }
icpx hello-world.cpp -o hello-worldThe -o option specifies the file name for the generated output.
hello-worldWhich outputs:
Hello, world!
You can direct and control compilation with compiler options. For example, you can create the object file and output the final binary in two steps:
icpx hello-world.cpp -cThe -c option prevents linking at this step.
icpx hello-world.o -o hello-worldThe -o option specifies the generated executable file name.
Refer to Compiler Options for details about available options.
© Codeplay Software Limited. Intel, the Intel logo, Codeplay, Codeplay 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.