cuda thrust function

is there a guide or table list on all the function that thrust provide, for example whats the syntax for sort, mean, etc etc. thx also any other type of library similar to thrust but better performance?

start with the quickstart guide:

then, for algorithm reference, there is documentation:

and you can also refer to a bunch of example codes:

Another library somewhat similar to thrust is cub:

A good chunk of some of the Thrust stuff has CUB in it too. I’ve seen some of the error messages and CUB stuff has been included (like their single-pass prefix sum).

There’s also modern GPU as a library as well:

Check out the wiki!

never heard CUB before, in term of performance, reliability, easiness to code, is thrust generally better? it seem thrust is widely used.

Thrust is like the STL from C++. It was never meant to be a high-performance library for specialized problems. Instead, it’s a collection of general-purpose algorithms that are still performant but can be outclassed by specialized approaches.

CUB is highly-optimized low-level basic routines. ModernGPU is similar to CUB, but more researching-oriented - i.e. not so highly-optimized, but still holds overall 2nd place. It also includes interesting guide that shows HOW to solve problems rather than provide ready-to-use instruments. Thrust is high-level easy-to-use STL-imitating set of routines, with emphasis on easiness rather than raw perfromance. Also, each library provides its own set of algorithms, f.e. MGPU lacks radix sort, while CUB lacks merge-sort.

So, choosing right library depends on specific algorithms you need and time you want to spend learning/using the libraries. Anyway, it’s recommended to start with Thrust and go further only if it doesn’t serve your needs.

It’s easier to start learning Thrust with videos, in particular GTC talks. F.e. these are slides from one of these talks: