Преглед изворни кода

mpi: do not fail when needed workers are unavailable

Nathalie Furmento пре 9 година
родитељ
комит
999486a395
3 измењених фајлова са 25 додато и 9 уклоњено
  1. 9 1
      mpi/examples/stencil/stencil5.c
  2. 8 4
      mpi/tests/matrix2.c
  3. 8 4
      mpi/tests/policy_selection2.c

+ 9 - 1
mpi/examples/stencil/stencil5.c

@@ -1,7 +1,7 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
  * Copyright (C) 2011, 2013, 2015              Université Bordeaux
- * Copyright (C) 2011, 2012, 2013, 2014, 2015  CNRS
+ * Copyright (C) 2011, 2012, 2013, 2014, 2015, 2016  CNRS
  *
  * 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
@@ -100,6 +100,14 @@ int main(int argc, char **argv)
 	starpu_mpi_comm_rank(MPI_COMM_WORLD, &my_rank);
 	starpu_mpi_comm_size(MPI_COMM_WORLD, &size);
 
+	if (starpu_cpu_worker_get_count() == 0)
+	{
+		FPRINTF(stderr, "We need at least 1 CPU worker.\n");
+		starpu_mpi_shutdown();
+		starpu_shutdown();
+		return 77;
+	}
+
 	parse_args(argc, argv);
 
 	/* Initial data values */

+ 8 - 4
mpi/tests/matrix2.c

@@ -1,6 +1,6 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
- * Copyright (C) 2015  CNRS
+ * Copyright (C) 2015, 2016  CNRS
  *
  * 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
@@ -68,11 +68,15 @@ int main(int argc, char **argv)
 	ret = starpu_mpi_init(NULL, NULL, 0);
 	STARPU_CHECK_RETURN_VALUE(ret, "starpu_mpi_init");
 
-	if (size < 3)
+	if ((size < 3) || (starpu_cpu_worker_get_count() == 0))
 	{
 		if (rank == 0)
-			FPRINTF(stderr, "We need at least 3 processes.\n");
-
+		{
+			if (size < 3)
+				FPRINTF(stderr, "We need at least 3 processes.\n");
+			else
+				FPRINTF(stderr, "We need at least 1 CPU worker.\n");
+		}
 		starpu_mpi_shutdown();
 		starpu_shutdown();
 		MPI_Finalize();

+ 8 - 4
mpi/tests/policy_selection2.c

@@ -1,6 +1,6 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
- * Copyright (C) 2015  CNRS
+ * Copyright (C) 2015, 2016  CNRS
  *
  * 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
@@ -65,11 +65,15 @@ int main(int argc, char **argv)
 	ret = starpu_mpi_init(NULL, NULL, 0);
 	STARPU_CHECK_RETURN_VALUE(ret, "starpu_mpi_init");
 
-	if (size < 3)
+	if ((size < 3) || (starpu_cpu_worker_get_count() == 0))
 	{
 		if (rank == 0)
-			FPRINTF(stderr, "We need at least 3 processes.\n");
-
+		{
+			if (size < 3)
+				FPRINTF(stderr, "We need at least 3 processes.\n");
+			else
+				FPRINTF(stderr, "We need at least 1 CPU worker.\n");
+		}
 		starpu_mpi_shutdown();
 		starpu_shutdown();
 		MPI_Finalize();