Skip to content

Commit

Permalink
Benchmarker: Optionally disable copying plotting script
Browse files Browse the repository at this point in the history
  • Loading branch information
nathanwbrei committed Nov 9, 2023
1 parent fbca64d commit 722a458
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 14 deletions.
12 changes: 6 additions & 6 deletions scripts/jana-plot-scaletest.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,15 @@
You can control several parameters of the test using these
JANA configuration parameters:
BENCHMARK:NSAMPLES # Number of samples for each benchmark test
BENCHMARK:MINTHREADS # Minimum number of threads for benchmark test
BENCHMARK:MAXTHREADS # Maximum number of threads for benchmark test
BENCHMARK:RESULTSDIR # Output directory name for benchmark test results
BENCHMARK:THREADSTEP # Delta number of threads between each benchmark test
benchmark:nsamples # Number of samples for each benchmark test
benchmark:minthreads # Minimum number of threads for benchmark test
benchmark:maxthreads # Maximum number of threads for benchmark test
benchmark:resultsdir # Output directory name for benchmark test results
benchmark:threadstep # Delta number of threads between each benchmark test
Run "jana -c -b" to see the default values for each of these.
To use this just go into the BENCHMARK:RESULTSDIR where the
To use this just go into the benchmark:resultsdir where the
rates.dat file is and run it. Note that you must have python
installed as well as the numpy and matplotlib python packages.
Expand Down
25 changes: 19 additions & 6 deletions src/libraries/JANA/CLI/JBenchmarker.cc
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@ JBenchmarker::JBenchmarker(JApplication* app) : m_app(app) {
m_output_dir,
"Output directory name for benchmark test results");

params->SetDefaultParameter(
"benchmark:copyscript",
m_copy_script,
"Copy plotting script to results dir");

params->SetParameter("nthreads", m_max_threads);
// Otherwise JApplication::Scale() doesn't scale up. This is an interesting bug. TODO: Remove me when fixed.
}
Expand All @@ -61,6 +66,7 @@ void JBenchmarker::RunUntilFinished() {
<< " benchmark:minthreads = " << m_min_threads << "\n"
<< " benchmark:maxthreads = " << m_max_threads << "\n"
<< " benchmark:threadstep = " << m_thread_step << "\n"
<< " benchmark:nsamples = " << m_nsamples << "\n"
<< " benchmark:resultsdir = " << m_output_dir << LOG_END;

m_app->SetTicker(false);
Expand Down Expand Up @@ -140,12 +146,19 @@ void JBenchmarker::RunUntilFinished() {
}
ofs2.close();

copy_to_output_dir("${JANA_HOME}/bin/jana-plot-scaletest.py");

LOG_INFO(m_logger)
<< "Testing finished. To view a plot of test results:\n"
<< " cd " << m_output_dir
<< "\n ./jana-plot-scaletest.py\n" << LOG_END;
if (m_copy_script) {
copy_to_output_dir("${JANA_HOME}/bin/jana-plot-scaletest.py");
LOG_INFO(m_logger)
<< "Testing finished. To view a plot of test results:\n"
<< " cd " << m_output_dir
<< "\n ./jana-plot-scaletest.py\n" << LOG_END;
}
else {
LOG_INFO(m_logger)
<< "Testing finished. To view a plot of test results:\n"
<< " cd " << m_output_dir << "\n"
<< " $JANA_HOME/bin/jana-plot-scaletest.py\n" << LOG_END;
}
m_app->Stop();
}

Expand Down
1 change: 1 addition & 0 deletions src/libraries/JANA/CLI/JBenchmarker.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ class JBenchmarker {
unsigned m_thread_step = 1;
unsigned m_nsamples = 15;
std::string m_output_dir = "JANA_Test_Results";
bool m_copy_script = true;

public:
explicit JBenchmarker(JApplication* app);
Expand Down
11 changes: 9 additions & 2 deletions src/programs/perf_tests/PerfTests.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

#include <JANA/JApplication.h>
#include <JANA/JFactoryGenerator.h>
#include <JANA/CLI/JBenchmarker.h>
#if HAVE_PODIO
#include <PodioStressTest.h>
#endif
Expand Down Expand Up @@ -51,12 +52,15 @@ int main() {
params->SetParameter("log:off", "JApplication,JPluginLoader,JArrowProcessingController,JArrow"); // Log levels get set as soon as JApp gets constructed XD
params->SetParameter("jtest:parser_ms", 2);

params->SetParameter("benchmark:resultsdir", "perftest_fake_halldrecon");

JApplication app(params);
auto logger = app.GetService<JLoggingService>()->get_logger("PerfTests");
app.AddPlugin("JTest");

LOG_INFO(logger) << "Running JTest tuned to imitate halld_recon:" << LOG_END;
benchmark(app);
JBenchmarker benchmarker(&app);
benchmarker.RunUntilFinished();
}


Expand Down Expand Up @@ -85,12 +89,15 @@ int main() {
params->SetParameter("jtest:plotter_bytes", 0);
params->SetParameter("jtest:plotter_bytes_spread", 0);

params->SetParameter("benchmark:resultsdir", "perftest_pure_overhead");

JApplication app(params);
auto logger = app.GetService<JLoggingService>()->get_logger("PerfTests");
app.AddPlugin("JTest");

LOG_INFO(logger) << "Running JTest with all sleeps and computations turned off" << LOG_END;
benchmark(app);
JBenchmarker benchmarker(&app);
benchmarker.RunUntilFinished();
}

#if HAVE_PODIO
Expand Down

0 comments on commit 722a458

Please sign in to comment.