瀏覽代碼

Merge remote-tracking branch 'origin/master'

HE Kun 4 年之前
父節點
當前提交
1895cc8f0e
共有 3 個文件被更改,包括 17 次插入23 次删除
  1. 1 1
      examples/cg/cg_kernels.c
  2. 10 9
      include/starpu_task.h
  3. 6 13
      src/core/jobs.c

+ 1 - 1
examples/cg/cg_kernels.c

@@ -34,7 +34,7 @@ static const TYPE gm1 = -1.0;
 static int nblocks = 8;
 static int nblocks = 8;
 
 
 #ifdef STARPU_QUICK_CHECK
 #ifdef STARPU_QUICK_CHECK
-static int i_max = 5;
+static int i_max = 2;
 static int long long n = 2048;
 static int long long n = 2048;
 #elif !defined(STARPU_LONG_CHECK)
 #elif !defined(STARPU_LONG_CHECK)
 static int long long n = 4096;
 static int long long n = 4096;

+ 10 - 9
include/starpu_task.h

@@ -771,17 +771,17 @@ struct starpu_task
 
 
 	/**
 	/**
 	   Optional pointer which points to the return value of submitted task.
 	   Optional pointer which points to the return value of submitted task.
-	   The default value is <c>NULL</c>. starpu_codelet_pack_arg() 
+	   The default value is <c>NULL</c>. starpu_codelet_pack_arg()
 	   and starpu_codelet_unpack_arg() can be used to respectively
 	   and starpu_codelet_unpack_arg() can be used to respectively
-	   pack and unpack the return value into and form it. starpu_task::cl_ret 
+	   pack and unpack the return value into and form it. starpu_task::cl_ret
 	   can be used for MPI support. The only requirement is that
 	   can be used for MPI support. The only requirement is that
 	   the size of the return value must be set in starpu_task::cl_ret_size .
 	   the size of the return value must be set in starpu_task::cl_ret_size .
 	*/
 	*/
 	void *cl_ret;
 	void *cl_ret;
 
 
 	/**
 	/**
-	   Optional field. The buffer of starpu_codelet_pack_arg() 
-	   and starpu_codelet_unpack_arg() can be allocated with 
+	   Optional field. The buffer of starpu_codelet_pack_arg()
+	   and starpu_codelet_unpack_arg() can be allocated with
 	   the starpu_task::cl_ret_size bytes starting at address starpu_task::cl_ret.
 	   the starpu_task::cl_ret_size bytes starting at address starpu_task::cl_ret.
 	   starpu_task::cl_ret_size can be used for MPI supoort.
 	   starpu_task::cl_ret_size can be used for MPI supoort.
 	*/
 	*/
@@ -804,6 +804,7 @@ struct starpu_task
 	   pointer and the argument.
 	   pointer and the argument.
 	*/
 	*/
 	void (*callback_func)(void *);
 	void (*callback_func)(void *);
+
 	/**
 	/**
 	   Optional field, the default value is <c>NULL</c>. This is
 	   Optional field, the default value is <c>NULL</c>. This is
 	   the pointer passed to the callback function. This field is
 	   the pointer passed to the callback function. This field is
@@ -822,14 +823,15 @@ struct starpu_task
 	   Optional field, the default value is <c>NULL</c>. This is a
 	   Optional field, the default value is <c>NULL</c>. This is a
 	   function pointer of prototype <c>void (*f)(void *)</c> which specifies
 	   function pointer of prototype <c>void (*f)(void *)</c> which specifies
 	   a possible callback just as starpu_task::callback_func. But this function
 	   a possible callback just as starpu_task::callback_func. But this function
-	   is executed before task dependencies release. The callback is passed 
-	   the value contained in the starpu_task::epilogue_callback_arg field. 
+	   is executed before task dependencies release. The callback is passed
+	   the value contained in the starpu_task::epilogue_callback_arg field.
 	   No callback is executed if the field is set to <c>NULL</c>.
 	   No callback is executed if the field is set to <c>NULL</c>.
 
 
 	   With starpu_task_insert() and alike this can be specified thanks to
 	   With starpu_task_insert() and alike this can be specified thanks to
 	   ::STARPU_EPILOGUE_CALLBACK followed by the function pointer.
 	   ::STARPU_EPILOGUE_CALLBACK followed by the function pointer.
 	*/
 	*/
 	void (*epilogue_callback_func)(void *);
 	void (*epilogue_callback_func)(void *);
+
 	/**
 	/**
 	   Optional field, the default value is <c>NULL</c>. This is
 	   Optional field, the default value is <c>NULL</c>. This is
 	   the pointer passed to the epilogue callback function. This field is
 	   the pointer passed to the epilogue callback function. This field is
@@ -937,7 +939,6 @@ struct starpu_task
 	*/
 	*/
 	unsigned callback_arg_free:1;
 	unsigned callback_arg_free:1;
 
 
-
 	/**
 	/**
 	   Optional field. In case starpu_task::epilogue_callback_arg was
 	   Optional field. In case starpu_task::epilogue_callback_arg was
 	   allocated by the application through <c>malloc()</c>,
 	   allocated by the application through <c>malloc()</c>,
@@ -1348,8 +1349,8 @@ struct starpu_task
 	.cl_ret_size = 0,				\
 	.cl_ret_size = 0,				\
 	.callback_func = NULL,				\
 	.callback_func = NULL,				\
 	.callback_arg = NULL,				\
 	.callback_arg = NULL,				\
-	.epilogue_callback_func = NULL,				\
-	.epilogue_callback_arg = NULL,				\
+	.epilogue_callback_func = NULL,			\
+	.epilogue_callback_arg = NULL,			\
 	.priority = STARPU_DEFAULT_PRIO,		\
 	.priority = STARPU_DEFAULT_PRIO,		\
 	.use_tag = 0,					\
 	.use_tag = 0,					\
 	.sequential_consistency = 1,			\
 	.sequential_consistency = 1,			\

+ 6 - 13
src/core/jobs.c

@@ -295,8 +295,7 @@ void _starpu_handle_job_termination(struct _starpu_job *j)
 	struct starpu_task *end_rdep = NULL;
 	struct starpu_task *end_rdep = NULL;
 	unsigned sched_ctx = task->sched_ctx;
 	unsigned sched_ctx = task->sched_ctx;
 	double flops = task->flops;
 	double flops = task->flops;
-	void (*epilogue_callback)(void *) = task->epilogue_callback_func;
-	
+
 	const unsigned continuation =
 	const unsigned continuation =
 #ifdef STARPU_OPENMP
 #ifdef STARPU_OPENMP
 		j->continuation
 		j->continuation
@@ -304,15 +303,13 @@ void _starpu_handle_job_termination(struct _starpu_job *j)
 		0
 		0
 #endif
 #endif
 		;
 		;
+
 	if (!continuation)
 	if (!continuation)
 	{
 	{
+		void (*epilogue_callback)(void *) = task->epilogue_callback_func;
 		/* the epilogue callback is executed before the dependencies release*/
 		/* the epilogue callback is executed before the dependencies release*/
 		if (epilogue_callback)
 		if (epilogue_callback)
 		{
 		{
-			int profiling = starpu_profiling_status_get();
-			if (profiling && task->profiling_info)
-				_starpu_clock_gettime(&task->profiling_info->callback_start_time);
-
 			/* so that we can check whether we are doing blocking calls
 			/* so that we can check whether we are doing blocking calls
 			 * within the callback */
 			 * within the callback */
 			_starpu_set_local_worker_status(STATUS_CALLBACK);
 			_starpu_set_local_worker_status(STATUS_CALLBACK);
@@ -325,18 +322,15 @@ void _starpu_handle_job_termination(struct _starpu_job *j)
 			_starpu_set_current_task(task);
 			_starpu_set_current_task(task);
 
 
 			_STARPU_TRACE_START_CALLBACK(j);
 			_STARPU_TRACE_START_CALLBACK(j);
-			if (epilogue_callback)
-				epilogue_callback(task->epilogue_callback_arg);
+			epilogue_callback(task->epilogue_callback_arg);
 			_STARPU_TRACE_END_CALLBACK(j);
 			_STARPU_TRACE_END_CALLBACK(j);
 
 
 			_starpu_set_current_task(current_task);
 			_starpu_set_current_task(current_task);
 
 
 			_starpu_set_local_worker_status(STATUS_UNKNOWN);
 			_starpu_set_local_worker_status(STATUS_UNKNOWN);
-
-			if (profiling && task->profiling_info)
-				_starpu_clock_gettime(&task->profiling_info->callback_end_time);
 		}
 		}
 	}
 	}
+
 #ifdef STARPU_DEBUG
 #ifdef STARPU_DEBUG
 	STARPU_PTHREAD_MUTEX_LOCK(&all_jobs_list_mutex);
 	STARPU_PTHREAD_MUTEX_LOCK(&all_jobs_list_mutex);
 	_starpu_job_multilist_erase_all_submitted(&all_jobs_list, j);
 	_starpu_job_multilist_erase_all_submitted(&all_jobs_list, j);
@@ -494,8 +488,7 @@ void _starpu_handle_job_termination(struct _starpu_job *j)
 			_starpu_set_current_task(task);
 			_starpu_set_current_task(task);
 
 
 			_STARPU_TRACE_START_CALLBACK(j);
 			_STARPU_TRACE_START_CALLBACK(j);
-			if (callback)
-				callback(task->callback_arg);
+			callback(task->callback_arg);
 			_STARPU_TRACE_END_CALLBACK(j);
 			_STARPU_TRACE_END_CALLBACK(j);
 
 
 			_starpu_set_current_task(current_task);
 			_starpu_set_current_task(current_task);