|
@@ -2,7 +2,7 @@
|
|
*
|
|
*
|
|
* Copyright (C) 2011,2012 Inria
|
|
* Copyright (C) 2011,2012 Inria
|
|
* Copyright (C) 2010,2011,2014 Université de Bordeaux
|
|
* Copyright (C) 2010,2011,2014 Université de Bordeaux
|
|
- * Copyright (C) 2010-2013,2015,2017 CNRS
|
|
|
|
|
|
+ * Copyright (C) 2010-2013,2015,2017,2019 CNRS
|
|
*
|
|
*
|
|
* StarPU is free software; you can redistribute it and/or modify
|
|
* StarPU is free software; you can redistribute it and/or modify
|
|
* it under the terms of the GNU Lesser General Public License as published by
|
|
* it under the terms of the GNU Lesser General Public License as published by
|
|
@@ -20,12 +20,7 @@
|
|
#include <common/config.h>
|
|
#include <common/config.h>
|
|
#include <core/task.h>
|
|
#include <core/task.h>
|
|
|
|
|
|
-/* This creates (and submits) an empty task that unlocks a tag once all its
|
|
|
|
- * dependencies are fulfilled. */
|
|
|
|
-/* TODO it would be nice to have such a function without sync_tag in case we
|
|
|
|
- * just want to execute the callback. */
|
|
|
|
-void starpu_create_sync_task(starpu_tag_t sync_tag, unsigned ndeps, starpu_tag_t *deps,
|
|
|
|
- void (*callback)(void *), void *callback_arg)
|
|
|
|
|
|
+void starpu_create_sync_task(starpu_tag_t sync_tag, unsigned ndeps, starpu_tag_t *deps, void (*callback)(void *), void *callback_arg)
|
|
{
|
|
{
|
|
starpu_tag_declare_deps_array(sync_tag, ndeps, deps);
|
|
starpu_tag_declare_deps_array(sync_tag, ndeps, deps);
|
|
|
|
|
|
@@ -45,3 +40,18 @@ void starpu_create_sync_task(starpu_tag_t sync_tag, unsigned ndeps, starpu_tag_t
|
|
int sync_ret = _starpu_task_submit_internally(sync_task);
|
|
int sync_ret = _starpu_task_submit_internally(sync_task);
|
|
STARPU_ASSERT(!sync_ret);
|
|
STARPU_ASSERT(!sync_ret);
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+void starpu_create_callback_task(void (*callback)(void *), void *callback_arg)
|
|
|
|
+{
|
|
|
|
+ /* We create an empty task */
|
|
|
|
+ struct starpu_task *empty_task = starpu_task_create();
|
|
|
|
+ empty_task->name = "empty_task";
|
|
|
|
+ empty_task->callback_func = callback;
|
|
|
|
+ empty_task->callback_arg = callback_arg;
|
|
|
|
+
|
|
|
|
+ /* This task does nothing */
|
|
|
|
+ empty_task->cl = NULL;
|
|
|
|
+
|
|
|
|
+ int ret = _starpu_task_submit_internally(empty_task);
|
|
|
|
+ STARPU_ASSERT(!ret);
|
|
|
|
+}
|