Created
December 12, 2018 19:35
-
-
Save disa-mhembere/85f14311e4b1ec095344629f3177b742 to your computer and use it in GitHub Desktop.
Code to help with NUMA opts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Numa allocate | |
void numa_alloc(double* data) { | |
data = static_cast<double*>(numa_alloc_onnode(data_size, node_id)); | |
} | |
// Numa deallocate | |
void numa_dealloc(double* data, size_t data_size) { | |
numa_free(data, data_size); | |
} | |
// Bind to node(Call within ctor for launched thread) | |
void bind2node_id(id) { | |
struct bitmask *bmp = numa_allocate_nodemask(); | |
numa_bitmask_setbit(bmp, id); | |
numa_bind(bmp); | |
numa_free_nodemask(bmp); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment