Skip to main content Link Menu Expand (external link) Document Search Copy Copied

Memory Resources

template <typename Upstream,   typename Bookkeeper> class thrust::mr::disjoint_unsynchronized_pool_resource;
template <typename Upstream,   typename Bookkeeper> struct thrust::mr::disjoint_synchronized_pool_resource;
template <typename Pointer = void *> class thrust::mr::memory_resource;
class thrust::mr::memory_resource< void * >;
class thrust::mr::new_delete_resource;
template <typename Upstream> class thrust::mr::unsynchronized_pool_resource;
struct thrust::mr::pool_options;
template <typename Upstream> struct thrust::mr::synchronized_pool_resource;
typedef see below thrust::system::cpp::memory_resource;
typedef see below thrust::system::cpp::universal_memory_resource;
typedef see below thrust::system::cpp::universal_host_pinned_memory_resource;
typedef see below thrust::system::omp::memory_resource;
typedef see below thrust::system::omp::universal_memory_resource;
typedef see below thrust::system::omp::universal_host_pinned_memory_resource;
typedef see below thrust::system::tbb::memory_resource;
typedef see below thrust::system::tbb::universal_memory_resource;
typedef see below thrust::system::tbb::universal_host_pinned_memory_resource;
template <typename T> using thrust::universal_ptr = see below;
template <typename Upstream,   typename Bookkeeper> __host__ thrust::mr::disjoint_unsynchronized_pool_resource< Upstream, Bookkeeper > & thrust::mr::tls_disjoint_pool(Upstream * upstream = NULL,   Bookkeeper * bookkeeper = NULL);
template <typename Pointer> __host__ __device__ bool thrust::mr::operator==(const memory_resource< Pointer > & lhs,   const memory_resource< Pointer > & rhs);
template <typename Pointer> __host__ __device__ bool thrust::mr::operator!=(const memory_resource< Pointer > & lhs,   const memory_resource< Pointer > & rhs);
template <typename MR> __host__ MR * thrust::mr::get_global_resource();
template <typename Upstream,   typename Bookkeeper> __host__ thrust::mr::unsynchronized_pool_resource< Upstream > & thrust::mr::tls_pool(Upstream * upstream = NULL);

Member Classes

Class thrust::mr::disjoint_unsynchronized_pool_resource

Inherits From:

  • thrust::mr::memory_resource< Upstream::pointer >
  • thrust::mr::validator2< Upstream, Bookkeeper >

Struct thrust::mr::disjoint_synchronized_pool_resource

Inherits From: thrust::mr::memory_resource< Upstream::pointer >

Class thrust::mr::memory_resource

Inherited By:

Class thrust::mr::memory_resource< void * >

Class thrust::mr::new_delete_resource

Inherits From: thrust::mr::memory_resource<>

Class thrust::mr::unsynchronized_pool_resource

Inherits From:

  • thrust::mr::memory_resource< Upstream::pointer >
  • thrust::mr::validator< Upstream >

Struct thrust::mr::pool_options

Struct thrust::mr::synchronized_pool_resource

Inherits From: thrust::mr::memory_resource< Upstream::pointer >

Types

Typedef thrust::system::cpp::memory_resource

typedef detail::native_resourcememory_resource; The memory resource for the Standard C++ system. Uses mr::new_delete_resource and tags it with cpp::pointer.

Typedef thrust::system::cpp::universal_memory_resource

typedef detail::universal_native_resourceuniversal_memory_resource; The unified memory resource for the Standard C++ system. Uses mr::new_delete_resource and tags it with cpp::universal_pointer.

Typedef thrust::system::cpp::universal_host_pinned_memory_resource

typedef detail::native_resourceuniversal_host_pinned_memory_resource; An alias for cpp::universal_memory_resource.

Typedef thrust::system::omp::memory_resource

typedef detail::native_resourcememory_resource; The memory resource for the OpenMP system. Uses mr::new_delete_resource and tags it with omp::pointer.

Typedef thrust::system::omp::universal_memory_resource

typedef detail::universal_native_resourceuniversal_memory_resource; The unified memory resource for the OpenMP system. Uses mr::new_delete_resource and tags it with omp::universal_pointer.

Typedef thrust::system::omp::universal_host_pinned_memory_resource

typedef detail::native_resourceuniversal_host_pinned_memory_resource; An alias for omp::universal_memory_resource.

Typedef thrust::system::tbb::memory_resource

typedef detail::native_resourcememory_resource; The memory resource for the TBB system. Uses mr::new_delete_resource and tags it with tbb::pointer.

Typedef thrust::system::tbb::universal_memory_resource

typedef detail::universal_native_resourceuniversal_memory_resource; The unified memory resource for the TBB system. Uses mr::new_delete_resource and tags it with tbb::universal_pointer.

Typedef thrust::system::tbb::universal_host_pinned_memory_resource

typedef detail::native_resourceuniversal_host_pinned_memory_resource; An alias for tbb::universal_memory_resource.

Type Alias thrust::universal_ptr

template <typename T> using universal_ptr = thrust::system::__THRUST_DEVICE_SYSTEM_NAMESPACE::universal_pointer< T >; universal_ptr stores a pointer to an object allocated in memory accessible to both hosts and devices.

Algorithms dispatched with this type of pointer will be dispatched to either host or device, depending on which backend you are using. Explicit policies (thrust::device, etc) can be used to specify where an algorithm should be run.

universal_ptr has pointer semantics: it may be dereferenced safely from both hosts and devices and may be manipulated with pointer arithmetic.

universal_ptr can be created with universal_allocator or by explicitly calling its constructor with a raw pointer.

The raw pointer encapsulated by a universal_ptr may be obtained by either its get method or the raw_pointer_cast free function.

Note: universal_ptr is not a smart pointer; it is the programmer’s responsibility to deallocate memory pointed to by universal_ptr.

See:

  • host_ptr For the documentation of the complete interface which is shared by universal_ptr.
  • raw_pointer_cast

Functions

Function thrust::mr::tls_disjoint_pool

template <typename Upstream,   typename Bookkeeper> __host__ thrust::mr::disjoint_unsynchronized_pool_resource< Upstream, Bookkeeper > & tls_disjoint_pool(Upstream * upstream = NULL,   Bookkeeper * bookkeeper = NULL); Potentially constructs, if not yet created, and then returns the address of a thread-local disjoint_unsynchronized_pool_resource,

Template Parameters:

  • Upstream the first template argument to the pool template
  • Bookkeeper the second template argument to the pool template

Function Parameters:

  • upstream the first argument to the constructor, if invoked
  • bookkeeper the second argument to the constructor, if invoked

Function thrust::mr::operator==

template <typename Pointer> __host__ __device__ bool operator==(const memory_resource< Pointer > & lhs,   const memory_resource< Pointer > & rhs); Compares the memory resources for equality, first by identity, then by is_equal.

Function thrust::mr::operator!=

template <typename Pointer> __host__ __device__ bool operator!=(const memory_resource< Pointer > & lhs,   const memory_resource< Pointer > & rhs); Compares the memory resources for inequality, first by identity, then by is_equal.

Function thrust::mr::get_global_resource

template <typename MR> __host__ MR * get_global_resource(); Returns a global instance of MR, created as a function local static variable.

Template Parameters: MR: type of a memory resource to get an instance from. Must be DefaultConstructible.

Returns: a pointer to a global instance of MR.

Function thrust::mr::tls_pool

template <typename Upstream,   typename Bookkeeper> __host__ thrust::mr::unsynchronized_pool_resource< Upstream > & tls_pool(Upstream * upstream = NULL); Potentially constructs, if not yet created, and then returns the address of a thread-local unsynchronized_pool_resource,

Template Parameters: Upstream: the template argument to the pool template

Function Parameters: upstream: the argument to the constructor, if invoked