GPU Scripting and Code Generation with PyCUDA

Andreas Klöckner, Nicolas Pinto, Bryan Catanzaro, Yunsup Lee, Paul Ivanov, Ahmed Fasih

Research output: Chapter in Book/Report/Conference proceedingChapter


A common lament in the field of scientific computing concerns the ever-widening gap between hypothetical machine capabilities and the effort an individual programmer is able to spend to move a computational application towards exploiting a machine to the full extent of its capability. More sophisticated tools, compilers, and libraries are generally hoped to level this field, enabling users to achieve good results even with modest investment. PyCUDA is a contribution to the tools for graphics processing unit (GPU) computing. PyCUDA has a two-fold aim. First, it aims to simplify the usage of existing basic concepts of CUDA C. Importantly, it does not attempt to change or reinvent the basic notions of GPU programming, but instead, as a foundation for further tools, just exposes them as is through a carefully engineered interface. Key features of this interface include generous use of sensible defaults, automatic error checking, and automatic resource management. Second, and strictly on top of the first, basic layer, PyCUDA provides abstractions that support a number of very common usage patterns involving a GPU equivalent of NumPy arrays. Although PyCUDA gives the user access to a compiled language (CUDA C), it attempts to avoid the development iteration penalty commonly associated with compiled languages, instead retaining the satisfaction and immediacy of scripting. PyCUDA and PyOpenCL, as open-source projects, thrive on user feedback, particularly feedback regarding limitations, bugs, or missing features that users encounter.

Original languageEnglish (US)
Title of host publicationGPU Computing Gems Jade Edition
PublisherElsevier Inc.
Number of pages13
ISBN (Print)9780123859631
StatePublished - 2012
Externally publishedYes

ASJC Scopus subject areas

  • General Computer Science


Dive into the research topics of 'GPU Scripting and Code Generation with PyCUDA'. Together they form a unique fingerprint.

Cite this