1 #ifndef TTG_PARSEC_DEVICESCRATCH_H
2 #define TTG_PARSEC_DEVICESCRATCH_H
5 #define TTG_PARSEC_MAX_NUM_DEVICES 4
9 #include <parsec/data_internal.h>
10 #include <parsec/mca/device/device.h>
11 #include <parsec/mca/device/device_gpu.h>
33 static_assert(std::is_trivially_copyable_v<element_type>,
34 "Only trivially copyable types are supported for devices.");
35 static_assert(std::is_default_constructible_v<element_type>,
36 "Only default constructible types are supported for devices.");
40 parsec_data_t* m_data =
nullptr;
43 static parsec_data_t* create_parsec_data(
void *
ptr,
size_t count) {
45 parsec_data_t *
data = parsec_data_create_with_type(
nullptr, 0,
ptr,
47 parsec_datatype_int8_t);
48 data->device_copies[0]->flags |= PARSEC_DATA_FLAG_PARSEC_MANAGED;
49 data->device_copies[0]->coherency_state = PARSEC_DATA_COHERENCY_SHARED;
61 : m_data(create_parsec_data(
ptr, count))
66 m_data->device_copies[0]->version = 1;
84 if (
nullptr != m_data) {
85 parsec_data_discard(m_data);
93 return static_cast<element_type*
>(m_data->device_copies[m_data->owner_device]->device_private);
99 return static_cast<element_type*
>(m_data->device_copies[m_data->owner_device]->device_private);
121 return const_cast<parsec_data_t*
>(scratch.m_data);
constexpr auto data(C &c) -> decltype(c.data())
parsec_data_t * get_parsec_data(const ttg_parsec::Buffer< T, A > &db)
this contains PaRSEC-based TTG functionality
std::decay_t< T > element_type
devicescratch & operator=(devicescratch &&)=delete
devicescratch(devicescratch &&)=delete
devicescratch(const devicescratch &db)=delete
devicescratch(element_type *ptr, ttg::scope scope=ttg::scope::SyncIn, std::size_t count=1)
devicescratch & operator=(const devicescratch &db)=delete
element_type * device_ptr()
const element_type * device_ptr() const