Przeglądaj źródła

mpi/tests: minor fixes

Nathalie Furmento 10 lat temu
rodzic
commit
be115fb0e0

+ 1 - 1
mpi/tests/insert_task.c

@@ -40,7 +40,7 @@ struct starpu_codelet mycodelet =
 /* Returns the MPI node number where data indexes index is */
 int my_distrib(int x, int y, int nb_nodes)
 {
-	return x % nb_nodes;
+	return (x + y) % nb_nodes;
 }
 
 

+ 1 - 1
mpi/tests/insert_task_block.c

@@ -57,7 +57,7 @@ struct starpu_codelet mycodelet =
 /* Returns the MPI node number where data indexes index is */
 int my_distrib(int x, int y, int nb_nodes)
 {
-	return x % nb_nodes;
+	return (x + y) % nb_nodes;
 }
 
 

+ 5 - 3
mpi/tests/insert_task_recv_cache.c

@@ -47,7 +47,7 @@ int my_distrib(int x)
 	return x;
 }
 
-void test_cache(int rank, int size, char *enabled, size_t *comm_amount)
+void test_cache(int rank, char *enabled, size_t *comm_amount)
 {
 	int i;
 	int ret;
@@ -124,8 +124,8 @@ int main(int argc, char **argv)
 	comm_amount_with_cache = malloc(size * sizeof(size_t));
 	comm_amount_without_cache = malloc(size * sizeof(size_t));
 
-	test_cache(rank, size, "0", comm_amount_with_cache);
-	test_cache(rank, size, "1", comm_amount_without_cache);
+	test_cache(rank, "0", comm_amount_with_cache);
+	test_cache(rank, "1", comm_amount_without_cache);
 
 	if (rank == 1)
 	{
@@ -133,7 +133,9 @@ int main(int argc, char **argv)
 		FPRINTF_MPI("Communication cache mechanism is %sworking (with cache: %ld) (without cache: %ld)\n", result?"":"NOT ", comm_amount_with_cache[0], comm_amount_without_cache[0]);
 	}
 	else
+	{
 		result = 1;
+	}
 
 	free(comm_amount_without_cache);
 	free(comm_amount_with_cache);

+ 5 - 3
mpi/tests/insert_task_sent_cache.c

@@ -47,7 +47,7 @@ int my_distrib(int x)
 	return x;
 }
 
-void test_cache(int rank, int size, char *enabled, size_t *comm_amount)
+void test_cache(int rank, char *enabled, size_t *comm_amount)
 {
 	int i;
 	int ret;
@@ -129,8 +129,8 @@ int main(int argc, char **argv)
 	comm_amount_with_cache = malloc(size * sizeof(size_t));
 	comm_amount_without_cache = malloc(size * sizeof(size_t));
 
-	test_cache(rank, size, "0", comm_amount_with_cache);
-	test_cache(rank, size, "1", comm_amount_without_cache);
+	test_cache(rank, "0", comm_amount_with_cache);
+	test_cache(rank, "1", comm_amount_without_cache);
 
 	if (rank == 0 || rank == 1)
 	{
@@ -139,7 +139,9 @@ int main(int argc, char **argv)
 		FPRINTF_MPI("Communication cache mechanism is %sworking\n", result?"":"NOT ");
 	}
 	else
+	{
 		result = 1;
+	}
 
 	free(comm_amount_without_cache);
 	free(comm_amount_with_cache);

+ 5 - 2
mpi/tests/user_defined_datatype_value.h

@@ -1,6 +1,6 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
- * Copyright (C) 2013  Centre National de la Recherche Scientifique
+ * Copyright (C) 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
@@ -40,7 +40,10 @@ static void value_register_data_handle(starpu_data_handle_t handle, unsigned hom
 		struct starpu_value_interface *local_interface = (struct starpu_value_interface *)
 			starpu_data_get_interface_on_node(handle, node);
 
-		local_interface->value = value_interface->value;
+		if (node == home_node)
+			local_interface->value = value_interface->value;
+		else
+			local_interface->value = 0;
 	}
 }