浏览代码

backport branches/starpu-1.1@13974: mpi: new data acces mode STARPU_SSYNC to be used in starpu_mpi_insert_task to specify the data has to be sent using a synchronous and non-blocking mode

Nathalie Furmento 10 年之前
父节点
当前提交
86d965a229

+ 3 - 0
ChangeLog

@@ -140,6 +140,9 @@ New features:
   * New MPI functions starpu_mpi_issend and starpu_mpi_issend_detached
     to send data using a synchronous and non-blocking mode (internally
     uses MPI_Issend)
+  * New data access mode flag STARPU_SSYNC to be set when calling
+    starpu_mpi_insert_task to specify the data has to be sent using a
+    synchronous and non-blocking mode
 
 Changes:
   * Fix complexity of implicit task/data dependency, from quadratic to linear.

+ 4 - 0
doc/doxygen/chapters/api/data_management.doxy

@@ -60,6 +60,10 @@ or ::STARPU_RW to express that StarPU can let tasks commute, which is
 useful e.g. when bringing a contribution into some data, which can be
 done in any order (but still require sequential consistency against
 reads or non-commutative writes).
+\var starpu_data_access_mode::STARPU_SSYNC
+\ingroup API_Data_Management
+used in starpu_mpi_insert_task() to specify the data has to be sent
+using a synchronous and non-blocking mode (see starpu_mpi_issend())
 
 @name Basic Data Management API
 \ingroup API_Data_Management

+ 5 - 2
doc/doxygen/chapters/api/mpi.doxy

@@ -254,8 +254,11 @@ This function does the same as the function starpu_mpi_task_insert(). It has bee
 Create and submit a task corresponding to codelet with the following
 arguments. The argument list must be zero-terminated.
 
-The arguments following the codelets are the same types as for the
-function starpu_task_insert(). The extra argument
+The arguments following the codelet are the same types as for the
+function starpu_task_insert(). Access modes for data can also be set
+with ::STARPU_SSYNC to specify the data has to be sent using a
+synchronous and non-blocking mode (see starpu_mpi_issend()).
+The extra argument
 ::STARPU_EXECUTE_ON_NODE followed by an integer allows to specify the
 MPI node to execute the codelet. It is also possible to specify that
 the node owning a specific data will execute the codelet, by using

+ 3 - 2
include/starpu_data.h

@@ -1,7 +1,7 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
  * Copyright (C) 2010-2014  Université de Bordeaux
- * Copyright (C) 2010, 2011, 2012, 2013  Centre National de la Recherche Scientifique
+ * Copyright (C) 2010, 2011, 2012, 2013, 2014  Centre National de la Recherche Scientifique
  *
  * 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
@@ -36,7 +36,8 @@ enum starpu_data_access_mode
 	STARPU_RW=(STARPU_R|STARPU_W),
 	STARPU_SCRATCH=(1<<2),
 	STARPU_REDUX=(1<<3),
-	STARPU_COMMUTE=(1<<4)
+	STARPU_COMMUTE=(1<<4),
+	STARPU_SSYNC=(1<<5)
 	/* Note: other STARPU_* values in include/starpu_task_util.h */
 };
 

+ 9 - 3
mpi/src/starpu_mpi_task_insert.c

@@ -31,6 +31,12 @@
 #include <starpu_mpi_cache.h>
 #include <starpu_mpi_select_node.h>
 
+#define _SEND_DATA(data, mode, dest, mpi_tag, comm, callback, arg)     \
+	if (mode & STARPU_SSYNC)					\
+		starpu_mpi_issend_detached(data, dest, mpi_tag, comm, callback, arg); \
+	else								\
+		starpu_mpi_isend_detached(data, dest, mpi_tag, comm, callback, arg);
+
 static
 int _starpu_mpi_find_executee_node(starpu_data_handle_t data, enum starpu_data_access_mode mode, int me, int *do_execute, int *inconsistent_execute, int *xrank)
 {
@@ -125,7 +131,7 @@ void _starpu_mpi_exchange_data_before_execution(starpu_data_handle_t data, enum
 			if (already_sent == NULL)
 			{
 				_STARPU_MPI_DEBUG(1, "Send data %p to %d\n", data, xrank);
-				starpu_mpi_isend_detached(data, xrank, mpi_tag, comm, NULL, NULL);
+				_SEND_DATA(data, mode, xrank, mpi_tag, comm, NULL, NULL);
 			}
 		}
 	}
@@ -159,7 +165,7 @@ void _starpu_mpi_exchange_data_after_execution(starpu_data_handle_t data, enum s
 		else if (do_execute)
 		{
 			_STARPU_MPI_DEBUG(1, "Send data %p back to its owner %d...\n", data, mpi_rank);
-			starpu_mpi_isend_detached(data, mpi_rank, mpi_tag, comm, NULL, NULL);
+			_SEND_DATA(data, mode, mpi_rank, mpi_tag, comm, NULL, NULL);
 		}
 	}
 }
@@ -254,7 +260,7 @@ int _starpu_mpi_task_decode_v(struct starpu_codelet *codelet, int me, int nb_nod
 			// calling function _starpu_task_insert_create()
 			(void)va_arg(varg_list_copy, unsigned);
 		}
-		else if (arg_type_nocommute==STARPU_R || arg_type_nocommute==STARPU_W || arg_type_nocommute==STARPU_RW || arg_type==STARPU_SCRATCH || arg_type==STARPU_REDUX)
+		else if (arg_type_nocommute & STARPU_R || arg_type_nocommute & STARPU_W || arg_type_nocommute & STARPU_RW || arg_type & STARPU_SCRATCH || arg_type & STARPU_REDUX)
 		{
 			starpu_data_handle_t data = va_arg(varg_list_copy, starpu_data_handle_t);
 			enum starpu_data_access_mode mode = (enum starpu_data_access_mode) arg_type;

+ 1 - 2
src/util/starpu_task_insert_utils.c

@@ -242,8 +242,7 @@ void _starpu_task_insert_create(struct starpu_codelet *cl, struct starpu_task **
 		{
 			/* We have an access mode : we expect to find a handle */
 			starpu_data_handle_t handle = va_arg(varg_list, starpu_data_handle_t);
-
-			enum starpu_data_access_mode mode = (enum starpu_data_access_mode) arg_type;
+			enum starpu_data_access_mode mode = (enum starpu_data_access_mode) arg_type & ~STARPU_SSYNC;
 
 			STARPU_ASSERT(cl != NULL);