X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/201d2071f448214f15c7eddf1c431f5e8ea65869..5b3677b425b9cc6949c1573d59ac772540cbf4b2:/examples/smpi/MM/2.5D_MM.c diff --git a/examples/smpi/MM/2.5D_MM.c b/examples/smpi/MM/2.5D_MM.c index 3edf8c3d96..041342e8a0 100644 --- a/examples/smpi/MM/2.5D_MM.c +++ b/examples/smpi/MM/2.5D_MM.c @@ -1,14 +1,19 @@ +/* Copyright (c) 2012-2014. The SimGrid Team. + * All rights reserved. */ + +/* This program is free software; you can redistribute it and/or modify it + * under the terms of the license (GNU LGPL) which comes with this package. */ + /*! * 2.5D Block Matrix Multiplication example * - * Authors: Quintin Jean-Noël */ #include "Matrix_init.h" #include "Summa.h" #include "2.5D_MM.h" -#include "timer.h" #include +#include #include "xbt/log.h" #define CHECK_25D 1 @@ -31,9 +36,9 @@ double two_dot_five( double time, communication_time = 0; - struct timespec start_time, end_time; //time mesure - struct timespec end_time_intern; //time mesure - struct timespec start_time_reduce, end_time_reduce; //time mesure + double start_time, end_time; //time mesure + double end_time_intern; //time mesure + double start_time_reduce, end_time_reduce; //time mesure MPI_Comm my_world; @@ -182,7 +187,7 @@ double two_dot_five( MPI_Barrier(my_world); - get_time(&start_time); + start_time = MPI_Wtime(); if( NB_groups > 1 ) { err = MPI_Bcast(a, m*k_a, MPI_DOUBLE, 0, group_line); if (err != MPI_SUCCESS) { @@ -196,8 +201,8 @@ double two_dot_five( } MPI_Barrier(my_world); } - get_time(&end_time_intern); - communication_time += get_timediff(&start_time,&end_time_intern); + end_time_intern = MPI_Wtime(); + communication_time += end_time_intern - start_time; XBT_INFO( "group %zu NB_block: %zu, NB_groups %zu\n" ,group,NB_Block, NB_groups); @@ -221,7 +226,7 @@ double two_dot_five( MPI_Comm_rank(group_line, &myrank); MPI_Barrier(my_world); - get_time(&start_time_reduce); + start_time_reduce = MPI_Wtime(); if( NB_groups > 1 ) { // a gather is better? err = MPI_Reduce(c, res, m*n, MPI_DOUBLE, MPI_SUM, 0, group_line); @@ -235,14 +240,14 @@ double two_dot_five( res=swap; } MPI_Barrier(my_world); - get_time(&end_time_reduce); + end_time_reduce = MPI_Wtime(); MPI_Barrier(my_world); - get_time(&end_time); - time = get_timediff(&start_time,&end_time); - double reduce_time = get_timediff(&start_time_reduce,&end_time_reduce); - printf("communication time: %le reduce time: %le nanoseconds, " - "total time: %le nanoseconds\n",communication_time,reduce_time,time); + end_time = MPI_Wtime(); + time = end_time - start_time; + double reduce_time = end_time_reduce - start_time_reduce; + printf("communication time: %e reduce time: %e seconds, " + "total time: %e seconds\n",communication_time,reduce_time,time); MPI_Barrier(my_world); #if CHECK_25D