1MEMKINDALLOCATOR(3)            MEMKINDALLOCATOR            MEMKINDALLOCATOR(3)
2
3
4

NAME

6       libmemkind::static_kind::allocator<T>  -  The  C++ allocator compatible
7       with the C++ standard library allocator concepts
8       Note: memkind_allocator.h functionality is  considered  as  stable  API
9       (STANDARD API).
10

SYNOPSIS

12       #include <memkind_allocator.h>
13
14       Link with -lmemkind
15
16       libmemkind::static_kind::allocator(libmemkind::kinds kind);
17       template <typename U> libmemkind::static_kind::allocator<T>::allocator(const libmemkind::static_kind::allocator<U>&) noexcept;
18       template <typename U> libmemkind::static_kind::allocator(const allocator<U>&& other) noexcept;
19       libmemkind::static_kind::allocator<T>::~allocator();
20       T *libmemkind::static_kind::allocator<T>::allocate(std::size_t n) const;
21       void libmemkind::static_kind::allocator<T>::deallocate(T *p, std::size_t n) const;
22       template <class U, class... Args> void libmemkind::static_kind::allocator<T>::construct(U *p, Args... args) const;
23       void libmemkind::static_kind::allocator<T>::destroy(T *p) const;
24

DESCRIPTION

26       The  libmemkind::static_kind::allocator<T>  is intended to be used with
27       STL containers to allocate from static kinds memory. Memory  management
28       is  based  on  memkind  library. Refer memkind(3) man page for more de‐
29       tails.
30
31       The libmemkind::kinds specifies allocator static kinds of memory,  rep‐
32       resenting  type  of  memory which offers different characteristics. The
33       available types of allocator kinds of memory:
34
35       libmemkind::kinds::DEFAULT Default allocation using standard memory and
36       default page size.
37
38       libmemkind::kinds::HUGETLB  Allocate  from  standard  memory using huge
39       pages. Note: This kind requires huge pages configuration  described  in
40       SYSTEM CONFIGURATION section.
41
42       libmemkind::kinds::INTERLEAVE  Allocate  pages  interleaved  across all
43       NUMA nodes with transparent huge pages disabled.
44
45       libmemkind::kinds::HBW Allocate from the closest high bandwidth  memory
46       NUMA  node at the time of allocation. If there is not enough high band‐
47       width memory to satisfy the request, errno is set to ENOMEM and the al‐
48       located pointer is set to NULL.
49
50       libmemkind::kinds::HBW_ALL  Same as libmemkind::kinds::HBW except deci‐
51       sion regarding closest NUMA node is postponed until the time  of  first
52       write.
53
54       libmemkind::kinds::HBW_HUGETLB  Same  as  libmemkind::kinds::HBW except
55       the allocation is backed by huge pages. Note: This kind  requires  huge
56       pages configuration described in SYSTEM CONFIGURATION section.
57
58       libmemkind::kinds::HBW_ALL_HUGETLB       Combination       of      lib‐
59       memkind::kinds::HBW_ALL and libmemkind::kinds::HBW_HUGETLB  properties.
60       Note:  This  kind requires huge pages configuration described in SYSTEM
61       CONFIGURATION section.
62
63       libmemkind::kinds::HBW_PREFERRED Same as libmemkind::kinds::HBW  except
64       that  if  there  is not enough high bandwidth memory to satisfy the re‐
65       quest, the allocation will fall back on standard memory.
66
67       libmemkind::kinds::HBW_PREFERRED_HUGETLB       Same       as       lib‐
68       memkind::kinds::HBW_PREFERRED  except  the allocation is backed by huge
69       pages. Note: This kind requires huge pages configuration  described  in
70       SYSTEM CONFIGURATION section.
71
72       libmemkind::kinds::HBW_INTERLEAVE Same as libmemkind::kinds::HBW except
73       that the pages that support the allocation are interleaved  across  all
74       high bandwidth nodes and transparent huge pages are disabled.
75
76       libmemkind::kinds::REGULAR  Allocate  from regular memory using the de‐
77       fault page size. Regular means general purpose  memory  from  the  NUMA
78       nodes containing CPUs.
79
80       libmemkind::kinds::DAX_KMEM Allocate from the closest persistent memory
81       NUMA node at the time of allocation. If there is not enough  memory  in
82       the  closest  persistent memory NUMA node to satisfy the request, errno
83       is set to ENOMEM and the allocated pointer is set to NULL.
84
85       libmemkind::kinds::DAX_KMEM_ALL Allocate from  the  closest  persistent
86       memory  NUMA  node available at the time of allocation. If there is not
87       enough memory on any of persistent memory NUMA nodes to satisfy the re‐
88       quest, errno is set to ENOMEM and the allocated pointer is set to NULL.
89
90       libmemkind::kinds::DAX_KMEM_PREFERRED        Same        as        lib‐
91       memkind::kinds::DAX_KMEM except that if there is not enough  memory  in
92       the closest persistent memory NUMA node to satisfy the request, the al‐
93       location will fall back on other memory NUMA  nodes.   Note:  For  this
94       kind,  the allocation will not succeed if two or more persistent memory
95       NUMA nodes are in the same shortest distance to the same CPU  on  which
96       process  is  eligible  to  run.  Check on that eligibility is done upon
97       starting the application.
98
99       All public member types and functions correspond  to  standard  library
100       allocator concepts and definitions. The current implementation supports
101       C++11 standard.
102
103       Template arguments:
104       T is an object type aliased by value_type.
105       U is an object type.
106
107       Note:
108       T *libmemkind::static_kind::allocator<T>::allocate(std::size_t n) allo‐
109       cates memory using memkind_malloc().  Throw std::bad_alloc when:
110              n = 0
111              or there is not enough memory to satisfy the request.
112
113       libmemkind::static_kind::allocator<T>::deallocate(T  *p, std::size_t n)
114       deallocates memory associated with pointer returned by allocate() using
115       memkind_free().
116

SYSTEM CONFIGURATION

118       Interfaces for obtaining 2MB (HUGETLB) memory need allocated huge pages
119       in the kernel's huge page pool.
120
121       HUGETLB (huge pages)
122              Current number of "persistent"  huge  pages  can  be  read  from
123              /proc/sys/vm/nr_hugepages   file.    Proposed   way  of  setting
124              hugepages is: sudo sysctl vm.nr_hugepages=<number_of_hugepages>.
125              More       information       can       be       found      here:
126https://www.kernel.org/doc/Documentation/vm/hugetlbpage.txt
127
129       Copyright (C) 2019 - 2020 Intel Corporation. All rights reserved.
130

SEE ALSO

132       memkind(3)
133
134
135
136Intel Corporation                 2019-09-24               MEMKINDALLOCATOR(3)
Impressum