Chapter 7

The Thrust template library

Abstract

Thrust is a template library that allows a high-level approach to GPU and multicore programming, that closely resembles the way the standard STL library is used, effectively reducing the learning curve associated with GPU computing.

Thrust-based programs operate on collections of data without explicit reference to their location, meaning that the same code can use the CPU or the GPU as an execution platform. In fact, Thrust permits a run-time choice of the “device back-end” that will be used for execution, with the available alternatives including CUDA, TBB, OpenMP or plain threads. This flexibility and the level of ease-of-use, makes Thrust a prime candidate for parallel program design.

In this ...

Get Multicore and GPU Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.