vSMC
vSMC: Scalable Monte Carlo
Public Types | Public Member Functions | Static Public Member Functions | List of all members
vsmc::CLBuffer< T, ID > Class Template Reference

OpenCL buffer. More...

#include <vsmc/opencl/cl_buffer.hpp>

Public Types

typedef CLManager< ID > manager_type
 
typedef std::size_t size_type
 
typedef T value_type
 

Public Member Functions

 CLBuffer ()
 
 CLBuffer (size_type N,::cl_mem_flags flag=CL_MEM_READ_WRITE, void *host_ptr=nullptr)
 
 CLBuffer (const CLBuffer< T, ID > &other)
 
 CLBuffer (CLBuffer< T, ID > &&other)
 
 ~CLBuffer ()
 
const ::cl::Buffer & data () const
 Read only access to the raw cl::Buffer object. More...
 
::cl_mem_flags flag () const
 
void * host_ptr () const
 
CLBuffer< T, ID > & operator= (const CLBuffer< T, ID > &other)
 
CLBuffer< T, ID > & operator= (CLBuffer< T, ID > &&other)
 
void resize (size_type N)
 
void resize (size_type N,::cl_mem_flags flag)
 
void resize (size_type N,::cl_mem_flags flag, void *host_ptr)
 
size_type size () const
 

Static Public Member Functions

static manager_typemanager ()
 

Detailed Description

template<typename T, typename ID = CLDefault>
class vsmc::CLBuffer< T, ID >

OpenCL buffer.

Unlike cl::Buffer, this class performs deep copy instead of shallow copy. Each CLBuffer object is tied to a specific CLManager, and thus its context and command queue, which are used to create and copy the buffers.

Definition at line 49 of file cl_buffer.hpp.

Member Typedef Documentation

template<typename T, typename ID = CLDefault>
typedef CLManager<ID> vsmc::CLBuffer< T, ID >::manager_type

Definition at line 55 of file cl_buffer.hpp.

template<typename T, typename ID = CLDefault>
typedef std::size_t vsmc::CLBuffer< T, ID >::size_type

Definition at line 54 of file cl_buffer.hpp.

template<typename T, typename ID = CLDefault>
typedef T vsmc::CLBuffer< T, ID >::value_type

Definition at line 53 of file cl_buffer.hpp.

Constructor & Destructor Documentation

template<typename T, typename ID = CLDefault>
vsmc::CLBuffer< T, ID >::CLBuffer ( )
inline

Definition at line 57 of file cl_buffer.hpp.

template<typename T, typename ID = CLDefault>
vsmc::CLBuffer< T, ID >::CLBuffer ( size_type  N,
::cl_mem_flags  flag = CL_MEM_READ_WRITE,
void *  host_ptr = nullptr 
)
inline

Definition at line 60 of file cl_buffer.hpp.

template<typename T, typename ID = CLDefault>
vsmc::CLBuffer< T, ID >::CLBuffer ( const CLBuffer< T, ID > &  other)
inline

Definition at line 66 of file cl_buffer.hpp.

template<typename T, typename ID = CLDefault>
vsmc::CLBuffer< T, ID >::CLBuffer ( CLBuffer< T, ID > &&  other)
inline

Definition at line 101 of file cl_buffer.hpp.

template<typename T, typename ID = CLDefault>
vsmc::CLBuffer< T, ID >::~CLBuffer ( )
inline

Definition at line 126 of file cl_buffer.hpp.

Member Function Documentation

template<typename T, typename ID = CLDefault>
const ::cl::Buffer& vsmc::CLBuffer< T, ID >::data ( ) const
inline

Read only access to the raw cl::Buffer object.

This is alike the data method of C++11 std::vector etc. It provides direct access to the raw buffer.

Definition at line 141 of file cl_buffer.hpp.

template<typename T, typename ID = CLDefault>
::cl_mem_flags vsmc::CLBuffer< T, ID >::flag ( ) const
inline

Definition at line 132 of file cl_buffer.hpp.

template<typename T, typename ID = CLDefault>
void* vsmc::CLBuffer< T, ID >::host_ptr ( ) const
inline

Definition at line 134 of file cl_buffer.hpp.

template<typename T, typename ID = CLDefault>
static manager_type& vsmc::CLBuffer< T, ID >::manager ( )
inlinestatic

Definition at line 128 of file cl_buffer.hpp.

template<typename T, typename ID = CLDefault>
CLBuffer<T, ID>& vsmc::CLBuffer< T, ID >::operator= ( const CLBuffer< T, ID > &  other)
inline

Definition at line 82 of file cl_buffer.hpp.

template<typename T, typename ID = CLDefault>
CLBuffer<T, ID>& vsmc::CLBuffer< T, ID >::operator= ( CLBuffer< T, ID > &&  other)
inline

Definition at line 111 of file cl_buffer.hpp.

template<typename T, typename ID = CLDefault>
void vsmc::CLBuffer< T, ID >::resize ( size_type  N)
inline

Definition at line 143 of file cl_buffer.hpp.

template<typename T, typename ID = CLDefault>
void vsmc::CLBuffer< T, ID >::resize ( size_type  N,
::cl_mem_flags  flag 
)
inline

Definition at line 153 of file cl_buffer.hpp.

template<typename T, typename ID = CLDefault>
void vsmc::CLBuffer< T, ID >::resize ( size_type  N,
::cl_mem_flags  flag,
void *  host_ptr 
)
inline

Definition at line 164 of file cl_buffer.hpp.

template<typename T, typename ID = CLDefault>
size_type vsmc::CLBuffer< T, ID >::size ( ) const
inline

Definition at line 130 of file cl_buffer.hpp.