-/* Copyright (c) 2009-2019. The SimGrid Team.
+/* Copyright (c) 2009-2021. The SimGrid Team.
* All rights reserved. */
/* This program is free software; you can redistribute it and/or modify it
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
double d = 2.0;
/* I want no more than n + 1 benchs (thres < 0) */
- SMPI_SAMPLE_GLOBAL(int i = 0, i < 5, i++, n + 1, -1,
+ SMPI_SAMPLE_GLOBAL(int i = 0, i < 5, i++, n + 1, -1){
if (verbose)
fprintf(stderr, "(%12.6f) [rank:%d]", MPI_Wtime(), rank);
else
fprintf(stderr, " Run the first computation. It's globally benched, "
"and I want no more than %d benchmarks (thres<0)\n", n + 1);
d = compute(2.0);
- )
+ }
+
+ //tagged version, should differentiate between two different calls to the same kernel and run calibration even on the second one
+ for (int tag=0; tag < 4; tag++){
+ char ctag [8];
+ //run twice with the same tag, test should skip 1 and 3, as they were already benched.
+ sprintf(ctag, "%d", tag - tag%2);
+ SMPI_SAMPLE_GLOBAL_TAG(int i = 0, i < 500, i++, 2, 0.1, ctag){
+ if (verbose)
+ fprintf(stderr, "(%12.6f) [rank:%d]", MPI_Wtime(), rank);
+ else
+ fprintf(stderr, "(0)");
+ fprintf(stderr, " Run the computation %d with tag %d\n", tag, tag- tag%2);
+ d = compute(2.0);
+ }
+ }
n = 0;
- SMPI_SAMPLE_LOCAL (int i = 0, i < 5, i++,0, 0.1,
+ //Use 0 as max iter, but one will always be performed by design.
+ SMPI_SAMPLE_LOCAL (int i = 0, i < 5, i++,0, 0.1){
if (verbose || n < 2) {
n++;
if (verbose)
"standard error to go below 0.1 second (count is not >0)\n", rank);
}
d = compute(d);
- )
+ }
if (verbose)
fprintf(stderr, "(%12.6f) [rank:%d] The result of the computation is: %f\n", MPI_Wtime(), rank, d);