Bridging the Gap: Writing Portable C++ Programs for CPU and GPU - Thomas Mejstrik - CppCon 2024

Channel

https://cppcon.org
---

Bridging the Gap: Writing Portable C++ Programs for CPU and GPU - Thomas Mejstrik - CppCon 2024
---

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.
---

Slides: https://github.com/CppCon/CppCon2024/blob/main/Presentations/Bridging_t…

Sponsored by JetBrains: https://www.jetbrains.com/clion/
---

Thomas Mejstrik

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.
---

CppCon is the annual, week-long face-to-face gathering for the entire C++ community. The conference is organized by the C++ community for the community. You will enjoy inspirational talks and a friendly atmosphere designed to help attendees learn from each other, meet interesting people, and generally have a stimulating experience. Taking place this year in Aurora, Colorado, near the Denver airport, and including multiple diverse tracks, the conference will appeal to anyone from C++ novices to experts.
Annual CppCon Conference - https://www.cppcon.org
https://www.linkedin.com/company/cppcon
https://x.com/cppcon
https://www.facebook.com/CppConference
https://www.reddit.com/r/cppcon/
https://mastodon.social/@CppCon
---

Videos Filmed & Edited by Bash Films: http://www.BashFilms.com
YouTube Channel Managed by Digital Medium Ltd: https://events.digital-medium.co.uk
---

#cpu #gpu #gpucomputing #cpp #cplusplus #cppcon #cppprogramming #cplusplusprogramming #softwaredevelopment #softwareengineering #coding #code #computerscience #technology #technews #programming #programmer