Browse Source

starpupy: release task data only after the starpu core is finished with using it

Samuel Thibault 4 years ago
parent
commit
79e5dcfa70
1 changed files with 9 additions and 3 deletions
  1. 9 3
      starpupy/src/starpu_task_wrapper.c

+ 9 - 3
starpupy/src/starpu_task_wrapper.c

@@ -248,8 +248,8 @@ void starpupy_codelet_func(void *buffers[], void *cl_arg)
 	PyGILState_Release(state);
 }
 
-/*function passed to starpu_task.callback_func*/
-void cb_func(void *v)
+/*function passed to starpu_task.epilogue_callback_func*/
+void epilogue_cb_func(void *v)
 {
 	PyObject *fut; /*asyncio.Future*/
 	PyObject *loop; /*asyncio.Eventloop*/
@@ -316,6 +316,11 @@ void cb_func(void *v)
 
 	/*restore previous GIL state*/
 	PyGILState_Release(state);
+}
+
+void cb_func(void *v)
+{
+	struct starpu_task *task = starpu_task_get_current();
 
 	/*deallocate task*/
 	free(task->cl);
@@ -576,7 +581,8 @@ static PyObject* starpu_task_submit_wrapper(PyObject *self, PyObject *args)
 	starpu_codelet_pack_arg_fini(&data, &task->cl_arg, &task->cl_arg_size);
 
 	task->prologue_callback_func=&prologue_cb_func;
-	task->epilogue_callback_func=&cb_func;
+	task->epilogue_callback_func=&epilogue_cb_func;
+	task->callback_func=&cb_func;
 
 	/*call starpu_task_submit method*/
 	int ret;