Hi folks.

I'm about to evaluate an implementation of SYCL for ease of use and performance when writing parallel programs for heterogeneous environments, and I'm looking for good candidate programs to port to SYCL which will exercise its C++ features.

Can anyone suggest any good examples of open source libraries or applications which are highly paralellised and which are written in "modern C++"? I'm particularly interested in code which uses (or could well use) lambda functions and variadic templates, but anything which makes good use of templates, smart pointers, RAII, STL, and exceptions would be interesting.

2 Years
Discussion Span
Last Post by mike_2000_17

Writing modern C++ parallel code is very cutting edge, and by that, I mean very recent / experimental. I think that the main existing modern C++ libraries that enable parallelism in a way comparable to what SYCL hopes to do is Microsoft's C++ AMP and Intel's TBB. Things like Cilk and OpenMP are the next contenders, but are definitely more "C-style", just like OpenCL and CUDA.

The problem is that you seem to be looking for some example of "established modern parallel C++ practices", which doesn't really exist yet. There are modern C++ practices, there are some established parallel C-style practices, but I don't think there is much that combines both. And if there are, I'm not aware of them (and to be honest, I'm not the right person to ask about it either, my acquaitance with this field is very limited).

I think your best bet is to look for code that uses either C++ AMP or TBB. I think that those programs should map fairly well to SYCL (from what I understand SYCL to be). There were many interesting talks on parallelism in C++Con 2014, you might also want to look at those.

Just some thoughts about what you mentioned:

I'm particularly interested in code which uses:
lambda functions and variadic templates,

Lambdas and variadic templates are nice modern C++ "front-end" features that I could very well see being used well in parallel C++. I would imagine that lambdas are a particularly nice way to write local and restricted kernels.

but anything which makes good use of templates, smart pointers, RAII, STL,

Making good use of templates, smart pointers, RAII and the STL... to me, that's where I would set the bar for the "passing grade" for any C++ code that I would review. I think that in this day and age, any code that does not make use of these things should be considered as "legacy code" (which means: if it's easy enough to rewrite from scratch, then rewrite it in good style; and, if it's too big / complex / critical to be rewritten safely, then use it with caution and proper insulation (treat it like a C API.. wrap it inside insulating, "good style" C++ code)).

and exceptions

As far as I know, exceptions are pretty much incompatible with parallel code, no? And for that matter, most parallel code is heavily mathematical in nature, which is traditionally very exception-free, because exceptions are usually related to I/O (failures on operations with external things like devices, files, networks, servers, databases, etc..). And second, good parallel code is mostly homogeneous and branchless. And finally, I've heard that there isn't really any established scalable and practical solution to dealing with exceptions in parallel code. Are there?

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.