Przeglądaj źródła

mpi/tests/mpi_reduction_kernels.c: use already defined fprintf macro

Nathalie Furmento 12 lat temu
rodzic
commit
b141c2be3a
1 zmienionych plików z 7 dodań i 10 usunięć
  1. 7 10
      mpi/tests/mpi_reduction_kernels.c

+ 7 - 10
mpi/tests/mpi_reduction_kernels.c

@@ -17,10 +17,7 @@
 #include <starpu.h>
 #include <mpi.h>
 
-#define _DISPLAY(fmt, ...) do { \
-		int _display_rank; MPI_Comm_rank(MPI_COMM_WORLD, &_display_rank);	\
-		fprintf(stderr, "[%d][%s] " fmt , _display_rank, __starpu_func__ ,## __VA_ARGS__); 	\
-		fflush(stderr); } while(0)
+#include "helper.h"
 
 /*
  *	Codelet to create a neutral element
@@ -29,7 +26,7 @@ void init_cpu_func(void *descr[], void *cl_arg)
 {
 	long int *dot = (long int *)STARPU_VARIABLE_GET_PTR(descr[0]);
 	*dot = 0;
-	_DISPLAY("Init dot\n");
+	FPRINTF_MPI("Init dot\n");
 }
 
 /*
@@ -41,7 +38,7 @@ void redux_cpu_func(void *descr[], void *cl_arg)
 	long int *dotb = (long int *)STARPU_VARIABLE_GET_PTR(descr[1]);
 
 	*dota = *dota + *dotb;
-	_DISPLAY("Calling redux %ld=%ld+%ld\n", *dota, *dota-*dotb, *dotb);
+	FPRINTF_MPI("Calling redux %ld=%ld+%ld\n", *dota, *dota-*dotb, *dotb);
 }
 
 /*
@@ -54,14 +51,14 @@ void dot_cpu_func(void *descr[], void *cl_arg)
 
 	long int *dot = (long int *)STARPU_VARIABLE_GET_PTR(descr[1]);
 
-//	_DISPLAY("Before dot=%ld (adding %d elements...)\n", *dot, n);
+	FPRINTF_MPI("Before dot=%ld (adding %d elements...)\n", *dot, n);
 	unsigned i;
 	for (i = 0; i < n; i++)
 	{
-//		_DISPLAY("Adding %ld\n", local_x[i]);
+		FPRINTF_MPI("Adding %ld\n", local_x[i]);
 		*dot += local_x[i];
 	}
-//	_DISPLAY("After dot=%ld\n", *dot);
+	FPRINTF_MPI("After dot=%ld\n", *dot);
 }
 
 /*
@@ -71,6 +68,6 @@ void display_cpu_func(void *descr[], void *cl_arg)
 {
 	long int *local_x = (long int *)STARPU_VECTOR_GET_PTR(descr[0]);
 
-	_DISPLAY("Local=%ld\n", *local_x);
+	FPRINTF_MPI("Local=%ld\n", *local_x);
 }