CppCon 2024 Bridging the Gap: Writing Portable Programs for CPU and GPU -- Thomas Mejstrik
Registration is now open for CppCon 2024! The conference starts on September 15 and will be held in person in Aurora, CO. To whet your appetite for this year’s conference, we’re posting some upcoming talks that you will be able to attend this year. Here’s another CppCon future talk we hope you will enjoy – and register today for CppCon 2024!
Bridging the Gap: Writing Portable Programs for CPU and GPU
Monday, September 16 • 15:15 - 16:15 MDT
by Thomas Mejstrik
Summary of the talk:
This talk presents a series of effective patterns to address challenges arising when
code is developed that shall operate seamlessly on both GPU (Cuda) and CPU environments.
This scenario is a common oversight among Cuda developers, given the substantial architectural differences between CPUs and GPUs.The patterns presented cover a range of scenarios, from handling stray function calls, strategies for conditional compilation, exploiting constexpr functions, leveraging undefined behaviour, usage of Cuda specific macros,
conditional instantiation of templates, and managing compiler warnings and errors.Key patterns include: "Host device everything", "Conditional function body", "Constexpr everything", "Disable the warnings", "Defensive Programming", "Conditional Host Device Template", and "Function dispatching".
We evaluate each pattern based on ease of use, maintenance overhead, applicability and known usages. Additionally, pitfalls to avoid and considerations for implementations are provided to guide developers in adopting these patterns effectively.
Thomas Mejstrik earned his doctoral degree in Mathematics from the University of Vienna, Austria, specializing in numerical linear algebra and high-performance computing. Additionally, he obtained a Master's degree in Piano Education from the University of Music and Performing Arts Vienna, Austria. He also pursued studies in Chinese at the Central China Normal University, Wuhan, China, and the University of Vienna, Austria. With prior experience as a CUDA/C++ Senior Software Developer at Dimetor, Vienna, Austria, Thomas Mejstrik currently serves as a Postdoctoral Researcher at the University of Vienna, leading a research project on linear subdivision schemes, particularly relevant in animation. Beyond his academic and professional pursuits in mathematics, programming, and music, Thomas Mejstrik is actively involved in various women's political initiatives.