Kaynağa Gözat

small fixes

Samuel Thibault 8 yıl önce
ebeveyn
işleme
71e173c179

+ 2 - 2
configure.ac

@@ -167,7 +167,7 @@ AM_CONDITIONAL([STARPU_USE_MIC], [test "x$enable_mic" = "xyes"])
 AC_MSG_CHECKING(maximum number of NUMA nodes)
 AC_ARG_ENABLE(maxnumanodes, [AS_HELP_STRING([--enable-maxnumanodes=<number>],
 			[maximum number of NUMA nodes])],
-			nmaxnumanodes=$enableval, nmaxnumanodes=16)
+			nmaxnumanodes=$enableval, nmaxnumanodes=4)
 AC_MSG_RESULT($nmaxnumanodes)
 AC_DEFINE_UNQUOTED(STARPU_MAXNUMANODES, [$nmaxnumanodes],
 		[maximum number of NUMA nodes])
@@ -2019,7 +2019,7 @@ if test x$maxnodes = x0 ; then
 		# We have one memory node shared by all CPU workers, one node per GPU
 		# and per MIC device
 		# we add nodes to use 3 memory disks
-		nodes=4
+		nodes=`expr $nmaxnumanodes + 3`
 		if test x$enable_cuda = xyes ; then
 			# we could have used nmaxcudadev + 1, but this would certainly give an
 			# odd number.

+ 4 - 11
src/datawizard/filters.c

@@ -1,6 +1,6 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
- * Copyright (C) 2010-2016  Université de Bordeaux
+ * Copyright (C) 2010-2017  Université de Bordeaux
  * Copyright (C) 2010  Mehdi Juhoor <mjuhoor@gmail.com>
  * Copyright (C) 2010, 2011, 2012, 2013, 2015, 2016  CNRS
  * Copyright (C) 2012, 2016  Inria
@@ -188,12 +188,9 @@ static void _starpu_data_partition(starpu_data_handle_t initial_handle, starpu_d
 		/* This is lazy allocation, allocate it now in main RAM, so as
 		 * to have somewhere to gather pieces later */
 		/* FIXME: mark as unevictable! */
-		int home_node = STARPU_MAIN_RAM;
-#ifdef STARPU_USE_NUMA
-		home_node = initial_handle->home_node;
+		int home_node = initial_handle->home_node;
 		if (home_node < 0 || (starpu_node_get_kind(home_node) != STARPU_CPU_RAM))
 			home_node = STARPU_MAIN_RAM;
-#endif /* STARPU_USE_NUMA */
 		int ret = _starpu_allocate_memory_on_node(initial_handle, &initial_handle->per_node[home_node], 0);
 #ifdef STARPU_DEVEL
 #warning we should reclaim memory if allocation failed
@@ -326,14 +323,10 @@ static void _starpu_data_partition(starpu_data_handle_t initial_handle, starpu_d
 		 * store it in the handle */
 		child->footprint = _starpu_compute_data_footprint(child);
 
-		int home_node = STARPU_MAIN_RAM;
-#ifdef STARPU_USE_NUMA
-		home_node = child->home_node;
+		int home_node = child->home_node;
 		if (home_node < 0 || (starpu_node_get_kind(home_node) != STARPU_CPU_RAM))
 			home_node = STARPU_MAIN_RAM;
-#endif /* STARPU_USE_NUMA */
-		void *ptr;
-		ptr = starpu_data_handle_to_pointer(child, home_node);
+		void *ptr = starpu_data_handle_to_pointer(child, home_node);
 		if (ptr != NULL)
 			_starpu_data_register_ram_pointer(child, ptr);
 	}

+ 10 - 17
src/datawizard/malloc.c

@@ -1,6 +1,6 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
- * Copyright (C) 2009-2010, 2012-2016  Université de Bordeaux
+ * Copyright (C) 2009-2010, 2012-2017  Université de Bordeaux
  * Copyright (C) 2010, 2011, 2012, 2013, 2014, 2015, 2016  CNRS
  *
  * StarPU is free software; you can redistribute it and/or modify
@@ -107,23 +107,16 @@ static struct starpu_codelet malloc_pinned_cl =
 };
 #endif
 
-#ifdef STARPU_USE_NUMA
+/* Allocation in CPU RAM */
 int starpu_malloc_flags(void **A, size_t dim, int flags)
 {
 	return _starpu_malloc_flags_on_node(STARPU_MAIN_RAM, A, dim, flags);
 }
 
 int _starpu_malloc_flags_on_node(unsigned dst_node, void **A, size_t dim, int flags)
-#else /* STARPU_USE_NUMA */
-int starpu_malloc_flags(void **A, size_t dim, int flags)
-#endif /* STARPU_USE_NUMA */
 {
 	int ret=0;
 
-#ifndef STARPU_USE_NUMA
-	unsigned dst_node = STARPU_MAIN_RAM;
-#endif /* STARPU_USE_NUMA */
-	
 	STARPU_ASSERT(A);
 
 	if (flags & STARPU_MALLOC_COUNT)
@@ -301,12 +294,11 @@ int starpu_malloc_flags(void **A, size_t dim, int flags)
 	else
 #ifdef STARPU_USE_NUMA
 	{
-		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_memnode_to_numaid(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 %d bytes on NUMA node %d [%p]\n", dim, _starpu_memnode_to_numaid(dst_node), *A);
+		fprintf(stderr, "Allocation %lu bytes on NUMA node %d [%p]\n", (unsigned long) dim, _starpu_memnode_to_numaid(dst_node), *A);
 		if (!*A)
 			ret = -ENOMEM;
 	}
@@ -396,6 +388,11 @@ static struct starpu_codelet free_pinned_cl =
 
 int starpu_free_flags(void *A, size_t dim, int flags)
 {
+	return _starpu_free_flags_on_node(STARPU_MAIN_RAM, A, dim, flags);
+}
+
+int _starpu_free_flags_on_node(unsigned dst_node, void *A, size_t dim, int flags)
+{
 #ifndef STARPU_SIMGRID
 	if (flags & STARPU_MALLOC_PINNED && disable_pinning <= 0 && STARPU_RUNNING_ON_VALGRIND == 0)
 	{
@@ -484,7 +481,7 @@ out:
 #endif
 	if (flags & STARPU_MALLOC_COUNT)
 	{
-		starpu_memory_deallocate(STARPU_MAIN_RAM, dim);
+		starpu_memory_deallocate(dst_node, dim);
 	}
 
 	return 0;
@@ -522,11 +519,7 @@ _starpu_malloc_on_node(unsigned dst_node, size_t size, int flags)
 	{
 		case STARPU_CPU_RAM:
 		{
-#ifdef STARPU_USE_NUMA
 			_starpu_malloc_flags_on_node(dst_node, (void**) &addr, size,			
-#else /* STARPU_USE_NUMA */
-			starpu_malloc_flags((void**) &addr, size,
-#endif /* STARPU_USE_NUMA */
 #if defined(STARPU_USE_CUDA) && !defined(HAVE_CUDA_MEMCPY_PEER) && !defined(STARPU_SIMGRID)
 					/* without memcpy_peer, we can not
 					 * allocated pinned memory, since it
@@ -650,7 +643,7 @@ _starpu_free_on_node_flags(unsigned dst_node, uintptr_t addr, size_t size, int f
 	switch(kind)
 	{
 		case STARPU_CPU_RAM:
-			starpu_free_flags((void*)addr, size,
+			_starpu_free_flags_on_node(dst_node, (void*)addr, size,
 #if defined(STARPU_USE_CUDA) && !defined(HAVE_CUDA_MEMCPY_PEER) && !defined(STARPU_SIMGRID)
 					flags & ~STARPU_MALLOC_PINNED
 #else

+ 2 - 3
src/datawizard/malloc.h

@@ -1,6 +1,6 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
- * Copyright (C) 2013  Université de Bordeaux
+ * Copyright (C) 2013, 2017  Université de Bordeaux
  *
  * StarPU is free software; you can redistribute it and/or modify
  * it under the terms of the GNU Lesser General Public License as published by
@@ -22,7 +22,6 @@ void _starpu_malloc_shutdown(unsigned dst_node);
 
 void _starpu_free_on_node(unsigned dst_node, uintptr_t addr, size_t size);
 
-#ifdef STARPU_USE_NUMA
 int _starpu_malloc_flags_on_node(unsigned dst_node, void **A, size_t dim, int flags);
-#endif /* STARPU_USE_NUMA */
+int _starpu_free_flags_on_node(unsigned dst_node, void *A, size_t dim, int flags);
 #endif

+ 4 - 12
src/drivers/cpu/driver_cpu.c

@@ -168,21 +168,13 @@ static size_t _starpu_cpu_get_global_mem_size(int nodeid STARPU_ATTRIBUTE_UNUSED
 	size_t global_mem;
 	starpu_ssize_t limit;
 
-#ifdef STARPU_USE_NUMA
-	char name[30];
+	char name[32];
 
-	sprintf(name, "STARPU_LIMIT_CPU_%d_MEM", nodeid);
+	/* 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");
-	}	
-#else /* STARPU_USE_NUMA */
-	limit = starpu_get_env_number("STARPU_LIMIT_CPU_MEM");	
-#endif /* STARPU_USE_NUMA */
-#ifdef STARPU_DEVEL
-#  warning TODO: take into account NUMA node and check STARPU_LIMIT_CPU_numanode_MEM
-#endif
 
 #if defined(STARPU_HAVE_HWLOC)
 	struct _starpu_machine_topology *topology = &config->topology;
@@ -195,7 +187,7 @@ static size_t _starpu_cpu_get_global_mem_size(int nodeid STARPU_ATTRIBUTE_UNUSED
 	else
 	     global_mem = hwloc_get_obj_by_depth(topology->hwtopology, depth_node, nodeid)->memory.local_memory;
 #else /* STARPU_USE_NUMA */
-	/* Do not limit ourself to a single NUMA node yet, as we don't have real NUMA support for now */
+	/* Do not limit ourself to a single NUMA node */
 	global_mem = hwloc_get_root_obj(topology->hwtopology)->memory.total_memory;
 #endif /* STARPU_USE_NUMA */
 

+ 1 - 0
src/util/openmp_runtime_support.c

@@ -2418,6 +2418,7 @@ void starpu_omp_atomic_fallback_inline_end(void)
 
 void starpu_omp_vector_annotate(starpu_data_handle_t handle, uint32_t slice_base)
 {
+	/* FIXME Oli? */
 	int node = STARPU_MAIN_RAM;
 #ifdef STARPU_USE_NUMA
 	node = handle->home_node;