Skip to content
Snippets Groups Projects
Commit f4274874 authored by Moe Jette's avatar Moe Jette
Browse files

Modify test to work with either old or new NUMA functions.

Requires changing a #define in the code
parent b629c37e
No related branches found
No related tags found
No related merge requests found
...@@ -31,22 +31,38 @@ ...@@ -31,22 +31,38 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
static void _load_cpu_mask(nodemask_t *cpu_mask) /* For RedHat systems, run with NEW_TOOLS=0
* For current Ubuntu, run wtih NEW_TOOLS=1 */
#define NEW_TOOLS 0
#if NEW_TOOLS
#define MY_MASK struct bitmask *
#define MY_TEST numa_bitmask_isbitset
#else
#define MY_MASK nodemask_t
#define MY_TEST nodemask_isset
#endif
static void _load_cpu_mask(MY_MASK *cpu_mask)
{ {
*cpu_mask = numa_get_run_node_mask(); *cpu_mask = numa_get_run_node_mask();
} }
static void _load_mem_mask(nodemask_t *mem_mask) static void _load_mem_mask(MY_MASK *mem_mask)
{ {
*mem_mask = numa_get_membind(); *mem_mask = numa_get_membind();
} }
static unsigned long _mask_to_int(nodemask_t *mask) static unsigned long _mask_to_int(MY_MASK *mask)
{ {
int i; int i;
unsigned long rc = 0; unsigned long rc = 0;
for (i=0; i<NUMA_NUM_NODES; i++) { for (i=0; i<NUMA_NUM_NODES; i++) {
if (nodemask_isset(mask, i)) #if NEW_TOOLS
if (MY_TEST(*mask, i))
#else
if (MY_TEST(mask, i))
#endif
rc += (1 << i); rc += (1 << i);
} }
return rc; return rc;
...@@ -55,7 +71,8 @@ static unsigned long _mask_to_int(nodemask_t *mask) ...@@ -55,7 +71,8 @@ static unsigned long _mask_to_int(nodemask_t *mask)
main (int argc, char **argv) main (int argc, char **argv)
{ {
char *task_str; char *task_str;
nodemask_t cpu_mask, mem_mask; MY_MASK cpu_mask;
MY_MASK mem_mask;
int task_id; int task_id;
if (numa_available() < 0) { if (numa_available() < 0) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment