Jiří Vyskočil

Template Metaprogramming for Massively Parallel Scientific Computing

List of references, interesting links, and code examples with further details about the lecture series "Template Metaprogramming for Massively Parallel Scientific Computing" Presented at the inverted CERN School of Computing 2016.

Modern C++ fetaures

L1 - Expression Templates

Online Recording

Sources

Sources for the simple Expression Template library built according the slides. You can directly reproduce the performance tests from these sources. Try to add more operators, build more complicated expressions, and look how the performance compares to the simple OO version.

cms_page_media/3/l1-simpletest.zip

Links

L2 - Vectorization with Expression Templates

Online Recording

Sources

Sources for an integrator of equations of motion of a system of particles in electromagnetic field. There are two versions, both built using the provided Makefile. One is a pure serial verison with an AoS data layout, the other is an explicit AoSoA layout, where you have to manually specify the size of the register in the header file. You can reproduce the performance tests using these sources.

cms_page_media/3/simd-particles.zip

Simplified and super-simplified versions of Vincenzo Innocete's "UltimateSoA" illustrating core concepts as I understood them and explained in the lectures

cms_page_media/3/ultimatesoa-simplified.zip

Links

L3 - Templates for Iteration; Thread-level Parallelism

Online Recording

Sources

Sources for the FDTD Maxwell equation integrator which incorporates Expression Templates, SoA storage (easily subsituted for AoS by using an STL container), and functional-style iteration. It requires the BOOST libraries, and is built using CMake. It has been ripped out of a much larger codebase and simplified. I haven't ported the usit tests, so don't use it in important projects, as there might be bugs. If you do want to use it though, dont hesitate to contact me at jiri@vysko.cz, I'd be more than happy to help you adapt the sources for your purspose.

cms_page_media/3/opice.zip

Notes

  • Beware the slides about multi-dimensional container implementation, which I skipped due to lack of time during the lecture. They were only supposed to illustrate an approach to chaining operator[], but ignored the issues of compact data storage using nested std::vectors. Had you tried implementing it without changing to compact sotrage, the preformance would be horrible.

Links