|
@@ -153,70 +153,6 @@ static int execute_job_on_cpu(struct _starpu_job *j, struct starpu_task *worker_
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
-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 = -1;
|
|
|
-
|
|
|
-#if defined(STARPU_HAVE_HWLOC)
|
|
|
- struct _starpu_machine_topology *topology = &config->topology;
|
|
|
-
|
|
|
- if (starpu_get_env_number_default("STARPU_USE_NUMA", 0))
|
|
|
- {
|
|
|
- int depth_node = hwloc_get_type_depth(topology->hwtopology, HWLOC_OBJ_NUMANODE);
|
|
|
-
|
|
|
- if (depth_node == HWLOC_TYPE_DEPTH_UNKNOWN)
|
|
|
- {
|
|
|
-#if HWLOC_API_VERSION >= 0x00020000
|
|
|
- global_mem = hwloc_get_root_obj(topology->hwtopology)->total_memory;
|
|
|
-#else
|
|
|
- global_mem = hwloc_get_root_obj(topology->hwtopology)->memory.total_memory;
|
|
|
-#endif
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- char name[32];
|
|
|
- hwloc_obj_t obj = hwloc_get_obj_by_depth(topology->hwtopology, depth_node, nodeid);
|
|
|
-#if HWLOC_API_VERSION >= 0x00020000
|
|
|
- global_mem = obj->attr->numanode.local_memory;
|
|
|
-#else
|
|
|
- global_mem = obj->memory.local_memory;
|
|
|
-#endif
|
|
|
- snprintf(name, sizeof(name), "STARPU_LIMIT_CPU_NUMA_%d_MEM", obj->os_index);
|
|
|
- limit = starpu_get_env_number(name);
|
|
|
- }
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- /* Do not limit ourself to a single NUMA node */
|
|
|
-#if HWLOC_API_VERSION >= 0x00020000
|
|
|
- global_mem = hwloc_get_root_obj(topology->hwtopology)->total_memory;
|
|
|
-#else
|
|
|
- global_mem = hwloc_get_root_obj(topology->hwtopology)->memory.total_memory;
|
|
|
-#endif
|
|
|
- }
|
|
|
-
|
|
|
-#else /* STARPU_HAVE_HWLOC */
|
|
|
-#ifdef STARPU_DEVEL
|
|
|
-# 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;
|
|
|
- else if (global_mem && (size_t)limit * 1024*1024 > global_mem)
|
|
|
- // The requested limit is higher than what is available, we return the global memory size
|
|
|
- return global_mem;
|
|
|
- else
|
|
|
- // We limit the memory
|
|
|
- return limit*1024*1024;
|
|
|
-}
|
|
|
-
|
|
|
int _starpu_cpu_driver_init(struct _starpu_worker *cpu_worker)
|
|
|
{
|
|
|
int devid = cpu_worker->devid;
|