Parcourir la source

The copy for reduction into lazy allocation needs to depend on the reduction task graph

Samuel Thibault il y a 13 ans
Parent
commit
fe8ca57b3d
3 fichiers modifiés avec 10 ajouts et 5 suppressions
  1. 1 1
      src/datawizard/reduction.c
  2. 7 3
      src/util/starpu_data_cpy.c
  3. 2 1
      src/util/starpu_data_cpy.h

+ 1 - 1
src/datawizard/reduction.c

@@ -245,7 +245,7 @@ void _starpu_data_end_reduction_mode(starpu_data_handle_t handle)
 
 		if (empty)
 			/* The handle was empty, we just need to copy the reduced value. */
-			_starpu_data_cpy(handle, replicate_array[0], 1, NULL, 0, 1);
+			_starpu_data_cpy(handle, replicate_array[0], 1, NULL, 0, 1, last_replicate_deps[0]);
 
 #else
 		if (empty) {

+ 7 - 3
src/util/starpu_data_cpy.c

@@ -69,7 +69,8 @@ static struct starpu_codelet copy_cl =
 };
 
 int _starpu_data_cpy(starpu_data_handle_t dst_handle, starpu_data_handle_t src_handle,
-			int asynchronous, void (*callback_func)(void*), void *callback_arg, int reduction)
+			int asynchronous, void (*callback_func)(void*), void *callback_arg,
+			int reduction, struct starpu_task *reduction_dep_task)
 {
 	const struct starpu_data_copy_methods *copy_methods = dst_handle->ops->copy_methods;
 
@@ -77,7 +78,10 @@ int _starpu_data_cpy(starpu_data_handle_t dst_handle, starpu_data_handle_t src_h
 	STARPU_ASSERT(task);
 
 	struct _starpu_job *j = _starpu_get_job_associated_to_task(task);
-	j->reduction_task = reduction;
+	if (reduction) {
+		j->reduction_task = reduction;
+		starpu_task_declare_deps_array(task, 1, &reduction_dep_task);
+	}
 
 	task->cl = &copy_cl;
 	task->cl_arg = (void *)copy_methods;
@@ -99,5 +103,5 @@ int _starpu_data_cpy(starpu_data_handle_t dst_handle, starpu_data_handle_t src_h
 int starpu_data_cpy(starpu_data_handle_t dst_handle, starpu_data_handle_t src_handle,
 			int asynchronous, void (*callback_func)(void*), void *callback_arg)
 {
-	return _starpu_data_cpy(dst_handle, src_handle, asynchronous, callback_func, callback_arg, 0);
+	return _starpu_data_cpy(dst_handle, src_handle, asynchronous, callback_func, callback_arg, 0, NULL);
 }

+ 2 - 1
src/util/starpu_data_cpy.h

@@ -20,7 +20,8 @@
 #include <starpu.h>
 
 int _starpu_data_cpy(starpu_data_handle_t dst_handle, starpu_data_handle_t src_handle,
-			int asynchronous, void (*callback_func)(void*), void *callback_arg, int reduction);
+			int asynchronous, void (*callback_func)(void*), void *callback_arg,
+			int reduction, struct starpu_task *reduction_dep_task);
 
 #endif // __STARPU_DATA_CPY_H__