CUDA Expression Templates

Paul Wiemann, Stephan Wenger, Marcus Magnor
Computer Graphics Lab, TU Braunschweig, Germany
WSCG Communication Papers Proceedings, 2011


   author={Wiemann, Paul and Wenger, Stephan and Magnor, Marcus},

   title={CUDA} Expression Templates},

   note={ISBN} 978-80-86943-82-4},

   booktitle={WSCG} Communication Papers Proceedings 2011},





Download Download (PDF)   View View   Source Source   Source codes Source codes




Many algorithms require vector algebra operations such as the dot product, vector norms or component-wise manipulations. Especially for large-scale vectors, the efficiency of algorithms depends on an efficient implementation of those calculations. The calculation of vector operations benefits from the continually increasing chip level parallelism on graphics hardware. Very efficient basic linear algebra libraries like CUBLAS make use of the parallelism provided by CUDA-enabled GPUs. However, existing libraries are often not intuitively to use and programmers may shy away from working with cumbersome and error-prone interfaces. In this paper we introduce an approach to simplify the usage of parallel graphics hardware for vector calculus. Our approach is based on expression templates that make it possible to obtain the performance of a hand-coded implementation while providing an intuitive and math-like syntax. We use this technique to automatically generate CUDA kernels for various vector calculations. In several performance tests our implementation shows a superior performance compared to CPU-based libraries and comparable results to a GPU-based library.
No votes yet.
Please wait...

* * *

* * *

HGPU group © 2010-2017 hgpu.org

All rights belong to the respective authors

Contact us: