Ver código fonte

Merge remote-tracking branch 'origin/master'

HE Kun 4 anos atrás
pai
commit
1895cc8f0e
3 arquivos alterados com 17 adições e 23 exclusões
  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;
 
 #ifdef STARPU_QUICK_CHECK
-static int i_max = 5;
+static int i_max = 2;
 static int long long n = 2048;
 #elif !defined(STARPU_LONG_CHECK)
 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.
-	   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
-	   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
 	   the size of the return value must be set in starpu_task::cl_ret_size .
 	*/
 	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.
 	   starpu_task::cl_ret_size can be used for MPI supoort.
 	*/
@@ -804,6 +804,7 @@ struct starpu_task
 	   pointer and the argument.
 	*/
 	void (*callback_func)(void *);
+
 	/**
 	   Optional field, the default value is <c>NULL</c>. This 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
 	   function pointer of prototype <c>void (*f)(void *)</c> which specifies
 	   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>.
 
 	   With starpu_task_insert() and alike this can be specified thanks to
 	   ::STARPU_EPILOGUE_CALLBACK followed by the function pointer.
 	*/
 	void (*epilogue_callback_func)(void *);
+
 	/**
 	   Optional field, the default value is <c>NULL</c>. This is
 	   the pointer passed to the epilogue callback function. This field is
@@ -937,7 +939,6 @@ struct starpu_task
 	*/
 	unsigned callback_arg_free:1;
 
-
 	/**
 	   Optional field. In case starpu_task::epilogue_callback_arg was
 	   allocated by the application through <c>malloc()</c>,
@@ -1348,8 +1349,8 @@ struct starpu_task
 	.cl_ret_size = 0,				\
 	.callback_func = NULL,				\
 	.callback_arg = NULL,				\
-	.epilogue_callback_func = NULL,				\
-	.epilogue_callback_arg = NULL,				\
+	.epilogue_callback_func = NULL,			\
+	.epilogue_callback_arg = NULL,			\
 	.priority = STARPU_DEFAULT_PRIO,		\
 	.use_tag = 0,					\
 	.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;
 	unsigned sched_ctx = task->sched_ctx;
 	double flops = task->flops;
-	void (*epilogue_callback)(void *) = task->epilogue_callback_func;
-	
+
 	const unsigned continuation =
 #ifdef STARPU_OPENMP
 		j->continuation
@@ -304,15 +303,13 @@ void _starpu_handle_job_termination(struct _starpu_job *j)
 		0
 #endif
 		;
+
 	if (!continuation)
 	{
+		void (*epilogue_callback)(void *) = task->epilogue_callback_func;
 		/* the epilogue callback is executed before the dependencies release*/
 		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
 			 * within the 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_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_set_current_task(current_task);
 
 			_starpu_set_local_worker_status(STATUS_UNKNOWN);
-
-			if (profiling && task->profiling_info)
-				_starpu_clock_gettime(&task->profiling_info->callback_end_time);
 		}
 	}
+
 #ifdef STARPU_DEBUG
 	STARPU_PTHREAD_MUTEX_LOCK(&all_jobs_list_mutex);
 	_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_TRACE_START_CALLBACK(j);
-			if (callback)
-				callback(task->callback_arg);
+			callback(task->callback_arg);
 			_STARPU_TRACE_END_CALLBACK(j);
 
 			_starpu_set_current_task(current_task);