Browse Source

MPI Stats: take the data real size into accounts and add some debug messages

Nathalie Furmento 13 years ago
parent
commit
bbdea9b732
3 changed files with 13 additions and 8 deletions
  1. 1 4
      mpi/starpu_mpi.c
  2. 11 3
      mpi/starpu_mpi_stats.c
  3. 1 1
      mpi/starpu_mpi_stats.h

+ 1 - 4
mpi/starpu_mpi.c

@@ -64,10 +64,7 @@ static void starpu_mpi_isend_func(struct _starpu_mpi_req *req)
 
 	starpu_mpi_handle_to_datatype(req->data_handle, &req->datatype);
 
-#ifdef STARPU_DEVEL
-#  warning give the real size of the data
-#endif
-	_starpu_mpi_comm_amounts_inc(req->comm, req->srcdst, 1);//req->data_handle, req->mpi_tag);
+	_starpu_mpi_comm_amounts_inc(req->comm, req->srcdst, req->datatype);
 
         req->ret = MPI_Isend(ptr, 1, req->datatype, req->srcdst, req->mpi_tag, req->comm, &req->request);
         STARPU_ASSERT(req->ret == MPI_SUCCESS);

+ 11 - 3
mpi/starpu_mpi_stats.c

@@ -17,6 +17,8 @@
 #include <starpu_mpi_stats.h>
 #include <common/config.h>
 #include <stdio.h>
+//#define STARPU_MPI_VERBOSE	1
+#include <starpu_mpi_private.h>
 
 /* measure the amount of data transfers between each pair of MPI nodes */
 #ifdef STARPU_COMM_STATS
@@ -30,6 +32,7 @@ void _starpu_mpi_comm_amounts_init()
 	int i;
 
 	MPI_Comm_size(MPI_COMM_WORLD, &world_size);
+	_STARPU_MPI_DEBUG("allocating for %d nodes\n", world_size);
 
 	comm_amount = (size_t **) calloc(1, world_size * sizeof(size_t *));
 	for(i=0 ; i<world_size ; i++)
@@ -51,12 +54,17 @@ void _starpu_mpi_comm_amounts_free()
 #endif /* STARPU_COMM_STATS */
 }
 
-void _starpu_mpi_comm_amounts_inc(MPI_Comm comm  __attribute__ ((unused)),
-				  unsigned dst  __attribute__ ((unused)), size_t size  __attribute__ ((unused)))
+void _starpu_mpi_comm_amounts_inc(MPI_Comm comm  __attribute__ ((unused)), 
+				  unsigned dst  __attribute__ ((unused)), MPI_Datatype datatype  __attribute__ ((unused)))
 {
 #ifdef STARPU_COMM_STATS
-	int src;
+	int src, size;
+
 	MPI_Comm_rank(comm, &src);
+	MPI_Type_size(datatype, &size);
+
+	_STARPU_MPI_DEBUG("adding %d from %d to %d\n", size, src, dst);
+
 	comm_amount[src][dst] += size;
 #endif /* STARPU_COMM_STATS */
 }

+ 1 - 1
mpi/starpu_mpi_stats.h

@@ -19,6 +19,6 @@
 
 void _starpu_mpi_comm_amounts_init();
 void _starpu_mpi_comm_amounts_free();
-void _starpu_mpi_comm_amounts_inc(MPI_Comm comm, unsigned dst, size_t size);
+void _starpu_mpi_comm_amounts_inc(MPI_Comm comm, unsigned dst, MPI_Datatype datatype);
 void _starpu_mpi_comm_amounts_display();