Template Numerical Library version\ main:bb09b17
|
Specialization of the UniquePointer for the CUDA device. More...
#include <TNL/Pointers/UniquePointer.h>
Classes | |
struct | PointerData |
Public Types | |
using | AllocatorType = typename Allocators::Default< DeviceType >::Allocator< ObjectType > |
Type of the allocator for DeviceType. | |
using | DeviceType = Devices::Cuda |
Type of the device where the object is to be mirrored. | |
using | ObjectType = Object |
Type of the object owned by the pointer. | |
Public Member Functions | |
template<typename... Args> | |
UniquePointer (const Args... args) | |
Constructor with parameters of the Object constructor. | |
template<typename Value > | |
UniquePointer (std::initializer_list< std::initializer_list< Value > > list) | |
Constructor with nested initializer lists. | |
template<typename Value > | |
UniquePointer (std::initializer_list< Value > list) | |
Constructor with initializer list. | |
UniquePointer (std::nullptr_t) | |
Constructor of empty pointer. | |
~UniquePointer () override | |
Destructor. | |
template<typename Device = Devices::Host> | |
const Object & | getData () const |
Constant object reference getter. | |
template<typename Device = Devices::Host> | |
Object & | modifyData () |
Non-constant object reference getter. | |
__cuda_callable__ | operator bool () const |
Conversion to boolean type. | |
__cuda_callable__ bool | operator! () const |
Negation operator. | |
Object & | operator* () |
Dereferencing operator for accessing the object owned by non-constant smart pointer. | |
const Object & | operator* () const |
Dereferencing operator for accessing the object owned by constant smart pointer. | |
Object * | operator-> () |
Arrow operator for accessing the object owned by non-constant smart pointer. | |
const Object * | operator-> () const |
Arrow operator for accessing the object owned by constant smart pointer. | |
const UniquePointer & | operator= (UniquePointer &&ptr) noexcept |
Move operator. | |
const UniquePointer & | operator= (UniquePointer &ptr) |
Assignment operator. | |
bool | synchronize () override |
Cross-device pointer synchronization. | |
Public Member Functions inherited from TNL::Pointers::SmartPointer |
Protected Member Functions | |
template<typename... Args> | |
bool | allocate (Args... args) |
void | free () |
bool | modified () |
void | set_last_sync_state () |
Protected Attributes | |
Object * | cuda_pointer |
PointerData * | pd |
Specialization of the UniquePointer for the CUDA device.
Object | is a type of object to be owned by the pointer. |
|
inlineexplicit |
Constructor with parameters of the Object constructor.
Args | is variadic template type of arguments of the Object constructor. |
args | are arguments passed to the Object constructor. |
|
inlineexplicit |
Constructor with initializer list.
Value | is type of the initializer list elements. |
list | is the instance of the initializer list.. |
|
inlineexplicit |
Constructor with nested initializer lists.
Value | is type of the nested initializer list elements. |
list | is the instance of the nested initializer list.. |
|
inlinenodiscard |
Constant object reference getter.
No synchronization of this pointer will be performed due to calling this method.
Device | says what image of the object one want to dereference. It can be either DeviceType or Devices::Host. |
|
inlinenodiscard |
Non-constant object reference getter.
After calling this method, the object owned by the pointer might need to be synchronized. One should not forget to call Pointers::synchronizeSmartPointersOnDevice< Devices::Cuda >() before calling CUDA kernel using object from this smart pointer.
Device | says what image of the object one want to dereference. It can be either DeviceType or Devices::Host. |
|
inline |
Conversion to boolean type.
|
inline |
Negation operator.
|
inline |
Dereferencing operator for accessing the object owned by non-constant smart pointer.
|
inline |
Dereferencing operator for accessing the object owned by constant smart pointer.
|
inline |
Arrow operator for accessing the object owned by non-constant smart pointer.
|
inline |
Arrow operator for accessing the object owned by constant smart pointer.
|
inlinenoexcept |
Move operator.
It assigns object owned by the pointer ptr to this pointer. The original pointer ptr is reset to empty state.
ptr | input pointer |
|
inline |
Assignment operator.
It assigns object owned by the pointer ptr to this pointer. The original pointer ptr is reset to empty state.
ptr | input pointer |
|
inlineoverridevirtual |
Cross-device pointer synchronization.
This method is usually called by the smart pointers register when calling Pointers::synchronizeSmartPointersOnDevice< Devices::Cuda >()
Implements TNL::Pointers::SmartPointer.