Browse Source

Merge branch 'master' of git+ssh://scm.gforge.inria.fr/gitroot/starpu/starpu

Samuel Thibault 5 years ago
parent
commit
7fa01f1624
4 changed files with 9 additions and 33 deletions
  1. 0 6
      mpi/tests/burst.c
  2. 1 10
      mpi/tests/burst_gemm.c
  3. 7 16
      mpi/tests/burst_helper.c
  4. 1 1
      mpi/tests/burst_helper.h

+ 0 - 6
mpi/tests/burst.c

@@ -24,7 +24,6 @@
 #include "helper.h"
 #include "burst_helper.h"
 
-
 void parse_args(int argc, char **argv)
 {
 	int i;
@@ -34,14 +33,12 @@ void parse_args(int argc, char **argv)
 		{
 			burst_nb_requests = atoi(argv[++i]);
 		}
-
 		else if (strcmp(argv[i], "-help") == 0 || strcmp(argv[i], "--help") == 0 || strcmp(argv[i], "-h") == 0)
 		{
 			fprintf(stderr,"Usage: %s [-nreqs nreqs]\n", argv[0]);
 			fprintf(stderr,"Currently selected: %d requests in each burst\n", burst_nb_requests);
 			exit(EXIT_SUCCESS);
 		}
-
 		else
 		{
 			fprintf(stderr,"Unrecognized option %s\n", argv[i]);
@@ -50,7 +47,6 @@ void parse_args(int argc, char **argv)
 	}
 }
 
-
 int main(int argc, char **argv)
 {
 	int ret, rank, mpi_init, other_rank;
@@ -66,10 +62,8 @@ int main(int argc, char **argv)
 
 	burst_init_data(rank);
 
-
 	burst_all(rank);
 
-
 	/* Clear up */
 	burst_free_data(rank);
 

+ 1 - 10
mpi/tests/burst_gemm.c

@@ -29,7 +29,6 @@
 #include "gemm_helper.h"
 #include "burst_helper.h"
 
-
 void parse_args(int argc, char **argv)
 {
 	int i;
@@ -41,7 +40,6 @@ void parse_args(int argc, char **argv)
 			nslices = strtol(argv[++i], &argptr, 10);
 			matrix_dim = 320 * nslices;
 		}
-
 		else if (strcmp(argv[i], "-size") == 0)
 		{
 			char *argptr;
@@ -56,24 +54,20 @@ void parse_args(int argc, char **argv)
 				nslices = matrix_dim / 320;
 			}
 		}
-
 		else if (strcmp(argv[i], "-check") == 0)
 		{
 			check = 1;
 		}
-
 		else if (strcmp(argv[i], "-nreqs") == 0)
 		{
 			burst_nb_requests = atoi(argv[++i]);
 		}
-
 		else if (strcmp(argv[i], "-help") == 0 || strcmp(argv[i], "--help") == 0 || strcmp(argv[i], "-h") == 0)
 		{
 			fprintf(stderr,"Usage: %s [-nblocks n] [-size size] [-check] [-nreqs nreqs]\n", argv[0]);
 			fprintf(stderr,"Currently selected: matrix size: %u - %u blocks - %d requests in each burst\n", matrix_dim, nslices, burst_nb_requests);
 			exit(EXIT_SUCCESS);
 		}
-
 		else
 		{
 			fprintf(stderr,"Unrecognized option %s\n", argv[i]);
@@ -82,7 +76,6 @@ void parse_args(int argc, char **argv)
 	}
 }
 
-
 int main(int argc, char **argv)
 {
 	int ret, mpi_init, worldsize, mpi_rank;
@@ -110,7 +103,7 @@ int main(int argc, char **argv)
 	}
 
 	gemm_alloc_data();
-	if(gemm_init_data() == -ENODEV)
+	if (gemm_init_data() == -ENODEV)
 		goto enodev;
 
 	burst_init_data(mpi_rank);
@@ -145,12 +138,10 @@ int main(int argc, char **argv)
 
 	FPRINTF(stderr, "Burst done, now waiting for computing tasks to finish\n");
 
-
 	/* Wait for everything and everybody: */
 	starpu_task_wait_for_all();
 	starpu_mpi_barrier(MPI_COMM_WORLD);
 
-
 enodev:
 	gemm_release();
 	burst_free_data(mpi_rank);

+ 7 - 16
mpi/tests/burst_helper.c

@@ -25,7 +25,6 @@
 #endif
 #define NX_ARRAY (320 * 320)
 
-
 static starpu_data_handle_t* recv_handles;
 static starpu_data_handle_t* send_handles;
 static float** recv_buffers;
@@ -59,7 +58,6 @@ void burst_init_data(int rank)
 	}
 }
 
-
 void burst_free_data(int rank)
 {
 	if (rank == 0 || rank == 1)
@@ -82,7 +80,6 @@ void burst_free_data(int rank)
 	}
 }
 
-
 /* Burst simultaneous from both nodes: 0 and 1 post all the recvs, synchronise, and then post all the sends */
 void burst_bidir(int rank)
 {
@@ -120,20 +117,16 @@ void burst_bidir(int rank)
 	starpu_mpi_barrier(MPI_COMM_WORLD);
 }
 
-
-void burst_unidir(int sender, int rank)
+void burst_unidir(int sender, int receiver, int rank)
 {
-	int other_rank = (rank == 0) ? 1 : 0;
-	int receiver = (sender == 0) ? 1 : 0;
-
 	FPRINTF(stderr, "%d -> %d... start (rank %d)\n", sender, receiver, rank);
 
-	if (rank != sender)
+	if (rank == receiver)
 	{
 		for (int i = 0; i < burst_nb_requests; i++)
 		{
 			recv_reqs[i] = NULL;
-			starpu_mpi_irecv(recv_handles[i], &recv_reqs[i], other_rank, i, MPI_COMM_WORLD);
+			starpu_mpi_irecv(recv_handles[i], &recv_reqs[i], sender, i, MPI_COMM_WORLD);
 		}
 	}
 
@@ -144,11 +137,11 @@ void burst_unidir(int sender, int rank)
 		for (int i = 0; i < burst_nb_requests; i++)
 		{
 			send_reqs[i] = NULL;
-			starpu_mpi_isend_prio(send_handles[i], &send_reqs[i], other_rank, i, i, MPI_COMM_WORLD);
+			starpu_mpi_isend_prio(send_handles[i], &send_reqs[i], receiver, i, i, MPI_COMM_WORLD);
 		}
 	}
 
-	if (rank == 0 || rank == 1)
+	if (rank == sender || rank == receiver)
 	{
 		for (int i = 0; i < burst_nb_requests; i++)
 		{
@@ -162,7 +155,6 @@ void burst_unidir(int sender, int rank)
 	starpu_mpi_barrier(MPI_COMM_WORLD);
 }
 
-
 /* Half burst from both nodes, second half burst is triggered after some requests finished. */
 void burst_bidir_half_postponed(int rank)
 {
@@ -209,7 +201,6 @@ void burst_bidir_half_postponed(int rank)
 	starpu_mpi_barrier(MPI_COMM_WORLD);
 }
 
-
 void burst_all(int rank)
 {
 	double start, end;
@@ -219,10 +210,10 @@ void burst_all(int rank)
 	burst_bidir(rank);
 
 	/* Burst from 0 to 1 : rank 1 posts all the recvs, barrier, then rank 0 posts all the sends */
-	burst_unidir(0, rank);
+	burst_unidir(0, 1, rank);
 
 	/* Burst from 1 to 0 : rank 0 posts all the recvs, barrier, then rank 1 posts all the sends */
-	burst_unidir(1, rank);
+	burst_unidir(1, 0, rank);
 
 	/* Half burst from both nodes, second half burst is triggered after some requests finished. */
 	burst_bidir_half_postponed(rank);

+ 1 - 1
mpi/tests/burst_helper.h

@@ -22,7 +22,7 @@ extern int burst_nb_requests;
 void burst_init_data(int rank);
 void burst_free_data(int rank);
 void burst_bidir(int rank);
-void burst_unidir(int sender, int rank);
+void burst_unidir(int sender, int receiver, int rank);
 void burst_bidir_half_postponed(int rank);
 void burst_all(int rank);