buffer.h
Go to the documentation of this file.
84 allocator_traits::deallocate(m_allocator, static_cast<value_type*>(this->device_private), this->m_size);
100 constexpr const bool is_empty_allocator = std::is_same_v<Allocator, empty_allocator<value_type>>;
108 constexpr const bool is_empty_allocator = std::is_same_v<Allocator, empty_allocator<value_type>>;
272 //std::cout << "buffer " << this << " other " << &db << " mv op ttg_copy " << m_ttg_copy << std::endl;
350 return static_cast<const_pointer_type>(m_data->device_copies[m_data->owner_device]->device_private);
444 void reset(std::shared_ptr<value_type[]> ptr, std::size_t n, ttg::scope scope = ttg::scope::SyncIn) {
482 /* only set device if the host has the latest copy as otherwise we might end up with a stale copy */
constexpr auto data(C &c) -> decltype(c.data())
Definition: span.h:189
ttg::device::Device parsec_device_to_ttg_device(int parsec_id)
Definition: device.h:30
int ttg_device_to_parsec_device(const ttg::device::Device &device)
Definition: device.h:18
parsec_data_t * get_parsec_data(const ttg_parsec::Buffer< T, A > &db)
Definition: buffer.h:545
@ Invalid
@ SyncIn
@ Allocate
Definition: buffer.h:191
Buffer()=default
std::add_pointer_t< value_type > pointer_type
Definition: buffer.h:195
const_pointer_type device_ptr_on(const ttg::device::Device &device) const
Definition: buffer.h:364
void prefer_device(ttg::device::Device dev)
Definition: buffer.h:481
void set_current_device(const ttg::device::Device &device)
Definition: buffer.h:288
const_pointer_type owner_device_ptr() const
Definition: buffer.h:347
void reset(std::shared_ptr< value_type[]> ptr, std::size_t n, ttg::scope scope=ttg::scope::SyncIn)
Definition: buffer.h:444
bool is_valid_on(const ttg::device::Device &device) const
Definition: buffer.h:379
Buffer(const Buffer &db)=delete
ttg::device::Device get_owner_device() const
Definition: buffer.h:315
pointer_type device_ptr_on(const ttg::device::Device &device)
Definition: buffer.h:355
Buffer & operator=(const Buffer &db)=delete
Buffer(std::unique_ptr< value_type[], Deleter > ptr, std::size_t n, ttg::scope scope=ttg::scope::SyncIn)
Definition: buffer.h:241
const_pointer_type current_device_ptr() const
Definition: buffer.h:330
void add_device(ttg::device::Device dev, pointer_type ptr, bool is_current=false)
Definition: buffer.h:489
Buffer(std::shared_ptr< value_type[]> ptr, std::size_t n, ttg::scope scope=ttg::scope::SyncIn)
Definition: buffer.h:232
bool is_current_on(ttg::device::Device dev) const
Definition: buffer.h:298
void allocate_on(const ttg::device::Device &device_id)
Definition: buffer.h:385
const std::remove_const_t< value_type > * const_pointer_type
Definition: buffer.h:196
Buffer(std::size_t n, ttg::scope scope=ttg::scope::SyncIn)
Definition: buffer.h:222
void reset(std::size_t n, ttg::scope scope=ttg::scope::SyncIn)
Definition: buffer.h:436
Definition: buffer.h:30
value_type * allocate(std::size_t size)
Definition: buffer.h:34
void deallocate(value_type *ptr, std::size_t size)
Definition: buffer.h:38
~data_copy_type()
Definition: buffer.h:115
void construct(PtrT ptr, std::size_t size)
Definition: buffer.h:98
data_copy_type & operator=(const data_copy_type &)=delete
void construct(std::size_t size, const allocator_type &alloc=allocator_type())
Definition: buffer.h:106
data_copy_type(const data_copy_type &)=delete
data_copy_type()=default
data_copy_type(data_copy_type &&)=default
data_copy_type & operator=(data_copy_type &&)=default
static PARSEC_OBJ_CLASS_INSTANCE(data_copy_type, parsec_data_copy_t, data_copy_construct, data_copy_destruct)
static void data_copy_destruct(data_copy_type *obj)
Definition: buffer.h:129
static parsec_data_t * create_data(PtrT &ptr, std::size_t size, ttg::scope scope)
Definition: buffer.h:158
typename allocator_traits::value_type value_type
Definition: buffer.h:62
static parsec_data_t * create_data(std::size_t size, ttg::scope scope, const allocator_type &allocator=allocator_type())
Definition: buffer.h:138
static void data_copy_construct(data_copy_type *obj)
Definition: buffer.h:123
typename allocator_traits::allocator_type allocator_type
Definition: buffer.h:61
std::allocator_traits< Allocator > allocator_traits
Definition: buffer.h:60
Definition: ptr.h:15