Skip to content

Commit

Permalink
Merge pull request #71 from mkstoyanov/allow_faster_benchmark
Browse files Browse the repository at this point in the history
* allow the benchmarks to run with only setup and a single forward-backward sweep (default is still 5)
* prints statistics about the test even when an error in the residual is encountered
  • Loading branch information
mkstoyanov authored Dec 10, 2024
2 parents 6c3eb43 + e2fe75f commit c61c772
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 13 deletions.
24 changes: 12 additions & 12 deletions benchmarks/speed3d.h
Original file line number Diff line number Diff line change
Expand Up @@ -213,17 +213,6 @@ void benchmark_fft(std::array<int,3> size_fft, std::deque<std::string> const &ar
precision_type mpi_max_err = 0.0;
MPI_Allreduce(&err, &mpi_max_err, 1, mpi::type_from<precision_type>(), MPI_MAX, fft_comm);

if (mpi_max_err > precision<std::complex<precision_type>>::tolerance){
// benchmark failed, the error is too much
if (me == 0){
cout << "------------------------------- \n"
<< "ERROR: observed error after heFFTe benchmark exceeds the tolerance\n"
<< " tolerance: " << precision<std::complex<precision_type>>::tolerance
<< " error: " << mpi_max_err << endl;
}
return;
}

// Print results
if(me==0){
t_max = t_max / (2.0 * ntest);
Expand All @@ -250,6 +239,17 @@ void benchmark_fft(std::array<int,3> size_fft, std::deque<std::string> const &ar
cout << "Max error: " << mpi_max_err << "\n";
cout << endl;
}

if (mpi_max_err > precision<std::complex<precision_type>>::tolerance){
// benchmark failed, the error is too much
if (me == 0){
cout << "------------------------------- \n"
<< "ERROR: observed error after heFFTe benchmark exceeds the tolerance\n"
<< " tolerance: " << precision<std::complex<precision_type>>::tolerance
<< " error: " << mpi_max_err << endl;
}
return;
}
}

template<typename backend_tag>
Expand Down Expand Up @@ -346,7 +346,7 @@ int main(int argc, char *argv[]){
<< " -batch batch_size: specifies the size of the batch to use in the benchmark\n"
<< " -r2c_dir dir: specifies the r2c direction for the r2c tests, dir must be 0 1 or 2 \n"
<< " -mps: for the cufft backend and multiple gpus, associate the mpi ranks with different cuda devices\n"
<< " -nX: number of times to repeat the run, accepted variants are -n5 (default), -n10, -n50\n"
<< " -nX: number of times to repeat the run, accepted variants are -n5 (default), -n1, -n10, -n50\n"
#ifdef BENCH_R2R
<< "Examples:\n"
<< " mpirun -np 4 " << bench_executable << " fftw-cos double 128 128 128 -p2p\n"
Expand Down
4 changes: 3 additions & 1 deletion test/test_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,9 @@ int get_int_arg(std::string const &name, std::deque<std::string> const &args, in

int nruns(std::deque<std::string> const &args){
for(auto &s : args)
if (s == "-n10")
if (s == "-n1")
return 1;
else if (s == "-n10")
return 10;
else if (s == "-n50")
return 50;
Expand Down

0 comments on commit c61c772

Please sign in to comment.