Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
183 changes: 183 additions & 0 deletions .github/workflows/unit_tests.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,183 @@
name: Unit Tests
run-name: Unit tests for changes made by @${{ github.actor }}
on:
push:
branches:
- '**' # Triggers on push to any branch
pull_request:
types:
- opened # When a pull request is created
- synchronize # When commits are pushed to an existing PR
- reopened
jobs:
Unit-Test-Base:
runs-on: self-hosted
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Building AmpTools
run: |
mkdir Tutorials/Dalitz/lib
mkdir Tutorials/Dalitz/bin
make
export AMPTOOLS_HOME=$(pwd)
echo "AMPTOOLS_HOME=$AMPTOOLS_HOME" >> $GITHUB_ENV
echo "AMPTOOLS=$AMPTOOLS_HOME/AmpTools" >> $GITHUB_ENV
echo "AMPPLOTTER=$AMPTOOLS_HOME/AmpPlotter" >> $GITHUB_ENV
echo "DALITZ=$AMPTOOLS_HOME/Tutorials/Dalitz" >> $GITHUB_ENV
echo "UNIT_TESTS=$AMPTOOLS_HOME/UnitTests" >> $GITHUB_ENV
- name: ConfigFileParser
if: success() || failure()
run: |
cd $UNIT_TESTS
$DALITZ/bin/generatePhaseSpace phasespace.gen.root 100000 12345
$DALITZ/bin/toyAcceptance phasespace.gen.root phasespace.acc.root 12345
$DALITZ/bin/generatePhysics parserTest.cfg physics.gen.root 100000 12345
$DALITZ/bin/toyAcceptance physics.gen.root physics.acc.root 12345
$DALITZ/bin/fitAmplitudes parserTest.cfg
./parserTest
- name: ConfigurationInfo
if: success() || failure()
run: |
cd $UNIT_TESTS
./configurationInfoTest
- name: AmpToolsInterface
if: success() || failure()
run: |
cd $UNIT_TESTS
./AmpToolsInterfaceTest
- name: FitResults
if: success() || failure()
run: |
cd $UNIT_TESTS
./fitResultsTest base

Unit-Test-MPI:
runs-on: self-hosted
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Building AmpTools
run: |
mkdir Tutorials/Dalitz/lib
mkdir Tutorials/Dalitz/bin
make mpi
export AMPTOOLS_HOME=$(pwd)
echo "AMPTOOLS_HOME=$AMPTOOLS_HOME" >> $GITHUB_ENV
echo "AMPTOOLS=$AMPTOOLS_HOME/AmpTools" >> $GITHUB_ENV
echo "AMPPLOTTER=$AMPTOOLS_HOME/AmpPlotter" >> $GITHUB_ENV
echo "DALITZ=$AMPTOOLS_HOME/Tutorials/Dalitz" >> $GITHUB_ENV
echo "UNIT_TESTS=$AMPTOOLS_HOME/UnitTests" >> $GITHUB_ENV
- name: ConfigFileParser
if: success() || failure()
run: |
cd $UNIT_TESTS
$DALITZ/bin/generatePhaseSpace phasespace.gen.root 100000 12345
$DALITZ/bin/toyAcceptance phasespace.gen.root phasespace.acc.root 12345
$DALITZ/bin/generatePhysics parserTest.cfg physics.gen.root 100000 12345
$DALITZ/bin/toyAcceptance physics.gen.root physics.acc.root 12345
$DALITZ/bin/fitAmplitudes parserTest.cfg
./parserTest
- name: ConfigurationInfo
if: success() || failure()
run: |
cd $UNIT_TESTS
./configurationInfoTest
- name: AmpToolsInterface
if: success() || failure()
run: |
cd $UNIT_TESTS
mpirun -n 3 ./AmpToolsInterfaceTestMPI
- name: FitResults
if: success() || failure()
run: |
cd $UNIT_TESTS
mpirun -n 3 ./fitResultsTestMPI mpi

Unit-Test-GPU:
runs-on: self-hosted
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Building AmpTools
run: |
mkdir Tutorials/Dalitz/lib
mkdir Tutorials/Dalitz/bin
make gpu
export AMPTOOLS_HOME=$(pwd)
echo "AMPTOOLS_HOME=$AMPTOOLS_HOME" >> $GITHUB_ENV
echo "AMPTOOLS=$AMPTOOLS_HOME/AmpTools" >> $GITHUB_ENV
echo "AMPPLOTTER=$AMPTOOLS_HOME/AmpPlotter" >> $GITHUB_ENV
echo "DALITZ=$AMPTOOLS_HOME/Tutorials/Dalitz" >> $GITHUB_ENV
echo "UNIT_TESTS=$AMPTOOLS_HOME/UnitTests" >> $GITHUB_ENV
- name: ConfigFileParser
if: success() || failure()
run: |
cd $UNIT_TESTS
$DALITZ/bin/generatePhaseSpace_GPU phasespace.gen.root 100000 12345
$DALITZ/bin/toyAcceptance_GPU phasespace.gen.root phasespace.acc.root 12345
$DALITZ/bin/generatePhysics_GPU parserTest.cfg physics.gen.root 100000 12345
$DALITZ/bin/toyAcceptance_GPU physics.gen.root physics.acc.root 12345
$DALITZ/bin/fitAmplitudes_GPU parserTest.cfg
./parserTest_GPU
- name: ConfigurationInfo
if: success() || failure()
run: |
cd $UNIT_TESTS
./configurationInfoTest_GPU
- name: AmpToolsInterface
if: success() || failure()
run: |
cd $UNIT_TESTS
./AmpToolsInterfaceTest_GPU
- name: FitResults
if: success() || failure()
run: |
cd $UNIT_TESTS
./fitResultsTest_GPU gpu

Unit-Test-MPI-GPU:
runs-on: self-hosted
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Building AmpTools
run: |
mkdir Tutorials/Dalitz/lib
mkdir Tutorials/Dalitz/bin
make mpigpu
export AMPTOOLS_HOME=$(pwd)
echo "AMPTOOLS_HOME=$AMPTOOLS_HOME" >> $GITHUB_ENV
echo "AMPTOOLS=$AMPTOOLS_HOME/AmpTools" >> $GITHUB_ENV
echo "AMPPLOTTER=$AMPTOOLS_HOME/AmpPlotter" >> $GITHUB_ENV
echo "DALITZ=$AMPTOOLS_HOME/Tutorials/Dalitz" >> $GITHUB_ENV
echo "UNIT_TESTS=$AMPTOOLS_HOME/UnitTests" >> $GITHUB_ENV
- name: ConfigFileParser
if: success() || failure()
run: |
cd $UNIT_TESTS
$DALITZ/bin/generatePhaseSpace_GPU phasespace.gen.root 100000 12345
$DALITZ/bin/toyAcceptance_GPU phasespace.gen.root phasespace.acc.root 12345
$DALITZ/bin/generatePhysics_GPU parserTest.cfg physics.gen.root 100000 12345
$DALITZ/bin/toyAcceptance_GPU physics.gen.root physics.acc.root 12345
mpirun -n 3 $DALITZ/bin/fitAmplitudesMPI_GPU parserTest.cfg
./parserTest_GPU
- name: ConfigurationInfo
if: success() || failure()
run: |
cd $UNIT_TESTS
./configurationInfoTest_GPU
- name: AmpToolsInterface
if: success() || failure()
run: |
cd $UNIT_TESTS
mpirun -n 3 ./AmpToolsInterfaceTestMPI_GPU
- name: FitResults
if: success() || failure()
run: |
cd $UNIT_TESTS
mpirun -n 3 ./fitResultsTestMPI_GPU mpigpu
56 changes: 56 additions & 0 deletions .github/workflows/write_models.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Write Models
run-name: Writing Models
on: [workflow_dispatch]
permissions:
contents: write
jobs:
Write-Models:
runs-on: self-hosted
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Building AmpTools
run: |
mkdir Tutorials/Dalitz/lib
mkdir Tutorials/Dalitz/bin
make
export AMPTOOLS_HOME=$(pwd)
echo "AMPTOOLS_HOME=$AMPTOOLS_HOME" >> $GITHUB_ENV
echo "AMPTOOLS=$AMPTOOLS_HOME/AmpTools" >> $GITHUB_ENV
echo "AMPPLOTTER=$AMPTOOLS_HOME/AmpPlotter" >> $GITHUB_ENV
echo "DALITZ=$AMPTOOLS_HOME/Tutorials/Dalitz" >> $GITHUB_ENV
echo "UNIT_TESTS=$AMPTOOLS_HOME/UnitTests" >> $GITHUB_ENV
- name: Generating files
run: |
cd $UNIT_TESTS
$DALITZ/bin/generatePhaseSpace phasespace.gen.root 100000 12345
$DALITZ/bin/toyAcceptance phasespace.gen.root phasespace.acc.root 12345
$DALITZ/bin/generatePhysics parserTest.cfg physics.gen.root 100000 12345
$DALITZ/bin/toyAcceptance physics.gen.root physics.acc.root 12345
$DALITZ/bin/fitAmplitudes parserTest.cfg
- name: Writing Models
run: |
cd $UNIT_TESTS
if [ ! -d "models" ]; then
mkdir -p "models"
fi
./writeModels
- name: Commit Changes
id: commit_changes
run: |
git config --local user.email "action@github.com"
git config --local user.name "github-actions"
cd $UNIT_TESTS
git add models/
if git diff --cached --quiet; then
echo "No changes to commit."
echo "push_required=false" >> $GITHUB_OUTPUT
else
git commit -m "Updated models"
echo "push_required=true" >> $GITHUB_OUTPUT
fi
- name: Push changes
if: steps.commit_changes.outputs.push_required == 'true'
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
9 changes: 9 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,16 @@ default:
@$(MAKE) -C AmpPlotter
@echo "=== Building Dalitz tutorial ==="
@$(MAKE) -C Tutorials/Dalitz
@echo "=== Building UnitTests ==="
@$(MAKE) -C UnitTests

mpi: default
@echo "=== Building AmpTools with MPI ==="
@$(MAKE) -C AmpTools MPI=1
@echo "=== Building Dalitz tutorial with MPI ==="
@$(MAKE) -C Tutorials/Dalitz MPI=1
@echo "=== Building UnitTests with MPI ==="
@$(MAKE) -C UnitTests MPI=1

gpu:
@echo "=== Building AmpTools with GPU acceleration ==="
Expand All @@ -38,6 +42,8 @@ gpu:
@$(MAKE) -C AmpPlotter
@echo "=== Building Dalitz tutorial with GPU acceleration ==="
@$(MAKE) -C Tutorials/Dalitz GPU=1
@echo "=== Building UnitTests with GPU acceleration ==="
@$(MAKE) -C UnitTests GPU=1

mpigpu: gpu
@echo "=== Building AmpTools with MPI and GPU acceleration ==="
Expand All @@ -46,11 +52,14 @@ mpigpu: gpu
@$(MAKE) -C AmpPlotter
@echo "=== Building Dalitz tutorial with MPI and GPU acceleration ==="
@$(MAKE) -C Tutorials/Dalitz MPI=1 GPU=1
@echo "=== Building UnitTests with MPI and GPU acceleration ==="
@$(MAKE) -C UnitTests MPI=1 GPU=1

gpumpi: mpigpu

clean:
@$(MAKE) -C AmpTools clean
@$(MAKE) -C AmpPlotter clean
@$(MAKE) -C Tutorials/Dalitz clean
@$(MAKE) -C UnitTests clean

5 changes: 5 additions & 0 deletions Tutorials/Dalitz/DalitzExe/generatePhaseSpace.cc
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,13 @@ int main(int argc, char** argv){
if (argc <= 2){
report( NOTICE, kModule ) << "Usage:" << endl << endl;
report( NOTICE, kModule ) << "\tgeneratePhaseSpace <output file name> <number of events>" << endl << endl;
report( NOTICE, kModule ) << "\tgeneratePhaseSpace <output file name> <number of events> <seed>" << endl << endl;
return 0;
}
if (argc == 4) {
int seed = stoi(argv[3]);
srand48(seed);
}

cout << endl << " *** Generate Phase Space *** " << endl << endl;

Expand Down
5 changes: 5 additions & 0 deletions Tutorials/Dalitz/DalitzExe/generatePhysics.cc
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,13 @@ int main(int argc, char** argv){
if (argc <= 3){
report( NOTICE, kModule ) << "Usage:" << endl;
report( NOTICE, kModule ) << "\tgeneratePhysics <config file name> <output file name> <number of events>" << endl << endl;
report( NOTICE, kModule ) << "\tgeneratePhysics <config file name> <output file name> <number of events> <seed>" << endl << endl;
return 0;
}
if (argc == 5) {
int seed = stoi(argv[4]);
srand48(seed);
}

report( INFO, kModule ) << endl << " *** Generating Events According to Amplitudes *** " << endl << endl;

Expand Down
5 changes: 5 additions & 0 deletions Tutorials/Dalitz/DalitzExe/toyAcceptance.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,13 @@ int main(int argc, char** argv){
if (argc <= 2){
report( NOTICE, kModule ) << "Usage:" << endl << endl;
report( NOTICE, kModule ) << "\ttoyAcceptance <input file name> <output file name>" << endl << endl;
report( NOTICE, kModule ) << "\ttoyAcceptance <input file name> <output file name> <seed>" << endl << endl;
return 0;
}
if (argc == 4) {
int seed = stoi(argv[3]);
srand48(seed);
}

report( INFO, kModule ) << endl << " *** Simulating Detector Effects *** " << endl << endl;

Expand Down
2 changes: 1 addition & 1 deletion Tutorials/Dalitz/run/dalitz2.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ fit dalitz2
reaction dalitz p1 p2 p3

genmc dalitz DalitzDataReader phasespace.gen.root
accmc dalitz DalitzDataReader phasespace.gen.root
accmc dalitz DalitzDataReader phasespace.acc.root
data dalitz DalitzDataReader physics.gen.root
normintfile dalitz dalitz2.ni

Expand Down
Loading
Loading