ソースを参照

mpi: check function return values and free memory

Nathalie Furmento 9 年 前
コミット
8ba08c8dfc
共有4 個のファイルを変更した9 個の追加8 個の削除を含む
  1. 3 2
      mpi/examples/mpi_lu/plu_example.c
  2. 3 1
      mpi/examples/mpi_lu/plu_solve.c
  3. 2 1
      mpi/examples/stencil/stencil5.c
  4. 1 4
      mpi/tests/mpi_reduction.c

+ 3 - 2
mpi/examples/mpi_lu/plu_example.c

@@ -1,7 +1,7 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
  * Copyright (C) 2010-2011, 2013, 2015  Université de Bordeaux
- * Copyright (C) 2010, 2011, 2012, 2013  CNRS
+ * Copyright (C) 2010, 2011, 2012, 2013, 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
@@ -432,7 +432,8 @@ int main(int argc, char **argv)
 	/* We disable sequential consistency in this example */
 	starpu_data_set_default_sequential_consistency_flag(0);
 
-	starpu_mpi_init(NULL, NULL, 0);
+	ret = starpu_mpi_init(NULL, NULL, 0);
+	STARPU_CHECK_RETURN_VALUE(ret, "starpu_mpi_init");
 
 	STARPU_ASSERT(p*q == world_size);
 

+ 3 - 1
mpi/examples/mpi_lu/plu_solve.c

@@ -1,7 +1,7 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
  * Copyright (C) 2010, 2014  Université de Bordeaux
- * Copyright (C) 2010  CNRS
+ * Copyright (C) 2010, 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
@@ -390,4 +390,6 @@ void STARPU_PLU(compute_lu_matrix)(unsigned size, unsigned nblocks, TYPE *Asaved
 
 		fprintf(stderr, "||A-LU|| / (||A||*N) : %e\n", residual/(matnorm*size));
 	}
+
+	free(all_r);
 }

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

@@ -96,7 +96,8 @@ int main(int argc, char **argv)
 
 	int ret = starpu_init(NULL);
 	STARPU_CHECK_RETURN_VALUE(ret, "starpu_init");
-	starpu_mpi_init(&argc, &argv, 1);
+	ret = starpu_mpi_init(&argc, &argv, 1);
+	STARPU_CHECK_RETURN_VALUE(ret, "starpu_mpi_init");
 	starpu_mpi_comm_rank(MPI_COMM_WORLD, &my_rank);
 	starpu_mpi_comm_size(MPI_COMM_WORLD, &size);
 

+ 1 - 4
mpi/tests/mpi_reduction.c

@@ -191,10 +191,7 @@ int main(int argc, char **argv)
 	{
 		if (handles[x]) starpu_data_unregister(handles[x]);
 	}
-	if (dot_handle)
-	{
-		starpu_data_unregister(dot_handle);
-	}
+	starpu_data_unregister(dot_handle);
 	free(vector);
 	free(handles);