SYCL examples and micro-benchmarks using Intel oneAPI DPC++ (icpx).
.devcontainer/— VS Code Dev Container setup based onintel/oneapi:latest.vscode/— VS Code run/debug helpers (CMake Tools + GDB oneAPI)src/— examples grouped by topic (001-basic,002-device,003-memory, ...)CMakeLists.txt— builds one executable per.cppfile undersrc/
Output layout:
- Each
src/<topic>/<name>.cppbecomesbin/<topic>/<name>inside your chosen build directory. Example:src/002-device/query-xmx-info.cpp→build-release/bin/002-device/query-xmx-info
Dependencies used by the CMake project:
- IntelSYCL:
find_package(IntelSYCL REQUIRED) - oneMKL:
find_package(MKL REQUIRED)(linked formatrix-multiply)
- Intel oneAPI DPC++ compiler (
icpx) and SYCL runtime - oneMKL (oneAPI)
- CMake
- Ninja or Make
- Intel GPU drivers/runtime on the host
- Linux: access to
/dev/dri(the Dev Container passes this through)
- VS Code extensions: CMake Tools and C/C++
- oneAPI debugger package (provides
gdb-oneapi), or adjust the debugger path to your system GDB
This repo expects the dependency folder to exist at cpp-bench-utils/ (repo root).
git clone https://github.com/KindRoach/cpp-bench-utils.gitThis repo includes a Dev Container that starts from intel/oneapi:latest and installs a few extras
needed for VTune/metrics.
- Install VS Code + the “Dev Containers” extension.
- Open the repo folder in VS Code.
- Run: “Dev Containers: Reopen in Container”.
Notes:
- Linux devcontainer uses
--device=/dev/driand--privileged. - WSL devcontainer uses
--device=/dev/dgxand mounts/usr/lib/wsl.
Install Intel oneAPI (Base Toolkit typically includes DPC++ and MKL), then load the environment:
source /opt/intel/oneapi/setvars.shVerify:
icpx --version
cmake --versionThis repo uses CMake configure presets from CMakePresets.json:
cmake --preset releaseOther useful presets:
cmake --preset debugcmake --preset relwithdebinfo
cmake --build build-releaseFor debug builds:
cmake --build build-debugExecutables are written under build-*/bin/<category>/.
Some examples:
./build-release/bin/001-basic/hello-world
./build-release/bin/002-device/query-xmx-info
./build-release/bin/005-matrix/matrix-multiplyInstall the “CMake Tools” extension, then:
- Select a configure preset (e.g.
debugorrelwithdebinfo). - Configure + build.
- Set the target executable as the debug program (from
build-*/bin/...).
If you use relwithdebinfo, you get a good balance of debug symbols and runtime speed.
By default AOT is disabled. Enable it by setting SYCL_DEVICE:
source /opt/intel/oneapi/setvars.sh
cmake -S . -B build-aot -G Ninja \
-DCMAKE_C_COMPILER=icx -DCMAKE_CXX_COMPILER=icpx \
-DSYCL_DEVICE=dg2
cmake --build build-aotDevice names are compiler/version specific, please refer to Intel's doc.
If you have VTune installed, you can start its local web backend via script:
./vtune-backend.shThen open http://localhost:8080.