Intel® C++ Compiler 18.0 Developer Guide and Reference
This topic only applies when targeting Intel® Graphics Technology.
Intel® Cilk™ Plus is a deprecated feature in the Intel® C++ Compiler 18.0. An alternative for offloading to the processor graphics is planned for a future release. For more information see Migrate Your Application to use OpenMP* or Intel® TBB Instead of Intel® Cilk™ Plus.
The compiler provides two heterogeneous offload programming models that enable you to use the processor graphics:
Synchronous offload:
The CPU waits for the offload task to complete before continuing execution.
Access this model using a parallel _Cilk_for loop as the parallel loop under #pragma offload, or alternatively, using #pragma omp target followed by #pragma omp parallel for.
The compiler handles data sharing and kernel creation based on the offload region containing a parallel loop that is based on either OpenMP* or Intel® Cilk™ Plus syntax.
Asynchronous offload:
The CPU continues execution until it is requested to wait for a kernel to complete.
Access this model using one of the following:
An API described in this section
Intel® Cilk™ Plus syntax: #pragma offload with the signal or wait clause, together with #pragma offload_wait with the wait clause.
OpenMP syntax: #pragma omp target with nowait and depend clauses together with #pragma omp taskwait. See the OpenMP Pragmas Summary for more details.
You have more control over data sharing and kernel enqueueing. Data sharing and kernel enqueueing are separate, so multiple kernels can share data.
The Intel® Graphics Technology runtime and the gfx_rt.h header file provide an Asynchronous API to organize queued offload of user-defined kernel functions and data sharing between the CPU and prodcessor graphics, with little extra programming effort. You can use this API in conjunction with named or direct kernels written using _Cilk_for as the parallel loop in the kernel entry point.
The API includes the following functions:
Name |
Description |
---|---|
GfxTaskId _GFX_offload |
Putting the task into the in-order offload queue |
_GFX_wait |
Waiting for task completion |
_GFX_share _GFX_unshare |
Managing shared linear data |
GfxImage2D (C++ interface, class constructor) GfxSharedImage2D (C++ interface, class constructor) GfxResourceHandle _GFX_create_image_2d (C interface) _GFX_close_resource_handle (C interface) |
Creating and destroying 2D imagesfor processor graphics operations |
GfxImage2D::write, (C++ interface) GfxSharedImage2D::write, (C++ interface) GfxImage2::read (C++ interface) GfxSharedImage2::read (C++ interface) _GFX_read_image_2d (C interface) _GFX_write_image_2d (C interface) |
Synchronizing the content of 2D images between CPU and GPU |