fsycl-pstl-offload

Enables the automatic offloading of C++ standard parallel algorithms to a SYCL device.

Syntax

Linux:

-fsycl-pstl-offload[=arg]

-fno-sycl-pstl-offload

Windows:

/fsycl-pstl-offload[:arg]

/fno-sycl-pstl-offload

Arguments

arg

Is one of the following:

cpu

Tells the compiler to perform offloading to a SYCL CPU device.

gpu

Tells the compiler to perform offloading to a SYCL GPU device.

Default

-fno-sycl-pstl-offload

C++ standard parallel algorithms are not offloaded automatically.

Description

This option enables the automatic offloading of C++ standard parallel algorithms that were called with std::execution::par_unseq policy to a SYCL device. The offloaded algorithms are implemented via the oneAPI Data Parallel C++ Library (oneDPL).

If you do not specify arg, it tells the compiler to perform offloading to the default SYCL device.

oneDPL is required for offloading support. See the oneDPL documentation for information about how to make it available in the environment.

Note

When using this option, you must also specify option -fsycl.

The following are restrictions, requirements, and limitations when using option fsycl-pstl-offload:

Performance

If the performance is not satisfactory, the following environment variables may help:

For more information about these environment variables, see Environment Variables on GitHub.

IDE Equivalent

None

Alternate Options

None

Example

The following shows a way to use this option:

#include <algorithm>
#include <vector>
#include <execution>

int main()
{
    std::vector<int> v(1000000);

    // If this code is compiled with -fsycl-pstl-offload=gpu, the 
    // for_each algorithm is going to be offloaded to the default  
    // SYCL GPU device automatically
    std::for_each(std::execution::par_unseq, v.begin(), v.end(), [](auto& v)
    {
        // do some computation
    });
}