KASKADE 7 development version
Classes | Public Types | Public Member Functions | List of all members
Kaskade::NumaAllocator< T > Class Template Reference

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

#include <threading.hh>

Detailed Description

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

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

Definition at line 652 of file 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. More...
 
int node () const
 Reports the node on which we allocate. More...
 
pointer address (reference x) const
 
const_pointer address (const_reference x) const
 
size_type max_size () const
 
pointer allocate (size_type n, std::allocator< void >::const_pointer=0)
 Allocates the requested amount of memory. More...
 
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 More...
 
template<class U >
bool operator!= (NumaAllocator< U > const &other) const
 

Member Typedef Documentation

◆ const_pointer

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

Definition at line 657 of file threading.hh.

◆ const_reference

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

Definition at line 659 of file threading.hh.

◆ difference_type

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

Definition at line 661 of file threading.hh.

◆ pointer

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

Definition at line 656 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 665 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 666 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 667 of file threading.hh.

◆ reference

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

Definition at line 658 of file threading.hh.

◆ size_type

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

Definition at line 660 of file threading.hh.

◆ value_type

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

Definition at line 655 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 681 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 698 of file threading.hh.

◆ address() [2/2]

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

Definition at line 693 of file threading.hh.

◆ allocate()

template<class T >
pointer Kaskade::NumaAllocator< T >::allocate ( size_type  n,
std::allocator< void >::const_pointer  = 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 716 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 731 of file threading.hh.

◆ deallocate()

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

Definition at line 724 of file threading.hh.

◆ destroy()

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

Definition at line 737 of file threading.hh.

◆ max_size()

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

Definition at line 703 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 688 of file threading.hh.

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

◆ operator!=()

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

Definition at line 754 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 748 of file threading.hh.


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