OpenCL C++ Bindings: cl::SVMAllocator< T, SVMTrait > Class Template Reference

OpenCL C++ Bindings

Loading...
Searching...
No Matches
cl::SVMAllocator< T, SVMTrait > Class Template Reference

`#include <opencl.hpp>`

## Classes
struct | rebind

## Public Types
typedef T | value_type
typedef value_type * | pointer
typedef const value_type * | const_pointer
typedef value_type & | reference
typedef const value_type & | const_reference
typedef std::size_t | size_type
typedef std::ptrdiff_t | difference_type

## Public Member Functions
| SVMAllocator (cl::Context context)
| SVMAllocator (const SVMAllocator &other)
template<typename U>
| SVMAllocator (const SVMAllocator< U, SVMTrait > &other)
pointer | address (reference r) noexcept
const_pointer | address (const_reference r) noexcept
pointer | allocate (size_type size, typename cl::SVMAllocator< void, SVMTrait >::const_pointer=0, bool map=true)
void | deallocate (pointer p, size_type)
size_type | max_size () const noexcept
template<class U, class... Args>
void | construct (U *p, Args &&... args)
template<class U>
void | destroy (U *p)
bool | operator== (SVMAllocator const &rhs)
bool | operator!= (SVMAllocator const &a)

## Detailed Description

template<typename T, class SVMTrait>
class cl::SVMAllocator< T, SVMTrait >

STL-like allocator class for managing SVM objects provided for convenience.

Note that while this behaves like an allocator for the purposes of constructing vectors and similar objects, care must be taken when using with smart pointers. The allocator should not be used to construct a unique_ptr if we are using coarse-grained SVM mode because the coarse-grained management behaviour would behave incorrectly with respect to reference counting.

Instead the allocator embeds a Deleter which may be used with unique_ptr and is used with the allocate_shared and allocate_ptr supplied operations.

Definition at line 4082 of file opencl.hpp.

## Member Typedef Documentation

## ◆ const_pointer

template<typename T, class SVMTrait>

typedef const value_type* cl::SVMAllocator< T, SVMTrait >::const_pointer

Definition at line 4089 of file opencl.hpp.

## ◆ const_reference

template<typename T, class SVMTrait>

typedef const value_type& cl::SVMAllocator< T, SVMTrait >::const_reference

Definition at line 4091 of file opencl.hpp.

## ◆ difference_type

template<typename T, class SVMTrait>

typedef std::ptrdiff_t cl::SVMAllocator< T, SVMTrait >::difference_type

Definition at line 4093 of file opencl.hpp.

## ◆ pointer

template<typename T, class SVMTrait>

typedef value_type* cl::SVMAllocator< T, SVMTrait >::pointer

Definition at line 4088 of file opencl.hpp.

## ◆ reference

template<typename T, class SVMTrait>

typedef value_type& cl::SVMAllocator< T, SVMTrait >::reference

Definition at line 4090 of file opencl.hpp.

## ◆ size_type

template<typename T, class SVMTrait>

typedef std::size_t cl::SVMAllocator< T, SVMTrait >::size_type

Definition at line 4092 of file opencl.hpp.

## ◆ value_type

template<typename T, class SVMTrait>

typedef T cl::SVMAllocator< T, SVMTrait >::value_type

Definition at line 4087 of file opencl.hpp.

## Constructor & Destructor Documentation

## ◆ SVMAllocator() [1/4]

template<typename T, class SVMTrait>

cl::SVMAllocator< T, SVMTrait >::SVMAllocator | ( |  | ) |
| inline

Definition at line 4104 of file opencl.hpp.

## ◆ SVMAllocator() [2/4]

template<typename T, class SVMTrait>

cl::SVMAllocator< T, SVMTrait >::SVMAllocator | ( | cl::Context | context | ) |
| inlineexplicit

Definition at line 4109 of file opencl.hpp.

## ◆ SVMAllocator() [3/4]

template<typename T, class SVMTrait>

cl::SVMAllocator< T, SVMTrait >::SVMAllocator | ( | const SVMAllocator< T, SVMTrait > & | other | ) |
| inline

Definition at line 4115 of file opencl.hpp.

## ◆ SVMAllocator() [4/4]

template<typename T, class SVMTrait>
template<typename U>

cl::SVMAllocator< T, SVMTrait >::SVMAllocator | ( | const SVMAllocator< U, SVMTrait > & | other | ) |
| inline

Definition at line 4121 of file opencl.hpp.

## ◆ ~SVMAllocator()

template<typename T, class SVMTrait>

cl::SVMAllocator< T, SVMTrait >::~SVMAllocator | ( |  | ) |
| inline

Definition at line 4126 of file opencl.hpp.

## Member Function Documentation

## ◆ address() [1/2]

template<typename T, class SVMTrait>

const_pointer cl::SVMAllocator< T, SVMTrait >::address | ( | const_reference | r | ) |
| inlinenoexcept

Definition at line 4135 of file opencl.hpp.

## ◆ address() [2/2]

template<typename T, class SVMTrait>

pointer cl::SVMAllocator< T, SVMTrait >::address | ( | reference | r | ) |
| inlinenoexcept

Definition at line 4130 of file opencl.hpp.

## ◆ allocate()

template<typename T, class SVMTrait>

pointer cl::SVMAllocator< T, SVMTrait >::allocate | ( | size_type | size,
|  | typename cl::SVMAllocator< void, SVMTrait >::const_pointer | = 0,
|  | bool | map = true )
| inline

Allocate an SVM pointer.

If the allocator is coarse-grained, this will take ownership to allow containers to correctly construct data in place.

Definition at line 4146 of file opencl.hpp.

## ◆ construct()

template<typename T, class SVMTrait>
template<class U, class... Args>

void cl::SVMAllocator< T, SVMTrait >::construct | ( | U * | p,
|  | Args &&... | args )
| inline

Definition at line 4207 of file opencl.hpp.

## ◆ deallocate()

template<typename T, class SVMTrait>

void cl::SVMAllocator< T, SVMTrait >::deallocate | ( | pointer | p,
|  | size_type | )
| inline

Definition at line 4184 of file opencl.hpp.

## ◆ destroy()

template<typename T, class SVMTrait>
template<class U>

void cl::SVMAllocator< T, SVMTrait >::destroy | ( | U * | p | ) |
| inline

Definition at line 4213 of file opencl.hpp.

## ◆ max_size()

template<typename T, class SVMTrait>

size_type cl::SVMAllocator< T, SVMTrait >::max_size | ( |  | ) | const
| inlinenoexcept

Return the maximum possible allocation size. This is the minimum of the maximum sizes of all devices in the context.

Definition at line 4193 of file opencl.hpp.

## ◆ operator!=()

template<typename T, class SVMTrait>

bool cl::SVMAllocator< T, SVMTrait >::operator!= | ( | SVMAllocator< T, SVMTrait > const & | a | ) |
| inline

Definition at line 4226 of file opencl.hpp.

## ◆ operator==()

template<typename T, class SVMTrait>

bool cl::SVMAllocator< T, SVMTrait >::operator== | ( | SVMAllocator< T, SVMTrait > const & | rhs | ) |
| inline

Returns true if the contexts match.

Definition at line 4221 of file opencl.hpp.

## Friends And Related Symbol Documentation

## ◆ SVMAllocator

template<typename T, class SVMTrait>
template<typename U, typename V>

friend class SVMAllocator
| friend

Definition at line 4102 of file opencl.hpp.

The documentation for this class was generated from the following file:

- opencl.hpp