Template Class device_ptr¶
Defined in File device_malloc_allocator.h
Inheritance Relationships¶
Base Type¶
public thrust::pointer< T, thrust::device_system_tag, thrust::device_reference< T >, thrust::device_ptr< T > >
Class Documentation¶
-
template<typename
T>
classdevice_ptr: public thrust::pointer<T, thrust::device_system_tag, thrust::device_reference<T>, thrust::device_ptr<T>>¶ device_ptrstores a pointer to an object allocated in device memory. This type provides type safety when dispatching standard algorithms on ranges resident in device memory.device_ptrhas pointer semantics: it may be dereferenced safely from the host and may be manipulated with pointer arithmetic.device_ptrcan be created with the functions device_malloc, device_new, or device_pointer_cast, or by explicitly calling its constructor with a raw pointer.The raw pointer encapsulated by a
device_ptrmay be obtained by either itsgetmethod or theraw_pointer_castfree function.- Note
device_ptris not a smart pointer; it is the programmer’s responsibility to deallocate memory pointed to bydevice_ptr.- See
- See
- See
- See
Public Functions
-
__host__ __device__ thrust::device_ptr::device_ptr() device_ptr'snull constructor initializes its raw pointer to0.
-
template<typename OtherT>__host__ __device__ thrust::device_ptr::device_ptr(OtherT * ptr) device_ptr'scopy constructor is templated to allow copying to adevice_ptr<const T>from aT *.- Parameters
ptr: A raw pointer to copy from, presumed to point to a location in device memory.
-
__host__ __device__ thrust::device_ptr::device_ptr(T * ptr)
-
template<typename OtherT>__host__ __device__ thrust::device_ptr::device_ptr(const device_ptr < OtherT > & other) device_ptr'scopy constructor allows copying from another device_ptr with related type.- Parameters
other: Thedevice_ptrto copy from.
-
template<typename OtherT>__host__ __device__ device_ptr& thrust::device_ptr::operator=(const device_ptr < OtherT > & other) device_ptr'sassignment operator allows assigning from anotherdevice_ptrwith related type.- Return
*this- Parameters
other: The otherdevice_ptrto copy from.