Browse Source

small fixes

Samuel Thibault 8 years ago
parent
commit
76cf3612a8

+ 2 - 2
src/core/topology.c

@@ -58,8 +58,8 @@ 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 unsigned numa_memory_nodes[STARPU_MAXNUMANODES];
-static unsigned numa_numaid[STARPU_MAXNODES];
+static unsigned numa_memory_nodes[STARPU_MAXNUMANODES]; /* indexed by system logical numaid */
+static unsigned numa_numaid[STARPU_MAXNODES]; /* indexed by starpu memory node number */
 #ifdef STARPU_USE_NUMA
 static int _starpu_worker_numa_node(unsigned workerid);
 #else

+ 0 - 4
src/datawizard/interfaces/data_interface.c

@@ -994,11 +994,7 @@ static void _starpu_data_invalidate(void *data)
 
 		if (local->mc && local->allocated && local->automatically_allocated)
 		{
-#ifdef STARPU_USE_NUMA
 			if (starpu_node_get_kind(node) == STARPU_CPU_RAM)
-#else /* STARPU_USE_NUMA */		
-			if (node == STARPU_MAIN_RAM)
-#endif /* STARPU_USE_NUMA */		
 				_starpu_data_unregister_ram_pointer(handle);
 
 			/* free the data copy in a lazy fashion */

+ 1 - 1
src/datawizard/memalloc.c

@@ -631,7 +631,7 @@ static unsigned try_to_reuse_mem_chunk(struct _starpu_mem_chunk *mc, unsigned no
 			_starpu_spin_unlock(&mc_lock[node]);
 			_STARPU_TRACE_START_WRITEBACK(node);
 			int home_node = old_data->home_node;
-			if (home_node < 0 || (starpu_node_get_kind(home_node) != STARPU_CPU_RAM))
+			if (home_node < 0)
 				home_node = STARPU_MAIN_RAM;
 			res = transfer_subtree_to_node(old_data, node, home_node);
 			_STARPU_TRACE_END_WRITEBACK(node);

+ 12 - 16
src/datawizard/user_interactions.c

@@ -190,20 +190,18 @@ int starpu_data_acquire_cb(starpu_data_handle_t handle,
 			   enum starpu_data_access_mode mode, void (*callback)(void *), void *arg)
 {
 	int home_node = handle->home_node;
-	if (home_node >= 0 && (starpu_node_get_kind(home_node) == STARPU_CPU_RAM))
-		return starpu_data_acquire_on_node_cb(handle, home_node, mode, callback, arg);
-	else
-		return starpu_data_acquire_on_node_cb(handle, STARPU_MAIN_RAM, mode, callback, arg);
+	if (home_node < 0 || starpu_node_get_kind(home_node) != STARPU_CPU_RAM)
+		home_node = STARPU_MAIN_RAM;
+	return starpu_data_acquire_on_node_cb(handle, home_node, mode, callback, arg);
 }
 
 int starpu_data_acquire_cb_sequential_consistency(starpu_data_handle_t handle,
 						  enum starpu_data_access_mode mode, void (*callback)(void *), void *arg, int sequential_consistency)
 {
 	int home_node = handle->home_node;
-	if (home_node >= 0 && (starpu_node_get_kind(home_node) == STARPU_CPU_RAM))
-	 	return starpu_data_acquire_on_node_cb_sequential_consistency(handle, home_node, mode, callback, arg, sequential_consistency);
-	else
-		return starpu_data_acquire_on_node_cb_sequential_consistency(handle, STARPU_MAIN_RAM, mode, callback, arg, sequential_consistency);
+	if (home_node < 0 || starpu_node_get_kind(home_node) != STARPU_CPU_RAM)
+		home_node = STARPU_MAIN_RAM;
+	return starpu_data_acquire_on_node_cb_sequential_consistency(handle, home_node, mode, callback, arg, sequential_consistency);
 }
 
 /*
@@ -335,10 +333,9 @@ int starpu_data_acquire_on_node(starpu_data_handle_t handle, int node, enum star
 int starpu_data_acquire(starpu_data_handle_t handle, enum starpu_data_access_mode mode)
 {
 	int home_node = handle->home_node;
-	if (home_node >= 0 && (starpu_node_get_kind(home_node) == STARPU_CPU_RAM))
-	 	return starpu_data_acquire_on_node(handle, home_node, mode);
-	else
-		return starpu_data_acquire_on_node(handle, STARPU_MAIN_RAM, mode);
+	if (home_node < 0 || starpu_node_get_kind(home_node) != STARPU_CPU_RAM)
+		home_node = STARPU_MAIN_RAM;
+	return starpu_data_acquire_on_node(handle, home_node, mode);
 }
 
 /* This function must be called after starpu_data_acquire so that the
@@ -371,10 +368,9 @@ void starpu_data_release_on_node(starpu_data_handle_t handle, int node)
 void starpu_data_release(starpu_data_handle_t handle)
 {
 	int home_node = handle->home_node;
-	if (home_node >= 0 && (starpu_node_get_kind(home_node) == STARPU_CPU_RAM))
-	 	return starpu_data_release_on_node(handle, home_node);
-	else
-		starpu_data_release_on_node(handle, STARPU_MAIN_RAM);
+	if (home_node < 0 || starpu_node_get_kind(home_node) != STARPU_CPU_RAM)
+		home_node = STARPU_MAIN_RAM;
+	starpu_data_release_on_node(handle, home_node);
 }
 
 static void _prefetch_data_on_node(void *arg)