Samuel Thibault 8 lat temu
rodzic
commit
fd8680b2e6

+ 1 - 1
src/core/workers.c

@@ -1516,7 +1516,7 @@ void starpu_shutdown(void)
 	/* tell all workers to shutdown */
 	_starpu_kill_all_workers(&_starpu_config);
 	
-	int i;
+	unsigned i;
 	unsigned nb_numa_nodes = _starpu_get_nb_numa_nodes();
 	for (i=0; i<nb_numa_nodes; i++)
 	{

+ 13 - 1
src/datawizard/datawizard.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, 2013  CNRS
  *
  * StarPU is free software; you can redistribute it and/or modify
@@ -67,3 +67,15 @@ void _starpu_datawizard_progress(unsigned memory_node, unsigned may_alloc)
 {
 	__starpu_datawizard_progress(memory_node, may_alloc, 1);
 }
+
+int __starpu_datawizard_progress_ram(unsigned may_alloc, unsigned push_requests)
+{
+	int res = 0, i;
+	unsigned nb_numa_nodes = _starpu_get_nb_numa_nodes();
+	for (i=0; i<nb_numa_nodes; i++)
+	{
+		unsigned id = _starpu_numaid_to_memnode(i);
+		res |= __starpu_datawizard_progress(id, may_alloc, push_requests);
+	}
+	return res;
+}

+ 2 - 1
src/datawizard/datawizard.h

@@ -1,6 +1,6 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
- * Copyright (C) 2009, 2010, 2014  Université de Bordeaux
+ * Copyright (C) 2009, 2010, 2014, 2017  Université de Bordeaux
  * Copyright (C) 2010, 2013  CNRS
  *
  * StarPU is free software; you can redistribute it and/or modify
@@ -35,5 +35,6 @@
 
 int __starpu_datawizard_progress(unsigned memory_node, unsigned may_alloc, unsigned push_requests);
 void _starpu_datawizard_progress(unsigned memory_node, unsigned may_alloc);
+int __starpu_datawizard_progress_ram(unsigned may_alloc, unsigned push_requests);
 
 #endif // __DATAWIZARD_H__

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

@@ -243,20 +243,16 @@ int _starpu_cpu_driver_run_once(struct _starpu_worker *cpu_worker)
 	unsigned memnode = cpu_worker->memory_node;
 	int workerid = cpu_worker->workerid;
 
-	int res = 0;
+	int res;
 
 #ifdef STARPU_SIMGRID
 	starpu_pthread_wait_reset(&cpu_worker->wait);
 #endif
 
 	_STARPU_TRACE_START_PROGRESS(memnode);
-	unsigned i;
-	unsigned nb_numa_nodes = _starpu_get_nb_numa_nodes();
-	for (i=0; i<nb_numa_nodes; i++)
-	{
-		unsigned id = _starpu_numaid_to_memnode(i);			
-		res |= __starpu_datawizard_progress(id, 1, 1);
-	}
+	res = __starpu_datawizard_progress_ram(1, 1);
+	if (starpu_node_get_kind(memnode) != STARPU_CPU_RAM)
+		res |= __starpu_datawizard_progress(memnode, 1, 1);
 	_STARPU_TRACE_END_PROGRESS(memnode);
 
 	struct _starpu_job *j;

+ 3 - 12
src/drivers/cuda/driver_cuda.c

@@ -809,14 +809,10 @@ int _starpu_cuda_driver_run_once(struct _starpu_worker_set *worker_set)
 #if defined(STARPU_NON_BLOCKING_DRIVERS) && !defined(STARPU_SIMGRID)
 	if (!idle)
 	{
+
 		/* Nothing ready yet, no better thing to do than waiting */
 		__starpu_datawizard_progress(memnode, 1, 0);
-		int nb_numa_nodes = _starpu_get_nb_numa_nodes();
-		for (i=0; i<nb_numa_nodes; i++)
-		{
-			unsigned id = _starpu_numaid_to_memnode(i);
-			__starpu_datawizard_progress(id, 1, 0);
-		}
+		__starpu_datawizard_progress_ram(1, 0);
 		return 0;
 	}
 #endif
@@ -824,12 +820,7 @@ int _starpu_cuda_driver_run_once(struct _starpu_worker_set *worker_set)
 	/* Something done, make some progress */
 	res = !idle;
 	res |= __starpu_datawizard_progress(memnode, 1, 1);
-	int nb_numa_nodes = _starpu_get_nb_numa_nodes();
-	for (i=0; i<nb_numa_nodes; i++)
-	{
-		unsigned id = _starpu_numaid_to_memnode(i);
-		res |= __starpu_datawizard_progress(id, 1, 1);
-	}
+	res |= __starpu_datawizard_progress_ram(1, 1);
 
 	/* And pull tasks */
 	res |= _starpu_get_multi_worker_task(worker_set->workers, tasks, worker_set->nworkers, memnode);

+ 1 - 6
src/drivers/mp_common/source_common.c

@@ -693,12 +693,7 @@ void _starpu_src_common_worker(struct _starpu_worker_set * worker_set,
 
 		_STARPU_TRACE_START_PROGRESS(memnode);
 		res |= __starpu_datawizard_progress(memnode, 1, 1);
-		unsigned nb_numa_nodes = _starpu_get_nb_numa_nodes;
-		for (i=0; i<nb_numa_nodes; i++)
-		{
-			unsigned id = _starpu_numaid_to_memnode(i);
-			res |= __starpu_datawizard_progress(id, 1, 1);
-		}
+		res |= __starpu_datawizard_progress_ram(1, 1);
 		_STARPU_TRACE_END_PROGRESS(memnode);
 
 		/* Handle message which have been store */

+ 2 - 14
src/drivers/opencl/driver_opencl.c

@@ -757,26 +757,14 @@ int _starpu_opencl_driver_run_once(struct _starpu_worker *worker)
 	{
 		/* Not ready yet, no better thing to do than waiting */
 		__starpu_datawizard_progress(memnode, 1, 0);
-		unsigned nb_numa_nodes = _starpu_get_nb_numa_nodes();
-		unsigned i;
-		for (i=0; i<nb_numa_nodes; i++)
-		{
-			unsigned id = _starpu_numaid_to_memnode(i);
-			__starpu_datawizard_progress(id, 1, 0);
-		}
+		__starpu_datawizard_progress_ram(1, 0);
 		return 0;
 	}
 #endif
 
 	res = !idle;
 	res |= __starpu_datawizard_progress(memnode, 1, 1);
-	unsigned nb_numa_nodes = _starpu_get_nb_numa_nodes();
-	unsigned i;
-	for (i=0; i<nb_numa_nodes; i++)
-	{
-		unsigned id = _starpu_numaid_to_memnode(i);
-		res |= __starpu_datawizard_progress(id, 1, 1);
-	}
+	res |= __starpu_datawizard_progress_ram(1, 1);
 
 	task = _starpu_get_worker_task(worker, workerid, memnode);