CUB
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups
Public Methods | Public Members | List of all members
cub::DoubleBuffer< T > Struct Template Reference

Detailed description

template< typename T>
struct cub::DoubleBuffer< T >

Double-buffer storage wrapper for multi-pass stream transformations that require more than one storage array for streaming intermediate results back and forth.

Many multi-pass computations require a pair of "ping-pong" storage buffers (e.g., one for reading from and the other for writing to, and then vice-versa for the subsequent pass). This structure wraps a set of device buffers and a "selector" member to track which is "current".

Examples:
example_device_radix_sort.cu.

Definition at line 583 of file util_type.cuh.

Public Methods

__host__ __device__ __forceinline__ DoubleBuffer ()
 Constructor.
 
__host__ __device__ __forceinline__ DoubleBuffer (T *d_current, T *d_alternate)
 Constructor. More...
 
__host__ __device__
__forceinline__ T * 
Current ()
 Return pointer to the currently valid buffer.
 
__host__ __device__
__forceinline__ T * 
Alternate ()
 Return pointer to the currently invalid buffer.
 

Public Members

T * d_buffers [2]
 Pair of device buffer pointers.
 
int selector
 Selector into d_buffers (i.e., the active/valid buffer)
 

Constructor & Destructor Documentation

template<typename T>
__host__ __device__ __forceinline__ cub::DoubleBuffer< T >::DoubleBuffer ( T *  d_current,
T *  d_alternate 
)
inline

Constructor.

Parameters
d_currentThe currently valid buffer
d_alternateAlternate storage buffer of the same size as d_current

Definition at line 600 of file util_type.cuh.


The documentation for this struct was generated from the following file: