Invoke the Compiler
Requirements Before Using the Command Line
You may need to set certain environment variables before using the command line. For more information, see
.
Different Compilers and Drivers
The table below provides the different compiler front-end and driver information.
To use Microsoft Visual C++* (MSVC) compatible options, use
dpcpp-cl
.
Compiler
| Notes
| Linux* Driver
| Windows* Driver
|
---|---|---|---|
Intel® DPC++ Compiler
| A C++ and Khronos SYCL* compiler with a Clang front-end.
| dpcpp | dpcpp (clang compatible)
dpcpp-cl (clang-cl compatible)
|
Intel® C++ Compiler
| A C++ compiler with a Clang front-end, supporting OpenMP* offload.
| icx for C
icpx for C++
| icx |
Use the Compiler from the Command Line
Use the compiler with the OS/language specific invocations below.
You can also use the compiler from within the IDE.
For more information on using Microsoft Visual Studio*, see
Using Microsoft Visual Studio.
For information on using Eclipse*, see
Using Eclipse.
Linux:
Invoke the compiler using
to compile
icx
/icpx
(for C/C++) or
dpcpp
(for DPC++)LLVM
C/C++/DPC++
source files.
- When you invoke the compiler withdpcppthe compiler buildssource files usingDPC++libraries andDPC++include files. If you useDPC++dpcppwith a C source file, it is compiled as afile. UseDPC++dpcppto linkobject files.DPC++
- When you invoke the compiler withicxthe compiler builds LLVM C source files using LLVM C libraries and LLVM C include files. If you useicxwith a C++ source file, it is compiled as an LLVM C file. Useicxto link LLVM C object files.
- When you invoke the compiler withicpxthe compiler builds LLVM C++ source files using LLVM C++ libraries and LLVM C++ include files. If you useicpxwith a C source file, it is compiled as an LLVM C++ file. Useicpxto link LLVM C++ object files.If you are usingicpxas your main compiler, you must add-fsyclat the link stage, otherwise the offload kernels are not available in the main binary.
The
command does the following:
icx
/icpx
(for C/C++) or
dpcpp
(for DPC++)- Compiles and links the input source file(s).
- Produces one executable file,a.out, in the current directory.
Windows:
You can invoke the compiler on the command line using the
command. This command:
icx
(for C/C++) or
dpcpp-cl
(for DPC++)- Compiles and links the input source file(s).
- Produces object file(s) and assigns the names of the respective source file(s), but with a.objextension.
- Produces one executable file and assigns it the name of the first input file on the command line, but with a.exeextension.
- Places all the files in the current directory.
When compilation occurs with the compiler, many tools may be called to complete the task that may reproduce diagnostics unique to the given tool. For instance, the linker may return a message if it cannot resolve a global reference. The
watch
option can help clarify which component is generating the error.
Command Line Syntax
When you invoke the compiler, the syntax is:
For C/C++ projects:
// (Linux) {icx/icpx} [options] file1 [file2...]
// (Windows) icx [options] file1 [file2...] [/link link_options]
For DPC++ projects:
// (Linux) dpcpp [options] file1 [file2...]
// (Windows) dpcpp-cl [options] file1 [file2...] [/link link_options]
Argument
| Description
|
---|---|
options | Indicates one or more command line options.
On Linux systems, the compiler recognizes one or more letters preceded by a hyphen ( - ).
On Windows, options are preceded by a slash ( / ). This includes linker options.
Options are not required when invoking the compiler. The default behavior of the compiler implies that some options are ON by default when invoking compiler.
|
file1, file2... | Indicates one or more files to be processed by the compiler. You can specify more than one file, using
space as a delimiter for multiple files.
|
/link (Windows)
| All options following
/link are passed to the linker. Compiler options must precede
link
if they are not to be passed to the linker.
|
Other Methods for Using the Command Line to Invoke the Compiler
- Using makefiles from the Command Line:Use makefiles to specify a number of files with various paths and to save this information for multiple compilations. For more information on using makefiles, see .
- Using a Batch File from the Command Line:Create and use a.batfile to consistently execute the compiler with a desired set of options instead of retyping the command each time you need to recompile.
Enable OpenMP* Offloading
To enable OpenMP* offloading for C++ applications, invoke the compiler with:
- icpx -fiopenmp -fopenmp-targets=<arch>(Linux)
- icx /Qiopenmp /Qopenmp-targets:<arch>(Windows).
To enable OpenMP offloading for DPC++ applications, invoke the compiler with:
- dpcpp -fiopenmp -fopenmp-targets=<arch>(Linux)
- dpcpp-cl /Qiopenmp /Qopenmp-targets:<arch>(Windows)