KASKADE 7 development version
Loading...
Searching...
No Matches
Kaskade::NumaAllocator< T > Class Template Reference

An STL allocator that uses memory of a specific NUMA node only. More...

#include <threading.hh>

Classes

struct  rebind

Public Types

typedef T value_type
typedef T * pointer
typedef T const * const_pointer
typedef T & reference
typedef T const & const_reference
typedef std::size_t size_type
typedef std::ptrdiff_t difference_type
typedef std::true_type propagate_on_container_copy_assignment
typedef std::true_type propagate_on_container_move_assignment
typedef std::true_type propagate_on_container_swap

Public Member Functions

 NumaAllocator (int node)
 Construct an allocator for allocating on the given NUMA node.
int node () const
 Reports the node on which we allocate.
pointer address (reference x) const
const_pointer address (const_reference x) const
size_type max_size () const
pointer allocate (size_type n, void *=0)
 Allocates the requested amount of memory.
void deallocate (pointer p, size_type n)
template<class U, class... Args>
void construct (U *p, Args &&... args)
template<class U>
void destroy (U *p)
template<class U>
bool operator== (NumaAllocator< U > const &other) const
 comparison for equality
template<class U>
bool operator!= (NumaAllocator< U > const &other) const

Detailed Description

template<class T>
class Kaskade::NumaAllocator< T >

An STL allocator that uses memory of a specific NUMA node only.

Definition at line 665 of file threading.hh.

Member Typedef Documentation

◆ const_pointer

template<class T>
typedef T const* Kaskade::NumaAllocator< T >::const_pointer

Definition at line 670 of file threading.hh.

◆ const_reference

template<class T>
typedef T const& Kaskade::NumaAllocator< T >::const_reference

Definition at line 672 of file threading.hh.

◆ difference_type

template<class T>
typedef std::ptrdiff_t Kaskade::NumaAllocator< T >::difference_type

Definition at line 674 of file threading.hh.

◆ pointer

template<class T>
typedef T* Kaskade::NumaAllocator< T >::pointer

Definition at line 669 of file threading.hh.

◆ propagate_on_container_copy_assignment

template<class T>
typedef std::true_type Kaskade::NumaAllocator< T >::propagate_on_container_copy_assignment

Definition at line 678 of file threading.hh.

◆ propagate_on_container_move_assignment

template<class T>
typedef std::true_type Kaskade::NumaAllocator< T >::propagate_on_container_move_assignment

Definition at line 679 of file threading.hh.

◆ propagate_on_container_swap

template<class T>
typedef std::true_type Kaskade::NumaAllocator< T >::propagate_on_container_swap

Definition at line 680 of file threading.hh.

◆ reference

template<class T>
typedef T& Kaskade::NumaAllocator< T >::reference

Definition at line 671 of file threading.hh.

◆ size_type

template<class T>
typedef std::size_t Kaskade::NumaAllocator< T >::size_type

Definition at line 673 of file threading.hh.

◆ value_type

template<class T>
typedef T Kaskade::NumaAllocator< T >::value_type

Definition at line 668 of file threading.hh.

Constructor & Destructor Documentation

◆ NumaAllocator()

template<class T>
Kaskade::NumaAllocator< T >::NumaAllocator ( int node)
inline

Construct an allocator for allocating on the given NUMA node.

Parameters
nodethe NUMA node on which to allocate the memory. This has to be less than NumaThreadPool::instance().nodes(). For negative values, the memory is allocated in interleaved mode.

Definition at line 694 of file threading.hh.

Member Function Documentation

◆ address() [1/2]

template<class T>
const_pointer Kaskade::NumaAllocator< T >::address ( const_reference x) const
inline

Definition at line 711 of file threading.hh.

◆ address() [2/2]

template<class T>
pointer Kaskade::NumaAllocator< T >::address ( reference x) const
inline

Definition at line 706 of file threading.hh.

◆ allocate()

template<class T>
pointer Kaskade::NumaAllocator< T >::allocate ( size_type n,
void * = 0 )
inline

Allocates the requested amount of memory.

Parameters
nnumber of objects of type T

If

  • n == 0, a null pointer is returned. If the request cannot be fulfilled, std::bad_alloc is thrown.

Definition at line 729 of file threading.hh.

◆ construct()

template<class T>
template<class U, class... Args>
void Kaskade::NumaAllocator< T >::construct ( U * p,
Args &&... args )
inline

Definition at line 744 of file threading.hh.

◆ deallocate()

template<class T>
void Kaskade::NumaAllocator< T >::deallocate ( pointer p,
size_type n )
inline

Definition at line 737 of file threading.hh.

◆ destroy()

template<class T>
template<class U>
void Kaskade::NumaAllocator< T >::destroy ( U * p)
inline

Definition at line 750 of file threading.hh.

◆ max_size()

template<class T>
size_type Kaskade::NumaAllocator< T >::max_size ( ) const
inline

Definition at line 716 of file threading.hh.

◆ node()

template<class T>
int Kaskade::NumaAllocator< T >::node ( ) const
inline

Reports the node on which we allocate.

Definition at line 701 of file threading.hh.

Referenced by Kaskade::NumaAllocator< U >::operator!=(), and Kaskade::NumaAllocator< U >::operator==().

◆ operator!=()

template<class T>
template<class U>
bool Kaskade::NumaAllocator< T >::operator!= ( NumaAllocator< U > const & other) const
inline

Definition at line 767 of file threading.hh.

◆ operator==()

template<class T>
template<class U>
bool Kaskade::NumaAllocator< T >::operator== ( NumaAllocator< U > const & other) const
inline

comparison for equality

Allocators compare equal, if they allocate on the same NUMA node.

Definition at line 761 of file threading.hh.


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