ttg_madness::Buffer< T, Allocator > Struct Template Reference
Inheritance diagram for ttg_madness::Buffer< T, Allocator >:

Documentation

template<typename T, typename Allocator>
struct ttg_madness::Buffer< T, Allocator >

A runtime-managed buffer mirrored between host and device memory.

Definition at line 10 of file buffer.h.

Public Types

using element_type = std::decay_t< T >
 
using allocator_traits = std::allocator_traits< Allocator >
 
using allocator_type = typename allocator_traits::allocator_type
 

Public Member Functions

 Buffer ()
 
 Buffer (std::size_t n)
 
 Buffer (element_type *ptr, std::size_t n=1)
 
virtual ~Buffer ()
 
 Buffer (Buffer &&db)
 
 Buffer (const Buffer &db)=delete
 
Bufferoperator= (Buffer &&db)
 
Bufferoperator= (const Buffer &db)=delete
 
void set_current_device (const ttg::device::Device &device)
 
ttg::device::Device get_owner_device () const
 
element_typecurrent_device_ptr ()
 
const element_typecurrent_device_ptr () const
 
element_typeowner_device_ptr ()
 
const element_typeowner_device_ptr () const
 
element_typedevice_ptr_on (const ttg::device::Device &device)
 
const element_typedevice_ptr_on (const ttg::device::Device &device) const
 
element_typehost_ptr ()
 
const element_typehost_ptr () const
 
bool is_valid_on (const ttg::device::Device &device) const
 
void allocate_on (const ttg::device::Device &device_id)
 
void pin ()
 
void unpin ()
 
void pin_on (int device_id)
 
void unpin_on (int device_id)
 
bool is_valid () const
 
 operator bool () const
 
std::size_t size () const
 
void reset (std::size_t n)
 
void reset (T *ptr, std::size_t n=1)
 

Member Typedef Documentation

◆ allocator_traits

template<typename T , typename Allocator >
using ttg_madness::Buffer< T, Allocator >::allocator_traits = std::allocator_traits<Allocator>

Definition at line 14 of file buffer.h.

◆ allocator_type

template<typename T , typename Allocator >
using ttg_madness::Buffer< T, Allocator >::allocator_type = typename allocator_traits::allocator_type

Definition at line 15 of file buffer.h.

◆ element_type

template<typename T , typename Allocator >
using ttg_madness::Buffer< T, Allocator >::element_type = std::decay_t<T>

Definition at line 12 of file buffer.h.

Constructor & Destructor Documentation

◆ Buffer() [1/5]

template<typename T , typename Allocator >
ttg_madness::Buffer< T, Allocator >::Buffer ( )
inline

Definition at line 46 of file buffer.h.

◆ Buffer() [2/5]

template<typename T , typename Allocator >
ttg_madness::Buffer< T, Allocator >::Buffer ( std::size_t  n)
inline

Definition at line 49 of file buffer.h.

◆ Buffer() [3/5]

template<typename T , typename Allocator >
ttg_madness::Buffer< T, Allocator >::Buffer ( element_type ptr,
std::size_t  n = 1 
)
inline

Definition at line 59 of file buffer.h.

◆ ~Buffer()

template<typename T , typename Allocator >
virtual ttg_madness::Buffer< T, Allocator >::~Buffer ( )
inlinevirtual

Definition at line 66 of file buffer.h.

◆ Buffer() [4/5]

template<typename T , typename Allocator >
ttg_madness::Buffer< T, Allocator >::Buffer ( Buffer< T, Allocator > &&  db)
inline

Definition at line 75 of file buffer.h.

◆ Buffer() [5/5]

template<typename T , typename Allocator >
ttg_madness::Buffer< T, Allocator >::Buffer ( const Buffer< T, Allocator > &  db)
delete

Member Function Documentation

◆ allocate_on()

template<typename T , typename Allocator >
void ttg_madness::Buffer< T, Allocator >::allocate_on ( const ttg::device::Device device_id)
inline

Definition at line 176 of file buffer.h.

◆ current_device_ptr() [1/2]

template<typename T , typename Allocator >
element_type* ttg_madness::Buffer< T, Allocator >::current_device_ptr ( )
inline

Definition at line 121 of file buffer.h.

◆ current_device_ptr() [2/2]

template<typename T , typename Allocator >
const element_type* ttg_madness::Buffer< T, Allocator >::current_device_ptr ( ) const
inline

Definition at line 127 of file buffer.h.

◆ device_ptr_on() [1/2]

template<typename T , typename Allocator >
element_type* ttg_madness::Buffer< T, Allocator >::device_ptr_on ( const ttg::device::Device device)
inline

Definition at line 148 of file buffer.h.

◆ device_ptr_on() [2/2]

template<typename T , typename Allocator >
const element_type* ttg_madness::Buffer< T, Allocator >::device_ptr_on ( const ttg::device::Device device) const
inline

Definition at line 156 of file buffer.h.

◆ get_owner_device()

template<typename T , typename Allocator >
ttg::device::Device ttg_madness::Buffer< T, Allocator >::get_owner_device ( ) const
inline

Definition at line 115 of file buffer.h.

◆ host_ptr() [1/2]

template<typename T , typename Allocator >
element_type* ttg_madness::Buffer< T, Allocator >::host_ptr ( )
inline

Definition at line 162 of file buffer.h.

◆ host_ptr() [2/2]

template<typename T , typename Allocator >
const element_type* ttg_madness::Buffer< T, Allocator >::host_ptr ( ) const
inline

Definition at line 166 of file buffer.h.

◆ is_valid()

template<typename T , typename Allocator >
bool ttg_madness::Buffer< T, Allocator >::is_valid ( void  ) const
inline

Definition at line 205 of file buffer.h.

◆ is_valid_on()

template<typename T , typename Allocator >
bool ttg_madness::Buffer< T, Allocator >::is_valid_on ( const ttg::device::Device device) const
inline

Definition at line 170 of file buffer.h.

◆ operator bool()

template<typename T , typename Allocator >
ttg_madness::Buffer< T, Allocator >::operator bool ( ) const
inline

Definition at line 209 of file buffer.h.

◆ operator=() [1/2]

template<typename T , typename Allocator >
Buffer& ttg_madness::Buffer< T, Allocator >::operator= ( Buffer< T, Allocator > &&  db)
inline

Definition at line 92 of file buffer.h.

◆ operator=() [2/2]

template<typename T , typename Allocator >
Buffer& ttg_madness::Buffer< T, Allocator >::operator= ( const Buffer< T, Allocator > &  db)
delete

◆ owner_device_ptr() [1/2]

template<typename T , typename Allocator >
element_type* ttg_madness::Buffer< T, Allocator >::owner_device_ptr ( )
inline

Definition at line 135 of file buffer.h.

◆ owner_device_ptr() [2/2]

template<typename T , typename Allocator >
const element_type* ttg_madness::Buffer< T, Allocator >::owner_device_ptr ( ) const
inline

Definition at line 141 of file buffer.h.

◆ pin()

template<typename T , typename Allocator >
void ttg_madness::Buffer< T, Allocator >::pin ( )
inline

Definition at line 186 of file buffer.h.

◆ pin_on()

template<typename T , typename Allocator >
void ttg_madness::Buffer< T, Allocator >::pin_on ( int  device_id)
inline

Definition at line 196 of file buffer.h.

◆ reset() [1/2]

template<typename T , typename Allocator >
void ttg_madness::Buffer< T, Allocator >::reset ( std::size_t  n)
inline

Definition at line 218 of file buffer.h.

◆ reset() [2/2]

template<typename T , typename Allocator >
void ttg_madness::Buffer< T, Allocator >::reset ( T *  ptr,
std::size_t  n = 1 
)
inline

Definition at line 236 of file buffer.h.

◆ set_current_device()

template<typename T , typename Allocator >
void ttg_madness::Buffer< T, Allocator >::set_current_device ( const ttg::device::Device device)
inline

Definition at line 107 of file buffer.h.

◆ size()

template<typename T , typename Allocator >
std::size_t ttg_madness::Buffer< T, Allocator >::size ( ) const
inline

Definition at line 213 of file buffer.h.

◆ unpin()

template<typename T , typename Allocator >
void ttg_madness::Buffer< T, Allocator >::unpin ( )
inline

Definition at line 191 of file buffer.h.

◆ unpin_on()

template<typename T , typename Allocator >
void ttg_madness::Buffer< T, Allocator >::unpin_on ( int  device_id)
inline

Definition at line 201 of file buffer.h.


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