Browse Source

Drop Read access from destination of starpu_data_cpy. Add _starpu_data_cpy which has a reduction flag

Samuel Thibault 13 years ago
parent
commit
443f775187
2 changed files with 40 additions and 4 deletions
  1. 14 4
      src/util/starpu_data_cpy.c
  2. 26 0
      src/util/starpu_data_cpy.h

+ 14 - 4
src/util/starpu_data_cpy.c

@@ -1,6 +1,6 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
- * Copyright (C) 2010  Université de Bordeaux 1
+ * Copyright (C) 2010, 2012  Université de Bordeaux 1
  *
  * 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
@@ -16,6 +16,7 @@
 
 #include <starpu.h>
 #include <common/config.h>
+#include <core/task.h>
 #include <datawizard/datawizard.h>
 
 static void data_cpy_func(void *descr[], void *cl_arg)
@@ -63,18 +64,21 @@ static struct starpu_codelet copy_cl =
 	.cuda_funcs = {data_cpy_func, NULL},
 	.opencl_funcs = {data_cpy_func, NULL},
 	.nbuffers = 2,
-	.modes = {STARPU_RW, STARPU_R},
+	.modes = {STARPU_W, STARPU_R},
 	.model = &copy_model
 };
 
-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 _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)
 {
 	const struct starpu_data_copy_methods *copy_methods = dst_handle->ops->copy_methods;
 
 	struct starpu_task *task = starpu_task_create();
 	STARPU_ASSERT(task);
 
+	struct _starpu_job *j = _starpu_get_job_associated_to_task(task);
+	j->reduction_task = reduction;
+
 	task->cl = &copy_cl;
 	task->cl_arg = (void *)copy_methods;
 
@@ -91,3 +95,9 @@ int starpu_data_cpy(starpu_data_handle_t dst_handle, starpu_data_handle_t src_ha
 
 	return 0;
 }
+
+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);
+}

+ 26 - 0
src/util/starpu_data_cpy.h

@@ -0,0 +1,26 @@
+/* StarPU --- Runtime system for heterogeneous multicore architectures.
+ *
+ * Copyright (C) 2012  Université Bordeaux 1
+ *
+ * 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
+ * the Free Software Foundation; either version 2.1 of the License, or (at
+ * your option) any later version.
+ *
+ * StarPU is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * See the GNU Lesser General Public License in COPYING.LGPL for more details.
+ */
+
+#ifndef __STARPU_DATA_CPY_H__
+#define __STARPU_DATA_CPY_H__
+
+#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);
+
+#endif // __STARPU_DATA_CPY_H__
+