Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ReidAtcheson/numaallocator
Simple C++11 and beyond allocator to control
https://github.com/ReidAtcheson/numaallocator
Last synced: 3 months ago
JSON representation
Simple C++11 and beyond allocator to control
- Host: GitHub
- URL: https://github.com/ReidAtcheson/numaallocator
- Owner: ReidAtcheson
- Created: 2016-09-21T19:33:24.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2016-09-21T20:50:27.000Z (about 8 years ago)
- Last Synced: 2024-05-03T06:23:20.073Z (6 months ago)
- Language: C++
- Size: 1.95 KB
- Stars: 7
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-numa - NumaAllocator - A simple C++ header NUMA memory allocator (NUMA-aware memory placement and scheduling)
README
# NumaAllocator
This *very* simple code is a C++ allocator that gives some control
over where C++ containers allocate memory.In a multithreaded code it is often enough to rely on the OS
first touch policy to achieve this implicitly, but sometimes
the different memory "nodes" can have wildly
different performance characteristics requiring programmer
to take more control.#Dependencies
This simple include-only library does depend
on [libnuma](http://oss.sgi.com/projects/libnuma/).
You will need numa.h header file as well as
a [shared] object file to link against.# Example
```c++
#include
#include "numaalloc.h"
int main(int argc,char** argv){int n1=0;
int n2=1;
int sz=5000;typedef NumaAlloc::NumaAlloc na_t;
//Allocate vector of floats bound to numa node n1
std::vector x(sz,0.0,na_t(n1));//Allocate vector of floats bound to numa node n2
std::vector y(sz,0.0,na_t(n2));//Do something with x,y in parallel for win.
return 0;
}
```