X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/01cfa7276bea34f747662c55a1ce2f2f7d38c1c6..aac4ba41ea27fe8168bebed009abebd7e5c3f006:/teshsuite/smpi/mpich3-test/perf/allredtrace.c?ds=sidebyside diff --git a/teshsuite/smpi/mpich3-test/perf/allredtrace.c b/teshsuite/smpi/mpich3-test/perf/allredtrace.c index 070271be19..8fb077bfbf 100644 --- a/teshsuite/smpi/mpich3-test/perf/allredtrace.c +++ b/teshsuite/smpi/mpich3-test/perf/allredtrace.c @@ -5,13 +5,13 @@ */ /* - * This code is intended to test the trace overhead when using an + * This code is intended to test the trace overhead when using an * MPI tracing package. To perform the test, follow these steps: * * 1) Run with the versbose mode selected to determine the delay argument * to use in subsequent tests: * mpiexec -n 4096 allredtrace -v - * Assume that the computed delay count is 6237; that value is used in + * Assume that the computed delay count is 6237; that value is used in * the following. * * 2) Run with an explicit delay count, without tracing enabled: @@ -20,7 +20,7 @@ * 3) Build allredtrace with tracing enabled, then run: * mpiexec -n 4096 allredtrace -delaycount 6237 * - * Compare the total times. The tracing version should take slightly + * Compare the total times. The tracing version should take slightly * longer but no more than, for example, 15%. */ #include "mpi.h" @@ -30,126 +30,132 @@ static int verbose = 0; static int lCount = 0; -void Delay( int ); -void SetupDelay( double ); +void Delay(int); +void SetupDelay(double); -int main( int argc, char *argv[] ) +int main(int argc, char *argv[]) { double usecPerCall = 100; double t, t1, tsum; int i, nLoop = 100; int rank; - MPI_Init( &argc, &argv ); - MPI_Comm_rank( MPI_COMM_WORLD, &rank ); - - /* Process arguments. We allow the delay count to be set from the - command line to ensure reproducibility*/ - for (i=1; i 10 * tick) nLoop = nLoop / 2; - - /* Compare measured delay */ - if (t > 2*sec) { - lCount = lCount / 2; - if (direction == 1) break; - direction = -1; - } - else if (t < sec / 2) { - lCount = lCount * 2; - if (direction == -1) break; - direction = 1; - } - else if (t < sec) { - /* sec/2 <= t < sec , so estimate the lCount to hit sec */ - lCount = (sec/t) * lCount; - } - else - break; + t = MPI_Wtime(); + for (i = 0; i < nLoop; i++) { + Delay(lCount); + } + t = MPI_Wtime() - t; + t = t / nLoop; + if (verbose) + printf("lCount = %d, time = %e\n", lCount, t); + if (t > 10 * tick) + nLoop = nLoop / 2; + + /* Compare measured delay */ + if (t > 2 * sec) { + lCount = lCount / 2; + if (direction == 1) + break; + direction = -1; + } + else if (t < sec / 2) { + lCount = lCount * 2; + if (direction == -1) + break; + direction = 1; + } + else if (t < sec) { + /* sec/2 <= t < sec , so estimate the lCount to hit sec */ + lCount = (sec / t) * lCount; + } + else + break; } - if (verbose) printf( "lCount = %d, t = %e\n", lCount, t ); + if (verbose) + printf("lCount = %d, t = %e\n", lCount, t); /* Should coordinate with the other processes - take the max? */ } -double delayCounter = 0; -void Delay( int count ) +volatile double delayCounter = 0; +void Delay(int count) { int i; delayCounter = 0.0; - for (i=0; i