Browse Source

The --disable-blocking-drivers makes it possible to disable the use of
condition variables to make the workers sleep when there is no available task.
This is an experimental option.

Cédric Augonnet 14 years ago
parent
commit
0003cb731e

+ 10 - 1
configure.ac

@@ -449,11 +449,20 @@ AM_CONDITIONAL(STARPU_USE_GORDON, test x$enable_gordon = xyes)
 
 if test x$enable_gordon = xyes; then
 	AC_DEFINE(STARPU_USE_GORDON, [1], [Cell support is enabled])
-	AC_DEFINE(STARPU_NON_BLOCKING_DRIVERS, [1], [drivers must progress])
 	GORDON_REQUIRES=gordon
 fi
 AC_SUBST(GORDON_REQUIRES)
 
+AC_MSG_CHECKING(whether debug mode should be enabled)
+AC_ARG_ENABLE(blocking-drivers, [AS_HELP_STRING([--disable-blocking-drivers], [disable blocking drivers])],
+				enable_blocking=$enableval, enable_debug=$enable_gordon)
+AC_MSG_RESULT($enable_blocking)
+
+if test x$enable_blocking = xno; then
+	AC_DEFINE(STARPU_NON_BLOCKING_DRIVERS, [1], [drivers must progress])
+fi
+
+
 ###############################################################################
 #                                                                             #
 #                   Debug and Performance analysis tools                      #

+ 2 - 0
src/core/jobs.c

@@ -336,8 +336,10 @@ int _starpu_push_local_task(struct starpu_worker_s *worker, struct starpu_job_s
 
 	PTHREAD_MUTEX_UNLOCK(&worker->local_jobs_mutex);
 
+#ifndef STARPU_NON_BLOCKING_DRIVERS
 	/* XXX that's a bit excessive ... */
 	_starpu_wake_all_blocked_workers_on_node(worker->memory_node);
+#endif
 
 	return 0;
 }

+ 4 - 0
src/core/workers.c

@@ -350,6 +350,9 @@ unsigned _starpu_machine_is_running(void)
 
 unsigned _starpu_worker_can_block(unsigned memnode)
 {
+#ifdef STARPU_NON_BLOCKING_DRIVERS
+	return 0;
+#else
 	unsigned can_block = 1;
 
 	if (!_starpu_check_that_no_data_request_exists(memnode))
@@ -362,6 +365,7 @@ unsigned _starpu_worker_can_block(unsigned memnode)
 		can_block = 0;
 
 	return can_block;
+#endif
 }
 
 static void _starpu_kill_all_workers(struct starpu_machine_config_s *config)

+ 4 - 0
src/datawizard/data_request.c

@@ -151,7 +151,9 @@ int _starpu_wait_data_request_completion(starpu_data_request_t r, unsigned may_a
 
 		_starpu_spin_unlock(&r->lock);
 
+#ifndef STARPU_NON_BLOCKING_DRIVERS
 		_starpu_wake_all_blocked_workers_on_node(r->handling_node);
+#endif
 
 		_starpu_datawizard_progress(local_node, may_alloc);
 
@@ -195,7 +197,9 @@ void _starpu_post_data_request(starpu_data_request_t r, uint32_t handling_node)
 
 	PTHREAD_MUTEX_UNLOCK(&data_requests_list_mutex[handling_node]);
 
+#ifndef STARPU_NON_BLOCKING_DRIVERS
 	_starpu_wake_all_blocked_workers_on_node(handling_node);
+#endif
 }
 
 /* We assume that r->lock is taken by the caller */

+ 2 - 1
src/sched_policies/eager_central_priority_policy.c

@@ -121,7 +121,8 @@ static struct starpu_task *_starpu_priority_pop_task(void)
 	if ((taskq->total_ntasks == 0) && _starpu_machine_is_running())
 	{
 #ifdef STARPU_NON_BLOCKING_DRIVERS
-		_starpu_datawizard_progress(q->memory_node, 1);
+		PTHREAD_MUTEX_UNLOCK(&global_sched_mutex);
+		return NULL;
 #else
 		PTHREAD_COND_WAIT(&global_sched_cond, &global_sched_mutex);
 #endif