瀏覽代碼

mpi/examples/cholesky: timing and flops information are no longer displayed by function dw_cholesky() but returned to caller, which can then decide to reset them on calculation error

Nathalie Furmento 12 年之前
父節點
當前提交
5558692068

+ 10 - 1
mpi/examples/cholesky/mpi_cholesky.c

@@ -110,7 +110,8 @@ int main(int argc, char **argv)
 		}
 	}
 
-	dw_cholesky(bmat, size, size/nblocks, nblocks, rank, nodes);
+	double timing, flops;
+	dw_cholesky(bmat, size, size/nblocks, nblocks, rank, nodes, &timing, &flops);
 
 	starpu_mpi_shutdown();
 
@@ -213,6 +214,7 @@ int main(int argc, char **argv)
 							{
 								fprintf(stderr, "[%d] Error[%u, %u] --> %2.2f != %2.2f (err %2.2f)\n", rank, i, j, test_mat[j +i*size], orig, err);
 								correctness = 0;
+								flops = 0;
 								break;
 							}
 						}
@@ -238,5 +240,12 @@ int main(int argc, char **argv)
 	starpu_shutdown();
 
 	assert(correctness);
+
+	if (rank == 0)
+	{
+		fprintf(stdout, "Computation time (in ms): %2.2f\n", timing/1000);
+		fprintf(stdout, "Synthetic GFlops : %2.2f\n", (flops/timing/1000.0f));
+	}
+
 	return 0;
 }

+ 1 - 1
mpi/examples/cholesky/mpi_cholesky_codelets.c

@@ -66,7 +66,7 @@ extern int my_distrib(int x, int y, int nb_nodes);
  *	code to bootstrap the factorization
  *	and construct the DAG
  */
-void dw_cholesky(float ***matA, unsigned size, unsigned ld, unsigned nblocks, int rank, int nodes)
+void dw_cholesky(float ***matA, unsigned size, unsigned ld, unsigned nblocks, int rank, int nodes, double *timing, double *flops)
 {
 	struct timeval start;
 	struct timeval end;

+ 1 - 1
mpi/examples/cholesky/mpi_cholesky_codelets.h

@@ -22,6 +22,6 @@
  *	code to bootstrap the factorization
  *	and construct the DAG
  */
-void dw_cholesky(float ***matA, unsigned size, unsigned ld, unsigned nblocks, int rank, int nodes);
+void dw_cholesky(float ***matA, unsigned size, unsigned ld, unsigned nblocks, int rank, int nodes, double *timing, double *flops);
 
 #endif /* __MPI_CHOLESKY_CODELETS_H__ */

+ 9 - 1
mpi/examples/cholesky/mpi_cholesky_distributed.c

@@ -84,10 +84,18 @@ int main(int argc, char **argv)
 		}
 	}
 
-	dw_cholesky(bmat, size, size/nblocks, nblocks, rank, nodes);
+	double timing, flops;
+	dw_cholesky(bmat, size, size/nblocks, nblocks, rank, nodes, &timing, &flops);
 
 	starpu_mpi_shutdown();
 
+	if (rank == 0)
+	{
+		fprintf(stdout, "Computation time (in ms): %2.2f\n", timing/1000);
+		fprintf(stdout, "Synthetic GFlops : %2.2f\n", (flops/timing/1000.0f));
+	}
+
+
 	for(x=0 ; x<nblocks ; x++)
 	{
 		for(y=0 ; y<nblocks ; y++)