|
@@ -166,26 +166,23 @@ static int execute_job_on_cpu(struct _starpu_job *j, struct starpu_task *worker_
|
|
|
static size_t _starpu_cpu_get_global_mem_size(int nodeid STARPU_ATTRIBUTE_UNUSED, struct _starpu_machine_config *config STARPU_ATTRIBUTE_UNUSED)
|
|
|
{
|
|
|
size_t global_mem;
|
|
|
- starpu_ssize_t limit;
|
|
|
+ starpu_ssize_t limit = -1;
|
|
|
|
|
|
char name[32];
|
|
|
|
|
|
- /* FIXME: do we want logical or physical? */
|
|
|
- sprintf(name, "STARPU_LIMIT_CPU_NUMA%d_MEM", nodeid);
|
|
|
- limit = starpu_get_env_number(name);
|
|
|
- if (limit == -1)
|
|
|
- limit = starpu_get_env_number("STARPU_LIMIT_CPU_MEM");
|
|
|
-
|
|
|
#if defined(STARPU_HAVE_HWLOC)
|
|
|
struct _starpu_machine_topology *topology = &config->topology;
|
|
|
-
|
|
|
#ifdef STARPU_USE_NUMA
|
|
|
int depth_node = hwloc_get_type_depth(topology->hwtopology, HWLOC_OBJ_NODE);
|
|
|
|
|
|
if (depth_node == HWLOC_TYPE_DEPTH_UNKNOWN)
|
|
|
global_mem = hwloc_get_root_obj(topology->hwtopology)->memory.total_memory;
|
|
|
- else
|
|
|
- global_mem = hwloc_get_obj_by_depth(topology->hwtopology, depth_node, nodeid)->memory.local_memory;
|
|
|
+ else {
|
|
|
+ hwloc_obj_t obj = hwloc_get_obj_by_depth(topology->hwtopology, depth_node, nodeid);
|
|
|
+ global_mem = obj->memory.local_memory;
|
|
|
+ sprintf(name, "STARPU_LIMIT_CPU_NUMA_%d_MEM", obj->os_index);
|
|
|
+ limit = starpu_get_env_number(name);
|
|
|
+ }
|
|
|
#else /* STARPU_USE_NUMA */
|
|
|
/* Do not limit ourself to a single NUMA node */
|
|
|
global_mem = hwloc_get_root_obj(topology->hwtopology)->memory.total_memory;
|
|
@@ -193,11 +190,14 @@ static size_t _starpu_cpu_get_global_mem_size(int nodeid STARPU_ATTRIBUTE_UNUSED
|
|
|
|
|
|
#else /* STARPU_HAVE_HWLOC */
|
|
|
#ifdef STARPU_DEVEL
|
|
|
-# warning use sysinfo when available to get global size
|
|
|
+# warning TODO: use sysinfo when available to get global size
|
|
|
#endif
|
|
|
global_mem = 0;
|
|
|
#endif
|
|
|
|
|
|
+ if (limit == -1)
|
|
|
+ limit = starpu_get_env_number("STARPU_LIMIT_CPU_MEM");
|
|
|
+
|
|
|
if (limit < 0)
|
|
|
// No limit is defined, we return the global memory size
|
|
|
return global_mem;
|