Template Numerical Library version\ main:6c80161
|
Specialization of the DevicePointer for the CUDA device. More...
#include <TNL/Pointers/DevicePointer.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 | |
DevicePointer (const DevicePointer &pointer) | |
Copy constructor. | |
template<typename Object_ , typename = Enabler< Object_ >> | |
DevicePointer (const DevicePointer< Object_, DeviceType > &pointer) | |
Copy constructor. | |
DevicePointer (DevicePointer &&pointer) noexcept | |
Move constructor. | |
template<typename Object_ , typename = Enabler< Object_ >> | |
DevicePointer (DevicePointer< Object_, DeviceType > &&pointer) | |
Move constructor. | |
DevicePointer (ObjectType &obj) | |
Constructor with an object reference. | |
DevicePointer (std::nullptr_t) | |
Constructor of empty pointer. | |
~DevicePointer () override | |
Destructor. | |
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 DevicePointer & | operator= (const DevicePointer &ptr) |
Assignment operator. | |
template<typename Object_ , typename = Enabler< Object_ >> | |
const DevicePointer & | operator= (const DevicePointer< Object_, DeviceType > &ptr) |
Assignment operator for compatible object types. | |
const DevicePointer & | operator= (DevicePointer &&ptr) noexcept |
Move operator. | |
template<typename Object_ , typename = Enabler< Object_ >> | |
const DevicePointer & | operator= (DevicePointer< Object_, DeviceType > &&ptr) |
Move operator. | |
void | swap (DevicePointer &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 | |
bool | allocate (ObjectType &obj) |
void | free () |
bool | modified () |
void | set_last_sync_state () |
Protected Attributes | |
Object * | cuda_pointer |
PointerData * | pd |
Object * | pointer |
Specialization of the DevicePointer for the CUDA device.
Object | is a type of object to be owned by the pointer. |
|
inlineexplicit |
Constructor with an object reference.
obj | is a reference on an object to be managed by the pointer. |
|
inline |
Copy constructor.
pointer | is the source device pointer. |
|
inline |
Copy constructor.
This is specialization for compatible object types.
pointer | is the source device pointer. |
|
inlinenoexcept |
Move constructor.
pointer | is the source device pointer. |
|
inline |
Move constructor.
This is specialization for compatible object types.
pointer | is the source device 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 |
Swap the owned object with another pointer.
ptr2 | the other device 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.