OpenFPM_pdata  4.1.0
Project that contain the implementation of distributed structures
 
Loading...
Searching...
No Matches
cub::DoubleBuffer< T > Struct Template Reference

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

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".

Definition at line 791 of file util_type.cuh.

Public Member Functions

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

Data Fields

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

Constructor & Destructor Documentation

◆ DoubleBuffer() [1/2]

template<typename T >
__host__ __device__ __forceinline__ cub::DoubleBuffer< T >::DoubleBuffer ( )
inline

Constructor.

Definition at line 800 of file util_type.cuh.

◆ DoubleBuffer() [2/2]

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 808 of file util_type.cuh.

Member Function Documentation

◆ Alternate()

template<typename T >
__host__ __device__ __forceinline__ T * cub::DoubleBuffer< T >::Alternate ( )
inline

Return pointer to the currently invalid buffer.

Definition at line 821 of file util_type.cuh.

◆ Current()

template<typename T >
__host__ __device__ __forceinline__ T * cub::DoubleBuffer< T >::Current ( )
inline

Return pointer to the currently valid buffer.

Definition at line 818 of file util_type.cuh.

Field Documentation

◆ d_buffers

template<typename T >
T* cub::DoubleBuffer< T >::d_buffers[2]

Pair of device buffer pointers.

Definition at line 794 of file util_type.cuh.

◆ selector

template<typename T >
int cub::DoubleBuffer< T >::selector

Selector into d_buffers (i.e., the active/valid buffer)

Definition at line 797 of file util_type.cuh.


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