Przeglądaj źródła

Do not call post_exec hooks for nowhere tasks, and make sure to test that.

Samuel Thibault 8 lat temu
rodzic
commit
a5e37a6b3b
2 zmienionych plików z 11 dodań i 1 usunięć
  1. 1 1
      src/core/jobs.c
  2. 10 0
      tests/datawizard/nowhere.c

+ 1 - 1
src/core/jobs.c

@@ -418,7 +418,7 @@ void _starpu_handle_job_termination(struct _starpu_job *j)
 	 * scheduler to process it : the task structure doesn't contain any valuable
 	 * data as it's not linked to an actual worker */
 	/* control task should not execute post_exec_hook */
-	if(j->task_size == 1 && task->cl != NULL && !j->internal
+	if(j->task_size == 1 && task->cl != NULL && task->cl->where != STARPU_NOWHERE && !j->internal
 #ifdef STARPU_OPENMP
 	/* If this is a continuation, we do not execute the post_exec_hook. The
 	 * post_exec_hook will be run only when the continued task fully

+ 10 - 0
tests/datawizard/nowhere.c

@@ -41,6 +41,12 @@ static struct starpu_codelet cl_prod =
 	.modes = { STARPU_W },
 };
 
+static void callback0(void *callback_arg)
+{
+	STARPU_ASSERT(x==0);
+	STARPU_ASSERT(y==0);
+}
+
 static void callback(void *callback_arg)
 {
 	STARPU_ASSERT(x>=1);
@@ -81,6 +87,10 @@ int main(int argc, char **argv)
 	starpu_variable_data_register(&handle_x, STARPU_MAIN_RAM, (uintptr_t)&x, sizeof(x));
 	starpu_variable_data_register(&handle_y, STARPU_MAIN_RAM, (uintptr_t)&y, sizeof(y));
 
+	ret = starpu_task_insert(&cl_nowhere, STARPU_R, handle_x, STARPU_R, handle_y, STARPU_CALLBACK, callback0, 0);
+	if (ret == -ENODEV) goto enodev;
+	STARPU_CHECK_RETURN_VALUE(ret, "starpu_task_submit");
+
 	ret = starpu_task_insert(&cl_prod, STARPU_W, handle_x, 0);
 	if (ret == -ENODEV) goto enodev;
 	STARPU_CHECK_RETURN_VALUE(ret, "starpu_task_submit");