cub::ThreadStore

Defined in cub/thread/thread_store.cuh

template<CacheStoreModifier MODIFIER, typename OutputIteratorT, typename T>
void cub::ThreadStore(OutputIteratorT itr, T val)

Thread utility for writing memory using cub::CacheStoreModifier cache modifiers.

Can be used to store any data type.

Example

#include <cub/cub.cuh>   // or equivalently <cub/thread/thread_store.cuh>

// 32-bit store using cache-global modifier:
int *d_out;
int val;
cub::ThreadStore<cub::STORE_CG>(d_out + threadIdx.x, val);

// 16-bit store using default modifier
short *d_out;
short val;
cub::ThreadStore<cub::STORE_DEFAULT>(d_out + threadIdx.x, val);

// 256-bit store using write-through modifier
double4 *d_out;
double4 val;
cub::ThreadStore<cub::STORE_WT>(d_out + threadIdx.x, val);

// 96-bit store using cache-streaming cache modifier
struct TestFoo { bool a; short b; };
TestFoo *d_struct;
TestFoo val;
cub::ThreadStore<cub::STORE_CS>(d_out + threadIdx.x, val);

Template Parameters
  • MODIFIER[inferred] CacheStoreModifier enumeration

  • InputIteratorT[inferred] Output iterator type (may be a simple pointer type)

  • T[inferred] Data type of output value