Template Numerical Library version\ main:bb09b17
|
Specialization of the SharedPointer for the CUDA device. More...
#include <TNL/Pointers/SharedPointerCuda.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> | |
SharedPointer (Args... args) | |
Constructor with parameters of the Object constructor. | |
SharedPointer (const SharedPointer &pointer) | |
Copy constructor. | |
template<typename Object_ , typename = Enabler< Object_ >> | |
SharedPointer (const SharedPointer< Object_, DeviceType > &pointer) | |
Copy constructor. | |
SharedPointer (SharedPointer &&pointer) noexcept | |
Move constructor. | |
template<typename Object_ , typename = Enabler< Object_ >> | |
SharedPointer (SharedPointer< Object_, DeviceType > &&pointer) | |
Move constructor. | |
template<typename Value > | |
SharedPointer (std::initializer_list< std::initializer_list< Value > > list) | |
Constructor with nested initializer lists. | |
template<typename Value > | |
SharedPointer (std::initializer_list< Value > list) | |
Constructor with initializer list. | |
SharedPointer (std::nullptr_t) | |
Constructor of empty pointer. | |
~SharedPointer () override | |
Destructor. | |
void | clear () |
Reset the pointer to empty state. | |
template<typename Device = Devices::Host> | |
__cuda_callable__ const Object & | getData () const |
Constant object reference getter. | |
template<typename Device = Devices::Host> | |
__cuda_callable__ Object & | modifyData () |
Non-constant object reference getter. | |
__cuda_callable__ | operator bool () const |
Conversion to boolean type. | |
__cuda_callable__ bool | operator! () const |
Negation operator. | |
__cuda_callable__ Object & | operator* () |
Dereferencing operator for accessing the object owned by non-constant smart pointer. | |
__cuda_callable__ const Object & | operator* () const |
Dereferencing operator for accessing the object owned by constant smart pointer. | |
__cuda_callable__ Object * | operator-> () |
Arrow operator for accessing the object owned by non-constant smart pointer. | |
__cuda_callable__ const Object * | operator-> () const |
Arrow operator for accessing the object owned by constant smart pointer. | |
const SharedPointer & | operator= (const SharedPointer &ptr) |
Assignment operator. | |
template<typename Object_ , typename = Enabler< Object_ >> | |
const SharedPointer & | operator= (const SharedPointer< Object_, DeviceType > &ptr) |
Assignment operator for compatible object types. | |
const SharedPointer & | operator= (SharedPointer &&ptr) noexcept |
Move operator. | |
template<typename Object_ , typename = Enabler< Object_ >> | |
const SharedPointer & | operator= (SharedPointer< Object_, DeviceType > &&ptr) |
Move operator. | |
template<typename... Args> | |
bool | recreate (Args... args) |
Create new object based in given constructor parameters. | |
void | swap (SharedPointer &ptr2) |
Swap the owned object with another pointer. | |
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 SharedPointer 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.. |
|
inline |
Copy constructor.
pointer | is the source shared pointer. |
|
inline |
Copy constructor.
This is specialization for compatible object types.
pointer | is the source shared pointer. |
|
inlinenoexcept |
Move constructor.
pointer | is the source shared pointer. |
|
inline |
Move constructor.
This is specialization for compatible object types.
pointer | is the source shared pointer. |
|
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.
|
inline |
Assignment operator.
It assigns object owned by the pointer ptr to this pointer.
ptr | input pointer |
|
inline |
Assignment operator for compatible object types.
It assigns object owned by the pointer ptr to this pointer.
ptr | input pointer |
|
inlinenoexcept |
Move operator.
It assigns object owned by the pointer ptr to this pointer.
ptr | input pointer |
|
inline |
Move operator.
It assigns object owned by the pointer ptr to this pointer.
ptr | input pointer |
|
inline |
Create new object based in given constructor parameters.
Args | is variadic template type of arguments to be passed to the object constructor. |
args | are arguments to be passed to the object constructor. |
|
inline |
Swap the owned object with another pointer.
ptr2 | the other shared pointer for swapping. |
|
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.