Computer Graphics
TU Braunschweig

CUDA Expression Templates


CUDA Expression Templates

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.

Downloads

The provided source code is a proof-of concept implementation of the techniques described in our paper CUDA Expression Templates. Use at your own risk.

You are free to use the library free of charge. If you make any changes to the library code it self, please provide us with a copy so that we can include your changes in a future release. If you use this software for a publication, please cite our paper.

Download (C++ source archive, tested on Ubuntu Linux 9.10): [current (from github)] [v0.0.2] [v0.0.1]


Author(s):Paul Wiemann, Stephan Wenger, Marcus Magnor
Published:January 2011
Type:Article in conference proceedings
Book:WSCG Communication Papers Proceedings
Presented at:WSCG Communication Papers Proceedings
Note:ISBN 978-80-86943-82-4


@inproceedings{wiemann2011cuda,
  title = {{CUDA} Expression Templates},
  author = {Wiemann, Paul and Wenger, Stephan and Magnor, Marcus},
  booktitle = {{WSCG} Communication Papers Proceedings},
  note = {{ISBN} 978-80-86943-82-4},
  pages = {185--192},
  month = {Jan},
  year = {2011}
}

Authors