Template Numerical Library version\ main:df396df
|
Cross-device shared smart pointer. More...
#include <TNL/Pointers/SharedPointer.h>
Cross-device shared smart pointer.
This smart pointer is inspired by std::shared_ptr from STL library. It means that the object owned by the smart pointer can be shared with other smart pointers. One can make a copy of this smart pointer. In addition, the smart pointer is able to work across different devices which means that the object owned by the smart pointer is mirrored on both host and device.
**NOTE: When using smart pointers to pass objects on GPU, one must call Pointers::synchronizeSmartPointersOnDevice< Devices::Cuda >() before calling a CUDA kernel working with smart pointers.**
Object | is a type of object to be owned by the pointer. |
Device | is device where the object is to be allocated. The object is always allocated on the host system as well for easier object manipulation. |
See also UniquePointer and DevicePointer.
See also SharedPointer< Object, Devices::Host > and SharedPointer< Object, Devices::Cuda >.