https://github.com/raftlib/affinity
Pulled out existing affinity setting code to put in a separate library. Code simply wraps affinity routines, aims to be cross platform, but currently only supports linux.
https://github.com/raftlib/affinity
Last synced: about 1 year ago
JSON representation
Pulled out existing affinity setting code to put in a separate library. Code simply wraps affinity routines, aims to be cross platform, but currently only supports linux.
- Host: GitHub
- URL: https://github.com/raftlib/affinity
- Owner: RaftLib
- License: apache-2.0
- Created: 2020-03-30T13:45:05.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2023-07-24T14:26:23.000Z (almost 3 years ago)
- Last Synced: 2025-04-14T17:43:36.562Z (about 1 year ago)
- Language: C++
- Size: 25.4 KB
- Stars: 5
- Watchers: 3
- Forks: 4
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Affinity
## Build status

## Notes
* Pulled out raftlib core affinity functions to
try to make more modular. This piece looks like
it should be tested in isolation.
* To build
```bash
cmake -Wno-dev -CMAKE_BUILD_TYPE=[Release/Debug] -GNinja
ninja
ninja test
```
* You can inject your own namespace if you'd like by
setting the following options, also include the moduleflags.cmake
file at the global level so that CFLAGS prop through all files:
```bash
-DAFFINITY_CUSTOM_NAMESPACE=YES
-DAFFINITY_NAMESPACE=
```
* test cases only test functionality at the moment,
need to add test cases for perf as well and more
corner cases.
## Usage
Include the header file
```cpp
#include
```
then link
```bash
-laffinity
```
and use this library inside your c++ code base
```cpp
affinity::set( core );
```
and that's pretty much it. If you've chosen to
inject your own namespace when building the
library, you'll need to modify the invocation
above like this:
```cpp
your_namespace::affinity::set( core );
```
## Platforms
* Currently only sets affinity for Linux,
will assign others to do Win/Mac at some point.
* CI currently only checks Linux but will add
others as we enable setting affinity on those
platforms.