Skip to content

Latest commit

 

History

History
61 lines (48 loc) · 2.18 KB

File metadata and controls

61 lines (48 loc) · 2.18 KB

SYCL Academy

Exercise 11: In Order Queue


In this exercise you will learn how to create a fixed data flow using an in-order queue.


1.) In order queue with buffer/accessor model

Using the application from exercise 10 which uses the buffer/accessor model convert the queue to in-order using the property::queue::in_order property, converting the data flow graph to a fixed execution order.

Feel free to have the kernel functions execute in any order you like providing the necessary dependencies described in exercise 10 are still met.

2.) In order queue with USM model

Now do the same using the application from exercise 10 which uses the USM model, again converting the queue to in-order, converting the data flow graph to a fixed execution order.

Again feel free to have the kernel functions execute in any order you like providing the necessary dependencies described in exercise 10 are still met.

Note that in the USM model when using an in-order queue it is no longer necessary to chain commands using events.

Build and execution hints

For DPC++: Using CMake to configure then build the exercise:

mkdir build
cd build
cmake .. "-GUnix Makefiles" -DSYCL_ACADEMY_USE_DPCPP=ON -DSYCL_ACADEMY_ENABLE_SOLUTIONS=OFF -DCMAKE_C_COMPILER=icx -DCMAKE_CXX_COMPILER=icpx
make exercise_11

Alternatively from a terminal at the command line:

icpx -fsycl -o sycl-ex-11 -I../External/Catch2/single_include ../Code_Exercises/Exercise_11_In_Order_Queue/source.cpp
./sycl-ex-11

For AdaptiveCpp:

# <target specification> is a list of backends and devices to target, for example
# "omp;generic" compiles for CPUs with the OpenMP backend and GPUs using the generic single-pass compiler.
# The simplest target specification is "omp" which compiles for CPUs using the OpenMP backend.
cmake -DSYCL_ACADEMY_USE_ADAPTIVECPP=ON -DSYCL_ACADEMY_INSTALL_ROOT=/insert/path/to/adaptivecpp -DACPP_TARGETS="<target specification>" ..
make exercise_11

alternatively, without CMake:

cd Code_Exercises/Exercise_11_In_Order_Queue
/path/to/adaptivecpp/bin/acpp -o sycl-ex-11 -I../../External/Catch2/single_include --acpp-targets="<target specification>" source.cpp
./sycl-ex-11