cuda-api-wrappers
Thin C++-flavored wrappers for the CUDA Runtime API
Namespaces | Typedefs | Functions
unique_ptr.hpp File Reference

A smart pointer for CUDA device- and host-side memory, similar to the standard library's ::std::unique_ptr. More...

#include "current_device.hpp"
#include "current_context.hpp"
#include "primary_context.hpp"
#include "memory.hpp"
Include dependency graph for unique_ptr.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

 cuda
 All definitions and functionality wrapping the CUDA Runtime API.
 
 cuda::memory::device
 CUDA-Device-global memory on a single device (not accessible from the host)
 
 cuda::memory::managed
 This type of memory, also known as unified memory, appears within a unified, all-system address space - and is used with the same address range on the host and on all relevant CUDA devices on a system.
 

Typedefs

template<typename T >
using cuda::memory::device::unique_ptr = ::std::unique_ptr< T, detail_::deleter >
 
template<typename T >
using cuda::memory::host::unique_ptr = ::std::unique_ptr< T, detail_::deleter >
 
template<typename T >
using cuda::memory::managed::unique_ptr = ::std::unique_ptr< T, detail_::deleter >
 

Functions

template<typename T >
unique_ptr< T > cuda::memory::device::make_unique (const context_t &context, size_t num_elements)
 Create a variant of ::std::unique_pointer for an array in device-global memory. More...
 
template<typename T >
unique_ptr< T > cuda::memory::device::make_unique (const device_t &device, size_t num_elements)
 Create a variant of ::std::unique_pointer for an array in device-global memory. More...
 
template<typename T >
unique_ptr< T > cuda::memory::device::make_unique (size_t num_elements)
 Create a variant of ::std::unique_pointer for an array in device-global memory on the current device. More...
 
template<typename T >
unique_ptr< T > cuda::memory::device::make_unique (const context_t &context)
 Create a variant of ::std::unique_pointer for a single value in device-global memory. More...
 
template<typename T >
unique_ptr< T > cuda::memory::device::make_unique (const device_t &device)
 Create a variant of ::std::unique_pointer for a single value in device-global memory. More...
 
template<typename T >
unique_ptr< T > cuda::memory::device::make_unique ()
 Create a variant of ::std::unique_pointer for a single value in device-global memory, on the current device. More...
 
template<typename T >
device::unique_ptr< T > cuda::memory::make_unique (const context_t &context, size_t num_elements)
 See device::make_unique(const context_t& context, size_t num_elements)
 
template<typename T >
device::unique_ptr< T > cuda::memory::make_unique (const device_t &device, size_t num_elements)
 See device::make_unique(const device_t& device, size_t num_elements)
 
template<typename T >
device::unique_ptr< T > cuda::memory::make_unique (const device_t &device)
 See device::make_unique(const device_t& device)
 
template<typename T >
unique_ptr< T > cuda::memory::host::make_unique (size_t n)
 
template<typename T >
unique_ptr< T > cuda::memory::host::make_unique ()
 
template<typename T >
unique_ptr< T > cuda::memory::managed::make_unique (const context_t &context, size_t n, initial_visibility_t initial_visibility)
 
template<typename T >
unique_ptr< T > cuda::memory::managed::make_unique (const device_t &device, size_t n, initial_visibility_t initial_visibility)
 
template<typename T >
unique_ptr< T > cuda::memory::managed::make_unique (size_t n, initial_visibility_t initial_visibility)
 
template<typename T >
unique_ptr< T > cuda::memory::managed::make_unique (const context_t &context, initial_visibility_t initial_visibility)
 
template<typename T >
unique_ptr< T > cuda::memory::managed::make_unique (device_t device, initial_visibility_t initial_visibility=initial_visibility_t::to_all_devices)
 
template<typename T >
unique_ptr< T > cuda::memory::managed::make_unique (initial_visibility_t initial_visibility)
 

Detailed Description

A smart pointer for CUDA device- and host-side memory, similar to the standard library's ::std::unique_ptr.

Note
Unique pointers, like any (wrapped) memory allocations, do not extend the lifetime of contexts (primary or otherwise). In particular, they do not increase primary context refcounts.