Compiling and Running an OpenMP Application
Use the following compiler options to enable offloading onto Intel
GPUs.
- -qopenmp -fopenmp-targets=spir64
Add the following compiler options to enable the output of the
compiler optimization report.
- -qopt-report=3 -O3
By default, compilation is Just-In-Time (JIT), so the following
compilation command will result in JIT compilation.
- icx -fiopenmp -fopenmp-targets=spir64_gen <source_file>
For Ahead-Of-Time (AOT) compilation, use:
ATS-P A0 stepping:
- icx -fiopenmp -fopenmp-targets=spir64_gen -Xopenmp-target-backend "-device xehp" -Xopenmp-target-backend "-revision_id 1" <source_file>
ATS-P B0 stepping:
- icx -fiopenmp -fopenmp-targets=spir64_gen -Xopenmp-target-backend "-device xehp" -Xopenmp-target-backend "-revision_id 4" <source_file>
The following are some device-related environment variables:
- ZE_AFFINITY_MASK=0.0(for 1-tile execution)
- EnableWalkerPartition=1(for 2-tile execution with implicit scaling)
- OMP_TARGET_OFFLOAD=MANDATORY(specifies that program execution is terminated if a device construct or device memory routine is encountered and the device is not available or is not supported by the implementation.)
- LIBOMPTARGET_DEBUG=1(for emitting debug information from libomptarget.so)
The following are some device-related runtime routines:
- omp_target_alloc
- omp_target_free
- omp_target_memcpy
The following runtime routines are supported by the Intel® compilers as
Intel extensions:
- omp_target_alloc_host
- omp_target_alloc_device
- omp_target_alloc_shared
omp_target_free
can be called to free up the memory allocated
using the above Intel® extensions.For a listing of OpenMP features supported in the
icx
, icpx
,
and ifx
compilers, see: