The purpose of these scripts is to automate testing and provide an easy way to define new tests.
The tests are defined in JSON files, they are parsed by a Python script which then executes the applications with different configurations, generates plots, and does postprocessing on the output data.
There are two types of test:
- Benchmarks: They record the time taken by different parts of the simulation, like the time spent simulating EM and Hadronic physics.
- Validations: They record the energy deposition in sensitive volumes.
The data provided by each type of test depends on the specific implementation in the application we are testing.
The only requirement to be able to run these tests is to compile AdePT with the cmake option TEST=ON
Scripts used to run the tests.
These scripts take JSON files containing test configurations as input and perform the specified runs.
A basic test has three components:
- Runs: A list of the runs to be executed. Each run contains the full configuration for the Geant4 macro file.
- Postprocessing scripts: A list of postprocessing scripts applied to the output from the runs.
- Plotting scripts: A list of plotting scripts applied to the output from the runs.
Scripts used for postprocessing of the output from the runs.
These scripts should take:
- An Output file for the results
- A list of optional arguments
- A list of input files
Scripts used for plotting the output from the runs.
These scripts should take:
- An Output file for the plot
- A label for the X axis
- A label for the Y axis
- A list of input files
Geant4 macro templates to be used in the tests. The substitution is done using the string.Template.substitute
Python3 method:
https://docs.python.org/3/library/string.html#string.Template.substitute
In order to implement a template:
- Every parameter that needs to be changed dynamically should be defined with the syntax
$variable
- In the JSON configuration file, the "configuration" section for each run needs to include all the variables defined in the template
In order to run a test using the script:
python3 run_test.py configuration_file
It will run all the tests defined in the configuration file, and run the scripts configured for plotting and postprocessing of the results.
The raw data from the tests will be saved in the specified directories, in order to generate only the plots if we already have the data:
python3 make_plots.py configuration_file
In order to run only the postprocessing;
python3 run_postprocessing.py configuration_file
In order to run a benchmark with a basic configuration:
python3 run_scripts/run_test.py test_configurations/benchmark_basic.json
Configuration files must be in JSON format.
Usage example: