Browse Source

Renaming NUMA functions
add functions to link NUMA OS id and NUMA StarPU node
remove functions to link StarPU NUMA node and Hwloc logid
Fix several bugs when benchmarking bus

Corentin Salingue 8 years ago
parent
commit
50131e4b1b

+ 3 - 3
doc/doxygen/chapters/api/data_management.doxy

@@ -104,9 +104,9 @@ data to StarPU, the specified memory node indicates where the piece of
 data initially resides (we also call this memory node the home node of
 a piece of data).
 
-In the case of NUMA systems, functions starpu_numa_hwloclogid_to_id()
-and starpu_numa_id_to_hwloclogid() can be used to convert from NUMA node
-numbers as seen by the HWLOC library and NUMA node numbers as seen by StarPU.
+In the case of NUMA systems, functions starpu_memory_nodes_numa_devid_to_id()
+and starpu_memory_nodes_numa_id_to_devid() can be used to convert from NUMA node
+numbers as seen by the Operating System and NUMA node numbers as seen by StarPU.
 
 \fn void starpu_data_register(starpu_data_handle_t *handleptr, int home_node, void *data_interface, struct starpu_data_interface_ops *ops)
 \ingroup API_Data_Management

+ 4 - 4
doc/doxygen/chapters/api/workers.doxy

@@ -250,14 +250,14 @@ Return the type of \p node as defined by
 this function should be used in the allocation function to determine
 on which device the memory needs to be allocated.
 
-\fn int starpu_numa_hwloclogid_to_id(int logid)
+\fn int starpu_memory_nodes_numa_id_to_devid(int osid)
 \ingroup API_Workers_Properties
 This function returns the identifier of the memory node associated to the NUMA
-node identified by \p logid by the HWLOC library.
+node identified by \p osid by the Operating System.
 
-\fn int starpu_numa_id_to_hwloclogid(unsigned id);
+\fn int starpu_memory_nodes_numa_devid_to_id(unsigned id);
 \ingroup API_Workers_Properties
-This function returns the HWLOC logical identifier of the memory node
+This function returns the Operating System identifier of the memory node
 whose StarPU identifier is \p id.
 
 \fn char *starpu_worker_get_type_as_string(enum starpu_worker_archtype type)

+ 1 - 1
examples/cpp/add_vectors_cpp11.cpp

@@ -78,7 +78,7 @@ int main(int argc, char **argv)
 		return 77;
 	STARPU_CHECK_RETURN_VALUE(ret, "starpu_init");
 
-	if (starpu_get_nb_numa_nodes() > 1)
+	if (starpu_memory_nodes_get_numa_count() > 1)
 	{
 		starpu_shutdown();
 		return 77;

+ 3 - 3
include/starpu_data.h

@@ -132,9 +132,9 @@ enum starpu_node_kind
 
 unsigned starpu_worker_get_memory_node(unsigned workerid);
 unsigned starpu_memory_nodes_get_count(void);
-int starpu_get_nb_numa_nodes(void);
-int starpu_numa_hwloclogid_to_id(int logid);
-int starpu_numa_id_to_hwloclogid(unsigned id);
+int starpu_memory_nodes_get_numa_count(void);
+int starpu_memory_nodes_numa_id_to_devid(int osid);
+int starpu_memory_nodes_numa_devid_to_id(unsigned id);
 
 enum starpu_node_kind starpu_node_get_kind(unsigned node);
 

+ 1 - 1
src/core/disk.c

@@ -64,7 +64,7 @@ int starpu_disk_register(struct starpu_disk_ops *func, void *parameter, starpu_s
 	unsigned disk_memnode = _starpu_memory_node_register(STARPU_DISK_RAM, 0);
 
         /* Connect the disk memory node to all numa memory nodes */
-        int nb_numa_nodes = starpu_get_nb_numa_nodes();
+        int nb_numa_nodes = starpu_memory_nodes_get_numa_count();
         int numa_node;
         for (numa_node = 0; numa_node < nb_numa_nodes; numa_node++)
         {

+ 8 - 4
src/core/perfmodel/perfmodel_bus.c

@@ -143,6 +143,8 @@ static void measure_bandwidth_between_host_and_dev_on_numa_with_cuda(int dev, in
 	_starpu_bind_thread_on_cpu(config, cpu, STARPU_NOWORKERID);
 	size_t size = SIZE;
 
+	const unsigned nnuma_nodes = _starpu_topology_get_nnumanodes(config);
+
 	/* Initialize CUDA context on the device */
 	/* We do not need to enable OpenGL interoperability at this point,
 	 * since we cleanly shutdown CUDA before returning. */
@@ -177,7 +179,7 @@ static void measure_bandwidth_between_host_and_dev_on_numa_with_cuda(int dev, in
 	unsigned char *h_buffer;
 	
 #if defined(STARPU_HAVE_HWLOC)
-	if (nnumas > 1)
+	if (nnuma_nodes > 1)
 	{
 		/* NUMA mode activated */
 		hwloc_obj_t obj = hwloc_get_obj_by_type(hwtopology, HWLOC_OBJ_NODE, numa);
@@ -260,7 +262,7 @@ static void measure_bandwidth_between_host_and_dev_on_numa_with_cuda(int dev, in
 	/* Free buffers */
 	cudaHostUnregister(h_buffer);
 #if defined(STARPU_HAVE_HWLOC) 
-	if (nnumas > 1)
+	if (nnuma_nodes > 1)
 	{
 		/* NUMA mode activated */
 		hwloc_free(hwtopology, h_buffer, size);
@@ -394,6 +396,8 @@ static void measure_bandwidth_between_host_and_dev_on_numa_with_opencl(int dev,
 	struct _starpu_machine_config *config = _starpu_get_machine_config();
 	_starpu_bind_thread_on_cpu(config, cpu, STARPU_NOWORKERID);
 
+	const unsigned nnuma_nodes = _starpu_topology_get_nnumanodes(config);
+
 	/* Is the context already initialised ? */
 	starpu_opencl_get_context(dev, &context);
 	not_initialized = (context == NULL);
@@ -436,7 +440,7 @@ static void measure_bandwidth_between_host_and_dev_on_numa_with_opencl(int dev,
 	/* Allocate a buffer on the host */
 	unsigned char *h_buffer;
 #if defined(STARPU_HAVE_HWLOC)
-	if (nnumas > 1)
+	if (nnuma_nodes > 1)
 	{
 		/* NUMA mode activated */
 		hwloc_obj_t obj = hwloc_get_obj_by_type(hwtopology, HWLOC_OBJ_NODE, numa);
@@ -522,7 +526,7 @@ static void measure_bandwidth_between_host_and_dev_on_numa_with_opencl(int dev,
 	if (STARPU_UNLIKELY(err != CL_SUCCESS))
 		STARPU_OPENCL_REPORT_ERROR(err);
 #if defined(STARPU_HAVE_HWLOC)
-	if (nnumas > 1)
+	if (nnuma_nodes > 1)
 	{
 		/* NUMA mode activated */
 		hwloc_free(hwtopology, h_buffer, size);

+ 1 - 1
src/core/simgrid.c

@@ -1043,7 +1043,7 @@ void _starpu_simgrid_count_ngpus(void)
 			for (src2 = 1; src2 < STARPU_MAXNODES; src2++)
 			{
 				int numa;
-				int nnumas = starpu_get_nb_numa_nodes();
+				int nnumas = starpu_memory_nodes_get_numa_count();
 				int found = 0;
 				for (numa = 0; numa < nnumas; numa++)
 					if (starpu_bus_get_id(src2, numa) != -1)

+ 135 - 62
src/core/topology.c

@@ -65,9 +65,13 @@ static int nobind;
 /* For checking whether two workers share the same PU, indexed by PU number */
 static int cpu_worker[STARPU_MAXCPUS];
 static unsigned nb_numa_nodes = 0;
-static int numa_memory_nodes[STARPU_MAXNUMANODES]; /* indexed by StarPU numa node to convert in hwloc logid */
+static int numa_memory_nodes_to_hwloclogid[STARPU_MAXNUMANODES]; /* indexed by StarPU numa node to convert in hwloc logid */
+static int numa_memory_nodes_to_physicalid[STARPU_MAXNUMANODES]; /* indexed by StarPU numa node to convert in physical id */
 static unsigned numa_bus_id[STARPU_MAXNUMANODES*STARPU_MAXNUMANODES];
-static int _starpu_get_numa_node_worker(unsigned workerid);
+static int _starpu_get_logical_numa_node_worker(unsigned workerid);
+
+#define STARPU_NUMA_UNINITIALIZED (-2)
+#define STARPU_NUMA_MAIN_RAM (-1)
 
 #if defined(STARPU_USE_CUDA) || defined(STARPU_USE_OPENCL) || defined(STARPU_USE_SCC) || defined(STARPU_SIMGRID) || defined(STARPU_USE_MPI_MASTER_SLAVE)
 
@@ -96,7 +100,7 @@ static struct _starpu_worker_set mic_worker_set[STARPU_MAXMICDEVS];
 struct _starpu_worker_set mpi_worker_set[STARPU_MAXMPIDEVS];
 #endif
 
-int starpu_get_nb_numa_nodes(void)
+int starpu_memory_nodes_get_numa_count(void)
 {
 	return nb_numa_nodes;
 }
@@ -113,13 +117,29 @@ static int numa_get_logical_id(hwloc_obj_t obj)
 		 * hwloc does not know whether there are numa nodes or not, so
 		 * we should not use a per-node sampling in that case. */
 		if (!obj)
-			return -1;
+			return STARPU_NUMA_MAIN_RAM;
 	}
 	return obj->logical_index;
 }
+
+static int numa_get_physical_id(hwloc_obj_t obj)
+{
+	STARPU_ASSERT(obj);
+	while (obj->type != HWLOC_OBJ_NODE)
+	{
+		obj = obj->parent;
+
+		/* If we don't find a "node" obj before the root, this means
+		 * hwloc does not know whether there are numa nodes or not, so
+		 * we should not use a per-node sampling in that case. */
+		if (!obj)
+			return STARPU_NUMA_MAIN_RAM;
+	}
+	return obj->os_index;
+}
 #endif
 
-static int _starpu_get_numa_node_worker(unsigned workerid)
+static int _starpu_get_logical_numa_node_worker(unsigned workerid)
 {
 #if defined(STARPU_HAVE_HWLOC)
 	char * state;
@@ -145,7 +165,37 @@ static int _starpu_get_numa_node_worker(unsigned workerid)
 #endif 
 	{
 		(void) workerid; /* unused */
-		return -1;
+		return STARPU_NUMA_MAIN_RAM;
+	}
+}
+
+static int _starpu_get_physical_numa_node_worker(unsigned workerid)
+{
+#if defined(STARPU_HAVE_HWLOC)
+	char * state;
+	if ((state = starpu_getenv("STARPU_USE_NUMA")) && atoi(state))
+	{
+		struct _starpu_worker *worker = _starpu_get_worker_struct(workerid);
+		struct _starpu_machine_config *config = (struct _starpu_machine_config *)_starpu_get_machine_config() ;
+		struct _starpu_machine_topology *topology = &config->topology ;
+
+		hwloc_obj_t obj;
+		switch(worker->arch) 	
+		{
+			case STARPU_CPU_WORKER:
+				obj = hwloc_get_obj_by_type(topology->hwtopology, HWLOC_OBJ_PU, worker->bindid) ;
+				break;
+			default:
+				STARPU_ABORT();
+		}
+
+		return numa_get_physical_id(obj);
+	}
+	else		
+#endif 
+	{
+		(void) workerid; /* unused */
+		return STARPU_NUMA_MAIN_RAM;
 	}
 }
 
@@ -943,19 +993,35 @@ unsigned _starpu_topology_get_nnumanodes(struct _starpu_machine_config *config S
 }
 
 //TODO change this in an array
-int starpu_numa_hwloclogid_to_id(int logid)
+int starpu_memory_nodes_numa_hwloclogid_to_id(int logid)
 {
 	unsigned n;
 	for (n = 0; n < nb_numa_nodes; n++)
-		if (numa_memory_nodes[n] == logid)
+		if (numa_memory_nodes_to_hwloclogid[n] == logid)
 			return n;
 	return -1;
 }
 
-int starpu_numa_id_to_hwloclogid(unsigned id)
+int starpu_memory_nodes_numa_id_to_hwloclogid(unsigned id)
 {
 	STARPU_ASSERT(id < STARPU_MAXNUMANODES);
-	return numa_memory_nodes[id];
+	return numa_memory_nodes_to_hwloclogid[id];
+}
+
+int starpu_memory_nodes_numa_devid_to_id(unsigned id)
+{
+	STARPU_ASSERT(id < STARPU_MAXNUMANODES);
+	return numa_memory_nodes_to_physicalid[id];
+}
+
+//TODO change this in an array
+int starpu_memory_nodes_numa_id_to_devid(int osid)
+{
+	unsigned n;
+	for (n = 0; n < nb_numa_nodes; n++)
+		if (numa_memory_nodes_to_physicalid[n] == osid)
+			return n;
+	return -1;
 }
 
 #ifdef STARPU_HAVE_HWLOC
@@ -1892,62 +1958,64 @@ static void _starpu_init_numa_node(struct _starpu_machine_config *config)
 {
 	nb_numa_nodes = 0;
 
-	/* -2 : Uninitialized
-	 * -1 : only one node
-	 * >= 0 : hwloc logical id
-	 */
 	unsigned i;
 	for (i = 0; i < STARPU_MAXNUMANODES; i++)
-		numa_memory_nodes[i] = -2;
+	{
+		numa_memory_nodes_to_hwloclogid[i] = STARPU_NUMA_UNINITIALIZED;
+		numa_memory_nodes_to_physicalid[i] = STARPU_NUMA_UNINITIALIZED;
+	}
 
-	/* Take all NUMA nodes used by CPU workers */
-	unsigned worker;
-	for (worker = 0; worker < config->topology.nworkers; worker++)
+
+	char * state;
+	/* NUMA mode activated */
+	if ((state = starpu_getenv("STARPU_USE_NUMA")) && atoi(state))
 	{
-		struct _starpu_worker *workerarg = &config->workers[worker];
-		if (workerarg->arch == STARPU_CPU_WORKER)
+		/* Take all NUMA nodes used by CPU workers */
+		unsigned worker;
+		for (worker = 0; worker < config->topology.nworkers; worker++)
 		{
-			int numa_logical_id = _starpu_get_numa_node_worker(worker);
+			struct _starpu_worker *workerarg = &config->workers[worker];
+			if (workerarg->arch == STARPU_CPU_WORKER)
+			{
+				int numa_logical_id = _starpu_get_logical_numa_node_worker(worker);
 
-			/* Convert logical id to StarPU id to check if this NUMA node is already saved or not */
-			int numa_starpu_id = starpu_numa_hwloclogid_to_id(numa_logical_id);
+				/* Convert logical id to StarPU id to check if this NUMA node is already saved or not */
+				int numa_starpu_id = starpu_memory_nodes_numa_hwloclogid_to_id(numa_logical_id);
 
-			if (numa_starpu_id == -1 && nb_numa_nodes == STARPU_MAXNUMANODES)
-			{
-				_STARPU_MSG("Warning: %u NUMA nodes available. Only %u enabled. Use configure option --enable-maxnumanodes=xxx to update the maximum value of supported NUMA nodes.\n", _starpu_topology_get_nnumanodes(config), STARPU_MAXNUMANODES);
-				/* Don't create a new NUMA node */
-				numa_starpu_id = STARPU_MAIN_RAM;
-			}
+				/* This shouldn't happen */
+				if (numa_starpu_id == -1 && nb_numa_nodes == STARPU_MAXNUMANODES)
+				{
+					_STARPU_MSG("Warning: %u NUMA nodes available. Only %u enabled. Use configure option --enable-maxnumanodes=xxx to update the maximum value of supported NUMA nodes.\n", _starpu_topology_get_nnumanodes(config), STARPU_MAXNUMANODES);
+					STARPU_ABORT();
+				}
 
-			if (numa_starpu_id == -1)
-			{
-				int devid = numa_logical_id == -1 ? 0 : numa_logical_id;
-				int memnode = _starpu_memory_node_register(STARPU_CPU_RAM, devid);
-				STARPU_ASSERT_MSG(memnode < STARPU_MAXNUMANODES, "Wrong Memory Node : %d (only %d available)", memnode, STARPU_MAXNUMANODES);
-				numa_memory_nodes[memnode] = numa_logical_id;
-				nb_numa_nodes++;
+				if (numa_starpu_id == -1)
+				{
+					int devid = numa_logical_id == STARPU_NUMA_MAIN_RAM ? 0 : numa_logical_id;
+					int memnode = _starpu_memory_node_register(STARPU_CPU_RAM, devid);
+					STARPU_ASSERT_MSG(memnode < STARPU_MAXNUMANODES, "Wrong Memory Node : %d (only %d available)", memnode, STARPU_MAXNUMANODES);
+					numa_memory_nodes_to_hwloclogid[memnode] = numa_logical_id;
+					int numa_physical_id = _starpu_get_physical_numa_node_worker(worker);
+					numa_memory_nodes_to_physicalid[memnode] = numa_physical_id;
+					nb_numa_nodes++;
 #ifdef STARPU_SIMGRID
-				snprintf(name, sizeof(name), "RAM%d", memnode);
-				host = _starpu_simgrid_get_host_by_name(name);
-				STARPU_ASSERT(host);
-				_starpu_simgrid_memory_node_set_host(memnode, host);
+					snprintf(name, sizeof(name), "RAM%d", memnode);
+					host = _starpu_simgrid_get_host_by_name(name);
+					STARPU_ASSERT(host);
+					_starpu_simgrid_memory_node_set_host(memnode, host);
 #endif
+				}
 			}
 		}
-	}
 
-	/* If we found NUMA nodes from CPU workers, it's good */
-	if (nb_numa_nodes != 0)
-		return;
+		/* If we found NUMA nodes from CPU workers, it's good */
+		if (nb_numa_nodes != 0)
+			return;
 
 #if (defined(STARPU_USE_CUDA) || defined(STARPU_USE_OPENCL)) && defined(STARPU_HAVE_HWLOC)
-	_STARPU_DISP("No NUMA nodes found when checking CPU workers. Take NUMA nodes attached to CUDA and OpenCL devices... \n");
+		_STARPU_DISP("No NUMA nodes found when checking CPU workers. Take NUMA nodes attached to CUDA and OpenCL devices... \n");
 #endif
 
-	char * state;
-	if ((state = starpu_getenv("STARPU_USE_NUMA")) && atoi(state))
-	{
-		/* NUMA mode activated */
 #if defined(STARPU_USE_CUDA) && defined(STARPU_HAVE_HWLOC)
 		for (i = 0; i < config->topology.ncudagpus; i++)
 		{
@@ -1967,20 +2035,21 @@ static void _starpu_init_numa_node(struct _starpu_machine_config *config)
 				if (!obj)
 					continue;
 			}
-			int numa_starpu_id = starpu_numa_hwloclogid_to_id(obj->logical_index);
+			int numa_starpu_id = starpu_memory_nodes_numa_hwloclogid_to_id(obj->logical_index);
 
+			/* This shouldn't happen */
 			if (numa_starpu_id == -1 && nb_numa_nodes == STARPU_MAXNUMANODES)
 			{
 				_STARPU_MSG("Warning: %u NUMA nodes available. Only %u enabled. Use configure option --enable-maxnumanodes=xxx to update the maximum value of supported NUMA nodes.\n", _starpu_topology_get_nnumanodes(config), STARPU_MAXNUMANODES);
-				/* Don't create a new NUMA node */
-				numa_starpu_id = STARPU_MAIN_RAM;
+				STARPU_ABORT();
 			}
 
 			if (numa_starpu_id == -1)
 			{
 				int memnode = _starpu_memory_node_register(STARPU_CPU_RAM, obj->logical_index);
 				STARPU_ASSERT_MSG(memnode < STARPU_MAXNUMANODES, "Wrong Memory Node : %d (only %d available)", memnode, STARPU_MAXNUMANODES);
-				numa_memory_nodes[memnode] = obj->logical_index;
+				numa_memory_nodes_to_hwloclogid[memnode] = obj->logical_index;
+				numa_memory_nodes_to_physicalid[memnode] = obj->os_index;
 				nb_numa_nodes++;
 #ifdef STARPU_SIMGRID
 				snprintf(name, sizeof(name), "RAM%d", memnode);
@@ -2035,20 +2104,21 @@ static void _starpu_init_numa_node(struct _starpu_machine_config *config)
 						if (!obj)
 							continue;
 					}
-					int numa_starpu_id = starpu_numa_hwloclogid_to_id(obj->logical_index);
+					int numa_starpu_id = starpu_memory_nodes_numa_hwloclogid_to_id(obj->logical_index);
 
+					/* This shouldn't happen */
 					if (numa_starpu_id == -1 && nb_numa_nodes == STARPU_MAXNUMANODES)
 					{
 						_STARPU_MSG("Warning: %u NUMA nodes available. Only %u enabled. Use configure option --enable-maxnumanodes=xxx to update the maximum value of supported NUMA nodes.\n", _starpu_topology_get_nnumanodes(config), STARPU_MAXNUMANODES);
-						/* Don't create a new NUMA node */
-						numa_starpu_id = STARPU_MAIN_RAM;
+						STARPU_ABORT();
 					}
 
 					if (numa_starpu_id == -1)
 					{
 						int memnode = _starpu_memory_node_register(STARPU_CPU_RAM, obj->logical_index);
 						STARPU_ASSERT_MSG(memnode < STARPU_MAXNUMANODES, "Wrong Memory Node : %d (only %d available)", memnode, STARPU_MAXNUMANODES);
-						numa_memory_nodes[memnode] = obj->logical_index;
+						numa_memory_nodes_to_hwloclogid[memnode] = obj->logical_index;
+						numa_memory_nodes_to_physicalid[memnode] = obj->os_index;	
 						nb_numa_nodes++;
 #ifdef STARPU_SIMGRID
 						snprintf(name, sizeof(name), "RAM%d", memnode);
@@ -2087,11 +2157,13 @@ static void _starpu_init_numa_node(struct _starpu_machine_config *config)
 		{
 			hwloc_obj_t obj = hwloc_get_obj_by_type(config->topology.hwtopology, HWLOC_OBJ_NUMANODE, numa);
 			unsigned numa_logical_id = obj->logical_index;
+			unsigned numa_physical_id = obj->os_index;
 
 			int memnode = _starpu_memory_node_register(STARPU_CPU_RAM, 0);
 			STARPU_ASSERT_MSG(memnode < STARPU_MAXNUMANODES, "Wrong Memory Node : %d (only %d available) \n", memnode, STARPU_MAXNUMANODES);
 
-			numa_memory_nodes[memnode] = numa_logical_id;
+			numa_memory_nodes_to_hwloclogid[memnode] = numa_logical_id;
+			numa_memory_nodes_to_physicalid[memnode] = numa_physical_id;
 			nb_numa_nodes++;								
 
 #ifdef STARPU_SIMGRID
@@ -2109,7 +2181,8 @@ static void _starpu_init_numa_node(struct _starpu_machine_config *config)
 			int memnode = _starpu_memory_node_register(STARPU_CPU_RAM, 0);
 			STARPU_ASSERT_MSG(memnode == STARPU_MAIN_RAM, "Wrong Memory Node : %d (expected %d) \n", memnode, STARPU_MAIN_RAM);
 
-			numa_memory_nodes[memnode] = -1;
+			numa_memory_nodes_to_hwloclogid[memnode] = STARPU_NUMA_MAIN_RAM;
+			numa_memory_nodes_to_physicalid[memnode] = STARPU_NUMA_MAIN_RAM;
 			nb_numa_nodes++;								
 #ifdef STARPU_SIMGRID
 			char name[16];
@@ -2196,8 +2269,8 @@ _starpu_init_workers_binding_and_memory (struct _starpu_machine_config *config,
 		{
 			case STARPU_CPU_WORKER:
 			{
-				int numa_logical_id = _starpu_get_numa_node_worker(worker);
-				int numa_starpu_id =  starpu_numa_hwloclogid_to_id(numa_logical_id);
+				int numa_logical_id = _starpu_get_logical_numa_node_worker(worker);
+				int numa_starpu_id =  starpu_memory_nodes_numa_hwloclogid_to_id(numa_logical_id);
 				if (numa_starpu_id >= STARPU_MAXNUMANODES)
 					numa_starpu_id = STARPU_MAIN_RAM;
 
@@ -2635,7 +2708,7 @@ starpu_topology_print (FILE *output)
 		fprintf(output, "------\tNUMA %u\t------\n", numa);
 		for (pu = 0; pu < topology->nhwpus; pu++)
 		{
-			if (starpu_numa_id_to_hwloclogid(numa) == _starpu_numa_get_logical_id_from_pu(pu))
+			if (starpu_memory_nodes_numa_id_to_hwloclogid(numa) == _starpu_numa_get_logical_id_from_pu(pu))
 			{
 				if ((pu % nthreads_per_core) == 0)
 					fprintf(output, "core %u", pu / nthreads_per_core);

+ 2 - 2
src/core/topology.h

@@ -72,7 +72,7 @@ void _starpu_bind_thread_on_cpus(struct _starpu_machine_config *config STARPU_AT
 
 struct _starpu_worker *_starpu_get_worker_from_driver(struct starpu_driver *d);
 
-int starpu_get_nb_numa_nodes(void);
-int starpu_numa_id_to_hwloclogid(unsigned id);
+int starpu_memory_nodes_get_numa_count(void);
+int starpu_memory_nodes_numa_id_to_hwloclogid(unsigned id);
 	
 #endif // __TOPOLOGY_H__

+ 1 - 1
src/core/workers.c

@@ -1598,7 +1598,7 @@ void starpu_shutdown(void)
 	_starpu_kill_all_workers(&_starpu_config);
 	
 	unsigned i;
-	unsigned nb_numa_nodes = starpu_get_nb_numa_nodes();
+	unsigned nb_numa_nodes = starpu_memory_nodes_get_numa_count();
 	for (i=0; i<nb_numa_nodes; i++)
 	{
 		_starpu_free_all_automatically_allocated_buffers(i);

+ 1 - 1
src/datawizard/coherency.c

@@ -326,7 +326,7 @@ static unsigned chose_best_numa_between_src_and_dest(int src, int dst)
 	double timing_best;
 	int best_numa = -1;
 	unsigned numa;
-	const unsigned nb_numa_nodes = starpu_get_nb_numa_nodes();
+	const unsigned nb_numa_nodes = starpu_memory_nodes_get_numa_count();
 	for(numa = 0; numa < nb_numa_nodes; numa++)
 	{
 		double actual = 1.0/starpu_transfer_bandwidth(src, numa) + 1.0/starpu_transfer_bandwidth(numa, dst);

+ 3 - 3
src/datawizard/malloc.c

@@ -306,10 +306,10 @@ int _starpu_malloc_flags_on_node(unsigned dst_node, void **A, size_t dim, int fl
 #endif
 	}
 #ifdef STARPU_HAVE_HWLOC
-	if (starpu_get_nb_numa_nodes() > 1) {
+	if (starpu_memory_nodes_get_numa_count() > 1) {
 		struct _starpu_machine_config *config = _starpu_get_machine_config();
 		hwloc_topology_t hwtopology = config->topology.hwtopology;
-		hwloc_obj_t numa_node_obj = hwloc_get_obj_by_type(hwtopology, HWLOC_OBJ_NODE, starpu_numa_id_to_hwloclogid(dst_node));
+		hwloc_obj_t numa_node_obj = hwloc_get_obj_by_type(hwtopology, HWLOC_OBJ_NODE, starpu_memory_nodes_numa_id_to_hwloclogid(dst_node));
 		hwloc_bitmap_t nodeset = numa_node_obj->nodeset;
 		*A = hwloc_alloc_membind_nodeset(hwtopology, dim, nodeset, HWLOC_MEMBIND_BIND | HWLOC_MEMBIND_NOCPUBIND, flags);
 		//fprintf(stderr, "Allocation %lu bytes on NUMA node %d [%p]\n", (unsigned long) dim, starpu_memnode_get_numaphysid(dst_node), *A);
@@ -495,7 +495,7 @@ int _starpu_free_flags_on_node(unsigned dst_node, void *A, size_t dim, int flags
 #endif
 	}
 #ifdef STARPU_HAVE_HWLOC
-	else if (starpu_get_nb_numa_nodes() > 1) {
+	else if (starpu_memory_nodes_get_numa_count() > 1) {
 		struct _starpu_machine_config *config = _starpu_get_machine_config();
 		hwloc_topology_t hwtopology = config->topology.hwtopology;
 		hwloc_free(hwtopology, A, dim);

+ 3 - 3
src/datawizard/memalloc.c

@@ -1620,7 +1620,7 @@ get_better_disk_can_accept_size(starpu_data_handle_t handle, unsigned node)
 			if (_starpu_get_disk_flag(i) != STARPU_DISK_NO_RECLAIM)
 			{
 				unsigned numa;
-				unsigned nnumas = starpu_get_nb_numa_nodes();
+				unsigned nnumas = starpu_memory_nodes_get_numa_count();
 				for (numa = 0; numa < nnumas; numa++)
 				{
 					/* TODO : check if starpu_transfer_predict(node, i,...) is the same */
@@ -1651,7 +1651,7 @@ choose_target(starpu_data_handle_t handle, unsigned node)
 		if(starpu_node_get_kind(handle->home_node) == STARPU_DISK_RAM && (starpu_node_get_kind(node) != STARPU_CPU_RAM))
 		{
  	                unsigned i;
-			unsigned nb_numa_nodes = starpu_get_nb_numa_nodes();
+			unsigned nb_numa_nodes = starpu_memory_nodes_get_numa_count();
 			for (i=0; i<nb_numa_nodes; i++)
 			{
 				if (handle->per_node[i].allocated || 
@@ -1683,7 +1683,7 @@ choose_target(starpu_data_handle_t handle, unsigned node)
 		/* node != 0 */
 		/* try to push data to RAM if we can before to push on disk*/
 			unsigned i;
-			unsigned nb_numa_nodes = starpu_get_nb_numa_nodes();
+			unsigned nb_numa_nodes = starpu_memory_nodes_get_numa_count();
 			for (i=0; i<nb_numa_nodes; i++)
 			{
 				if (handle->per_node[i].allocated || 

+ 1 - 1
src/drivers/cpu/driver_cpu.c

@@ -167,7 +167,7 @@ static size_t _starpu_cpu_get_global_mem_size(int nodeid STARPU_ATTRIBUTE_UNUSED
 #if defined(STARPU_HAVE_HWLOC)
 	struct _starpu_machine_topology *topology = &config->topology;
 
-	int nnumas = starpu_get_nb_numa_nodes();
+	int nnumas = starpu_memory_nodes_get_numa_count();
 	if (nnumas > 1)
 	{
 		int depth_node = hwloc_get_type_depth(topology->hwtopology, HWLOC_OBJ_NODE);

+ 1 - 1
tests/datawizard/nowhere.c

@@ -85,7 +85,7 @@ int main(int argc, char **argv)
 	if (ret == -ENODEV) return STARPU_TEST_SKIPPED;
 	STARPU_CHECK_RETURN_VALUE(ret, "starpu_init");
 
-	if (starpu_get_nb_numa_nodes() > 1)
+	if (starpu_memory_nodes_get_numa_count() > 1)
 	{
 		/* FIXME: assumes only one RAM node */
 		starpu_shutdown();