ttg_parsec::Buffer< T, Allocator > Struct Template Reference
Inheritance diagram for ttg_parsec::Buffer< T, Allocator >:
ttg_parsec::detail::ttg_parsec_data_wrapper_t

Documentation

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

A buffer that is mirrored between host memory and different devices. The runtime is free to move data between device and host memory based on where the tasks are executing.

Note that a buffer is movable and should not be shared between two objects (e.g., through a pointer) in order for TTG to properly facilitate ownership tracking of the containing object.

Definition at line 40 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)
 
void prefer_device (ttg::device::Device dev)
 

Friends

parsec_data_t * detail::get_parsec_data (const ttg_parsec::Buffer< T, Allocator > &)
 

Additional Inherited Members

- Protected Types inherited from ttg_parsec::detail::ttg_parsec_data_wrapper_t
using parsec_data_ptr = std::unique_ptr< parsec_data_t, decltype(&parsec_data_destroy)>
 
- Protected Member Functions inherited from ttg_parsec::detail::ttg_parsec_data_wrapper_t
parsec_data_t * parsec_data ()
 
const parsec_data_t * parsec_data () const
 
void remove_from_owner ()
 
void reset_parsec_data (void *ptr, size_t size)
 
 ttg_parsec_data_wrapper_t ()
 
 ttg_parsec_data_wrapper_t (const ttg_parsec_data_wrapper_t &other)=delete
 
 ttg_parsec_data_wrapper_t (ttg_parsec_data_wrapper_t &&other)
 
ttg_parsec_data_wrapper_toperator= (const ttg_parsec_data_wrapper_t &other)=delete
 
ttg_parsec_data_wrapper_toperator= (ttg_parsec_data_wrapper_t &&other)
 
virtual ~ttg_parsec_data_wrapper_t ()
 
void set_owner (ttg_data_copy_t &new_copy)
 
- Static Protected Member Functions inherited from ttg_parsec::detail::ttg_parsec_data_wrapper_t
static parsec_data_t * create_parsec_data (void *ptr, size_t size)
 
static void delete_parsec_data (parsec_data_t *data)
 
static void delete_null_parsec_data (parsec_data_t *)
 
- Protected Attributes inherited from ttg_parsec::detail::ttg_parsec_data_wrapper_t
ttg_data_copy_tm_ttg_copy = nullptr
 
parsec_data_ptr m_data
 
friend ttg_data_copy_t
 

Member Typedef Documentation

◆ allocator_traits

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

Definition at line 45 of file buffer.h.

◆ allocator_type

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

Definition at line 46 of file buffer.h.

◆ element_type

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

Definition at line 43 of file buffer.h.

Constructor & Destructor Documentation

◆ Buffer() [1/5]

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

Definition at line 79 of file buffer.h.

◆ Buffer() [2/5]

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

Definition at line 82 of file buffer.h.

◆ Buffer() [3/5]

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

Definition at line 99 of file buffer.h.

◆ ~Buffer()

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

Definition at line 113 of file buffer.h.

◆ Buffer() [4/5]

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

Definition at line 122 of file buffer.h.

◆ Buffer() [5/5]

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

Member Function Documentation

◆ allocate_on()

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

Definition at line 237 of file buffer.h.

◆ current_device_ptr() [1/2]

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

Definition at line 180 of file buffer.h.

◆ current_device_ptr() [2/2]

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

Definition at line 187 of file buffer.h.

◆ device_ptr_on() [1/2]

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

Definition at line 209 of file buffer.h.

◆ device_ptr_on() [2/2]

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

Definition at line 217 of file buffer.h.

◆ get_owner_device()

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

Definition at line 174 of file buffer.h.

◆ host_ptr() [1/2]

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

Definition at line 223 of file buffer.h.

◆ host_ptr() [2/2]

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

Definition at line 227 of file buffer.h.

◆ is_valid()

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

Definition at line 271 of file buffer.h.

◆ is_valid_on()

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

Definition at line 231 of file buffer.h.

◆ operator bool()

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

Definition at line 275 of file buffer.h.

◆ operator=() [1/2]

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

Definition at line 140 of file buffer.h.

◆ operator=() [2/2]

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

◆ owner_device_ptr() [1/2]

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

Definition at line 196 of file buffer.h.

◆ owner_device_ptr() [2/2]

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

Definition at line 202 of file buffer.h.

◆ pin()

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

Definition at line 247 of file buffer.h.

◆ pin_on()

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

Definition at line 262 of file buffer.h.

◆ prefer_device()

template<typename T , typename Allocator >
void ttg_parsec::Buffer< T, Allocator >::prefer_device ( ttg::device::Device  dev)
inline

Definition at line 332 of file buffer.h.

◆ reset() [1/2]

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

Definition at line 284 of file buffer.h.

◆ reset() [2/2]

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

Definition at line 307 of file buffer.h.

◆ set_current_device()

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

Definition at line 162 of file buffer.h.

◆ size()

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

Definition at line 279 of file buffer.h.

◆ unpin()

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

Definition at line 254 of file buffer.h.

◆ unpin_on()

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

Definition at line 267 of file buffer.h.

Friends And Related Function Documentation

◆ detail::get_parsec_data

template<typename T , typename Allocator >
parsec_data_t* detail::get_parsec_data ( const ttg_parsec::Buffer< T, Allocator > &  )
friend

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