numa architecture example
-
I tried to get a server working with numa architecture. Server Board with two xeon CPUs
I want that all 48 cores and 96 Threads can be used by one programm.
Can somebody give me please a minimal working example for this?
Thanks in advance.
I tried this:
#include <stdio.h> #include "stdafx.h" int main(void) { if (numa_available() < 0) { printf("System does not support NUMA API!\n"); } int n = numa_max_node(); int size = 1024 * 1024; printf("There are %d nodes on your system\n", n + 1); void *mem = numa_alloc_onnode(size, n); if (mem == NULL) { printf("could not allocate memory on node %d!\n", n); } numa_free(mem, size); if (numa_run_on_node(n) != 0) { printf("could not assign current thread to node %d!\n", n); } return 0; }
But the numa functions are not available. example comes from this: https://gist.github.com/BloodyD/dc8c4283ac2bdae4322e gist file. But the .h file is missing.
-
@holzfelix sagte in numa architecture example:
#include "stdafx.h"
Smells like 'Microsoft'.
If you want to use NUMA with MS-C, look here: https://docs.microsoft.com/en-us/windows/desktop/procthread/numa-supportOn Linux you have to install NUMA support first.
For Ubuntu: apt-get install libnuma-dev