ttg 1.0.0
Template Task Graph (TTG): flowgraph-based programming model for high-performance distributed-memory algorithms
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Friends | List of all members
ttg_parsec::Buffer< T, Allocator > Struct Template Reference

#include <buffer.h>

Public Types

using value_type = std::remove_all_extents_t< T >
 
using pointer_type = std::add_pointer_t< value_type >
 
using const_pointer_type = const std::remove_const_t< value_type > *
 
using element_type = std::decay_t< T >
 

Public Member Functions

 Buffer ()=default
 
 Buffer (std::size_t n, ttg::scope scope=ttg::scope::SyncIn)
 
 Buffer (std::shared_ptr< value_type[]> ptr, std::size_t n, ttg::scope scope=ttg::scope::SyncIn)
 
template<typename Deleter >
 Buffer (std::unique_ptr< value_type[], Deleter > ptr, std::size_t n, ttg::scope scope=ttg::scope::SyncIn)
 
virtual ~Buffer ()
 
 Buffer (Buffer &&db)
 
 Buffer (const Buffer &db)=delete
 
Bufferoperator= (Buffer &&db)
 
Bufferoperator= (const Buffer &db)=delete
 
void set_owner_device (const ttg::device::Device &device)
 
bool is_current_on (ttg::device::Device dev) const
 
ttg::device::Device get_owner_device () const
 
pointer_type current_device_ptr ()
 
const_pointer_type current_device_ptr () const
 
pointer_type owner_device_ptr ()
 
const_pointer_type owner_device_ptr () const
 
pointer_type device_ptr_on (const ttg::device::Device &device)
 
const_pointer_type device_ptr_on (const ttg::device::Device &device) const
 
pointer_type host_ptr ()
 
const_pointer_type host_ptr () const
 
bool is_valid_on (const ttg::device::Device &device) const
 
void allocate_on (const ttg::device::Device &device)
 
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
 
bool empty () const
 
void reset (std::size_t n, ttg::scope scope=ttg::scope::SyncIn)
 
void reset (std::shared_ptr< value_type[]> ptr, std::size_t n, ttg::scope scope=ttg::scope::SyncIn)
 
void clear ()
 
void reset_scope (ttg::scope scope)
 
ttg::scope scope () const
 
void prefer_device (ttg::device::Device dev)
 
void add_device (ttg::device::Device dev, pointer_type ptr, bool is_current=false)
 

Friends

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

Detailed Description

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 247 of file buffer.h.

Member Typedef Documentation

◆ const_pointer_type

template<typename T , typename Allocator >
using ttg_parsec::Buffer< T, Allocator >::const_pointer_type = const std::remove_const_t<value_type>*

Definition at line 252 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 253 of file buffer.h.

◆ pointer_type

template<typename T , typename Allocator >
using ttg_parsec::Buffer< T, Allocator >::pointer_type = std::add_pointer_t<value_type>

Definition at line 251 of file buffer.h.

◆ value_type

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

Definition at line 250 of file buffer.h.

Constructor & Destructor Documentation

◆ Buffer() [1/6]

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

◆ Buffer() [2/6]

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

Definition at line 278 of file buffer.h.

◆ Buffer() [3/6]

template<typename T , typename Allocator >
ttg_parsec::Buffer< T, Allocator >::Buffer ( std::shared_ptr< value_type[]>  ptr,
std::size_t  n,
ttg::scope  scope = ttg::scope::SyncIn 
)
inline

Constructing a buffer using application-managed memory. The shared_ptr will ensure that the memory is not free'd before the runtime has released all of its references.

Definition at line 288 of file buffer.h.

◆ Buffer() [4/6]

template<typename T , typename Allocator >
template<typename Deleter >
ttg_parsec::Buffer< T, Allocator >::Buffer ( std::unique_ptr< value_type[], Deleter >  ptr,
std::size_t  n,
ttg::scope  scope = ttg::scope::SyncIn 
)
inline

Definition at line 297 of file buffer.h.

◆ ~Buffer()

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

Definition at line 305 of file buffer.h.

Here is the call graph for this function:

◆ Buffer() [5/6]

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

Definition at line 311 of file buffer.h.

◆ Buffer() [6/6]

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

Member Function Documentation

◆ add_device()

template<typename T , typename Allocator >
void ttg_parsec::Buffer< T, Allocator >::add_device ( ttg::device::Device  dev,
pointer_type  ptr,
bool  is_current = false 
)
inline

Definition at line 582 of file buffer.h.

Here is the call graph for this function:

◆ allocate_on()

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

Definition at line 443 of file buffer.h.

Here is the call graph for this function:

◆ clear()

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

Clears the buffer. After this operation, the buffer is empty.

Definition at line 540 of file buffer.h.

◆ current_device_ptr() [1/2]

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

Definition at line 380 of file buffer.h.

Here is the call graph for this function:

◆ current_device_ptr() [2/2]

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

Definition at line 388 of file buffer.h.

Here is the call graph for this function:

◆ device_ptr_on() [1/2]

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

Definition at line 413 of file buffer.h.

Here is the call graph for this function:

◆ device_ptr_on() [2/2]

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

Definition at line 422 of file buffer.h.

Here is the call graph for this function:

◆ empty()

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

Definition at line 517 of file buffer.h.

Here is the caller graph for this function:

◆ get_owner_device()

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

Definition at line 373 of file buffer.h.

Here is the call graph for this function:

◆ host_ptr() [1/2]

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

Definition at line 429 of file buffer.h.

◆ host_ptr() [2/2]

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

Definition at line 433 of file buffer.h.

◆ is_current_on()

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

Definition at line 356 of file buffer.h.

Here is the call graph for this function:

◆ is_valid()

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

Definition at line 505 of file buffer.h.

Here is the caller graph for this function:

◆ 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 437 of file buffer.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ operator bool()

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

Definition at line 509 of file buffer.h.

Here is the call graph for this function:

◆ operator=() [1/2]

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

Definition at line 325 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 >
pointer_type ttg_parsec::Buffer< T, Allocator >::owner_device_ptr ( )
inline

Definition at line 398 of file buffer.h.

Here is the call graph for this function:

◆ owner_device_ptr() [2/2]

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

Definition at line 405 of file buffer.h.

Here is the call graph for this function:

◆ pin()

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

Definition at line 481 of file buffer.h.

Here is the call graph for this function:

◆ pin_on()

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

Definition at line 496 of file buffer.h.

Here is the caller graph for this function:

◆ prefer_device()

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

Definition at line 574 of file buffer.h.

Here is the call graph for this function:

◆ reset() [1/2]

template<typename T , typename Allocator >
void ttg_parsec::Buffer< T, Allocator >::reset ( std::shared_ptr< value_type[]>  ptr,
std::size_t  n,
ttg::scope  scope = ttg::scope::SyncIn 
)
inline

Definition at line 529 of file buffer.h.

Here is the call graph for this function:

◆ reset() [2/2]

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

Definition at line 522 of file buffer.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ reset_scope()

template<typename T , typename Allocator >
void ttg_parsec::Buffer< T, Allocator >::reset_scope ( ttg::scope  scope)
inline

Resets the scope of the buffer. If scope is SyncIn then the next time the buffer is made available on a device the host data will be copied from the host. If scope is Allocate then no data will be moved.

Definition at line 552 of file buffer.h.

Here is the call graph for this function:

◆ scope()

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

Definition at line 567 of file buffer.h.

Here is the caller graph for this function:

◆ set_owner_device()

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

Definition at line 344 of file buffer.h.

Here is the call graph for this function:

◆ size()

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

Definition at line 513 of file buffer.h.

◆ unpin()

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

Definition at line 488 of file buffer.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ unpin_on()

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

Definition at line 501 of file buffer.h.

Here is the caller graph for this function:

Friends And Related Symbol 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: