Thrust Library

Thrust is a parallel algorithms library which resembles the CeePlusPlus StandardTemplateLibrary (STL).


It has been incorporated into CUDA (ComputeUnifiedDeviceArchitecture) by NvidiaCorporation.

The idea is to make it easier to write programs which can run partly on the main compute and partly on a GPGPU (see GeneralPurposeGraphicsProcessUnits)

Part of Thrust is a set of one and two parameter functors. FunctionalProgramming is extended in the latest release (Version 1.5.1) which contains placeholders which mean that transformations can be done on the fly to whole vectors of data.

This example will add one to each element in X and store it in the elements of W.

    using namespace thrust::placeholders;
    thrust::device_vector<int> W(10);
    thrust::device_vector<int> X(10);
    thrust::transform(X.begin(), X.end(), W.begin(), _1+1);

CategoryGpgpu CategoryFunctionalProgramming CategoryCpp

View edit of February 5, 2012 or FindPage with title or text search