This repo contains all the stuff used during the talk I gave at the Italian C++ Community meetup in Modena, 2019-05-09 about GPUs and how SYCL allows us to finally program them in a sane way. Please feel free to steal anything you want.
Path | What to expect |
---|---|
slides/ |
The slide deck. Nothing more, nothing less. |
examples/ |
Show me the code. |
cmake/ |
CMake helpers, mainly intended to support ComputeCpp and directly copied from its distribution. |
external/ |
All git submodules related to external dependencies. |
The CMakeLists.txt
provided in this repo builds the following examples
as separate executables:
Example | Depends on | WAT? |
---|---|---|
vector_add_sycl.cpp |
SYCL |
Parallel vector addition with linear accessors |
vector_add_sycl_serial.cpp |
SYCL |
Serial vector addition with linear accessors |
vector_add_tmp_sycl.cpp |
SYCL |
Templated (on value type) parallel vector addition with linear accessors |
vector_add_tmp_sycl_serial.cpp |
SYCL |
Templated (on value type) serial vector addition with linear accessors |
matrix_add_sycl.cpp |
SYCL |
Matrix (2-dimensions) parallel addition with 2-dimensional accessors |
vector_add_opencl.cpp |
OpenCL |
Parallel vector addition using a linear kernel grid |
vector_add_cuda.cu |
CUDA |
Parallel vector addition using a linear kernel grid |
OpenCL
and CUDA
examples are built only if a suitable implementation can be found on the host
while SYCL
based ones are built anyway.
All of the SYCL
based examples have been tested with the following implementations:
triSYCL
, the open source, standard reference implementation. Depends on boost and aC++
withOpenMP
support;ComputeCpp
, a commercial implementation by codeplay with a freely available community edition.
Please note that if SYCL
cannot be found on the host, the triSYCL
source tree will be
automatically downloaded and included via git
submodule.
The following CMake
options are available:
Option | Default | Meaning |
---|---|---|
MEETUPCPP_SYCL |
triSYCL |
SYCL implementation to be used; allowed values are: triSYCL , ComputeCpp |
MEETUPCPP_TRISYCL_DIR |
<repo>/external/triSYCL |
Path of the triSYCL source to be used when triSYCL is selected; defaults to vendored submodule |
COMPUTECPP_BITCODE |
ptx64 |
Bitcode generation target for ComputeCpp; defaults to NVIDIA PTX |
TRISYCL_OPENCL |
ON |
Use OpenCL execution backend; ignored when MEETUPCPP_SYCL isn't set to triSYCL or OpenCL isn't available |
A lot of excellent charts and pitches have been taken directly from publicly available talks across the net, I've strived really hard to put proper credits on the slides but if you notice that something's missing please open an issue on this repo.
Thanks everyone for your help in making my slides more clear and understandable. I'm particularly grateful to (in order of appearance):
sycl.tech
: a comprehensive community platform that collects articles, blog posts, talks and everything related to SYCL that shows up on the web.- Accelerating your C++ on GPU with SYCL by Simon Brand - one of the nicest introductions around.
- Programming GPUs with SYCL by Gordon Brown - a great introduction to the whys and hows of SYCL.
- SYCL Developer Guide by Codeplay - the current lack of learning learning material about SYCL is appalling but this terse developer guide makes the situation a little better.
- CppCon 2018: Parallel Programming with Modern C++ by Gordon Brown - a great overview of parallel programming and modern C++.
- Modern C++ for accelerators: a SYCL deep dive by Andrew Richards - an excellent slide deck to be printed and studied.
- 2019 EuroLLVM Developers’ Meeting: A. Savonichev (Intel) "SYCL compiler: zero-cost abstraction and type safety for heterogeneous computing" - a nice insight on how Intel is working on his own SYCL implementation for LLVM; mandatory for compiler nerds.
- SYCL 1.2.1 API Reference Card - print and hang it on the wall next to the Picasso you just bought at Sotheby's.
- SYCL Standard Specification - to be a proper standard, you need a proper spec. Not so standardese (a traightforward and educational read, actually) but definitely not a novel.
- GCC support for offloading to PTX via OpenACC
- Compiling CUDA with clang - LLVM 9 documentation
- CppCon 2016: CUDA is a low-level language by Justin Lebar
gpucc
: An Open-Source GPGPU Compiler- John Lawson et al., Cross-Platform Performance Portability Using Highly Parametrized SYCL Kernels - a very nice article about parametrizing SYCL kernels to achieve good performance portability across architectures.