瀏覽代碼

mpi: update starpu_mpi_insert_task

     Deal with case when data model does not specify an execution node
     but a property STARPU_EXECUTE_ON_xxx does.
Nathalie Furmento 13 年之前
父節點
當前提交
40c1132c91
共有 2 個文件被更改,包括 19 次插入2 次删除
  1. 4 2
      mpi/starpu_mpi_insert_task.c
  2. 15 0
      mpi/tests/insert_task_owner.c

+ 4 - 2
mpi/starpu_mpi_insert_task.c

@@ -88,12 +88,14 @@ int starpu_mpi_insert_task(MPI_Comm comm, struct starpu_codelet *codelet, ...)
 		if (arg_type==STARPU_EXECUTE_ON_NODE) {
                         xrank = va_arg(varg_list, int);
 			_STARPU_MPI_DEBUG("Executing on node %d\n", xrank);
+			do_execute = 1;
                 }
 		else if (arg_type==STARPU_EXECUTE_ON_DATA) {
 			starpu_data_handle_t data = va_arg(varg_list, starpu_data_handle_t);
                         xrank = starpu_data_get_rank(data);
 			_STARPU_MPI_DEBUG("Executing on data node %d\n", xrank);
 			STARPU_ASSERT(xrank <= nb_nodes);
+			do_execute = 1;
                 }
 		if (arg_type==STARPU_R || arg_type==STARPU_W || arg_type==STARPU_REDUX || arg_type==STARPU_RW || arg_type == STARPU_SCRATCH) {
                         starpu_data_handle_t data = va_arg(varg_list, starpu_data_handle_t);
@@ -158,7 +160,7 @@ int starpu_mpi_insert_task(MPI_Comm comm, struct starpu_codelet *codelet, ...)
 		}
 	}
 	va_end(varg_list);
-	assert(do_execute != -1 && "StarPU needs to see a W or a REDUX data which will tell it where to execute the task");
+	STARPU_ASSERT(do_execute != -1 && "StarPU needs to see a W or a REDUX data which will tell it where to execute the task");
 
         if (inconsistent_execute == 1) {
                 if (xrank == -1) {
@@ -171,7 +173,7 @@ int starpu_mpi_insert_task(MPI_Comm comm, struct starpu_codelet *codelet, ...)
                 }
         }
 	else if (xrank != -1) {
-		_STARPU_MPI_DISP("Property STARPU_EXECUTE_ON_NODE or STARPU_EXECUTE_ON_DATA overwriting node defined by data model\n");
+		_STARPU_MPI_DEBUG("Property STARPU_EXECUTE_ON_NODE or STARPU_EXECUTE_ON_DATA overwriting node defined by data model\n");
 		do_execute = (me == xrank);
 		dest = xrank;
 	}

+ 15 - 0
mpi/tests/insert_task_owner.c

@@ -62,6 +62,14 @@ struct starpu_codelet mycodelet_w_r =
 	.modes = {STARPU_W, STARPU_R}
 };
 
+struct starpu_codelet mycodelet_r_r =
+{
+	.where = STARPU_CPU,
+	.cpu_funcs = {func_cpu, NULL},
+        .nbuffers = 2,
+	.modes = {STARPU_R, STARPU_R}
+};
+
 int main(int argc, char **argv)
 {
         int ret, rank, size, err, node;
@@ -135,6 +143,13 @@ int main(int argc, char **argv)
 				     0);
         assert(err == 0);
 
+	node = 0;
+        err = starpu_mpi_insert_task(MPI_COMM_WORLD, &mycodelet_r_r,
+				     STARPU_VALUE, &node, sizeof(node),
+				     STARPU_R, data_handlesx0, STARPU_R, data_handlesx1, STARPU_EXECUTE_ON_NODE, node,
+				     0);
+        assert(err == 0);
+
         /* Here the value specified by the property STARPU_EXECUTE_ON_NODE is
            going to overwrite the node even though the data model clearly specifies
            which node is going to execute the codelet */