-
Notifications
You must be signed in to change notification settings - Fork 0
Towards a full regression test #215
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 15 commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
c7710d5
Check if the difference between Grid and Fk is above some threshold a…
Radonirinaunimi 5532b07
Add preliminary workflow
Radonirinaunimi 1ed6173
Fix how `threshold` is passed into the CLI for `compare`
Radonirinaunimi b41f755
Push forgotten fix for `pineko.comparator.compare`
Radonirinaunimi ad9d767
Change how the regression is triggered
Radonirinaunimi 0ac62eb
Test self-hosted runner
Radonirinaunimi f188499
Remove label check for the time being
Radonirinaunimi c68d911
Try without using LHAPDF container
Radonirinaunimi b099ee7
Cache numba compiled codes
Radonirinaunimi 5b56436
Add nFONLL DIS to the regression
Radonirinaunimi 60d18eb
Move full regression into a script and add skeleton compare with refe…
Radonirinaunimi 306d05b
Remove no longer needed env. variables
Radonirinaunimi 94ad994
Make datasets into proper lists
Radonirinaunimi e42c134
Set `nnpdf-data` version to be `>=0.0.3`
Radonirinaunimi 1daec68
Use a different theory and make full pipeline work
Radonirinaunimi 5e89cb9
Various minor fixes and add more datasets
Radonirinaunimi 04e91d6
Trigger only actions in presence of label
Radonirinaunimi 3727b9d
Add multiple convolutions
Radonirinaunimi 782ecca
Add Positivity data
Radonirinaunimi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,60 @@ | ||
| name: regression | ||
|
|
||
| # start job only for PRs when a label is added. | ||
| on: push | ||
| # pull_request: | ||
| # types: [labeled] | ||
|
|
||
| jobs: | ||
| regresstion: | ||
| # if: contains(github.event.pull_request.labels.*.name, 'run-regression') | ||
| name: regression | ||
| runs-on: pineko-stbc3 | ||
|
|
||
| # container: | ||
| # image: ghcr.io/nnpdf/lhapdf:v2 | ||
| # credentials: | ||
| # username: ${{ github.repository_owner }} | ||
| # password: ${{ github.token }} | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v2 | ||
| with: | ||
| # tags needed for dynamic versioning | ||
| fetch-depth: 0 | ||
| - name: Install and configure Poetry | ||
| uses: snok/install-poetry@v1 | ||
| with: | ||
| virtualenvs-create: false | ||
| installer-parallel: true | ||
| - name: Install dependencies 🐍 | ||
| run: poetry install --no-interaction --no-root --with test -E nnpdf | ||
| - name: Install project 🐍 | ||
| # it is required to repeat extras, otherwise they will be removed from | ||
| # the environment | ||
| run: poetry install --no-interaction -E nnpdf --with test | ||
| - name: Get data files 📦 | ||
| id: cache-data-files | ||
| uses: actions/cache@v4 | ||
| with: | ||
| path: theory_productions | ||
| key: theory_productions-v3 | ||
| - name: Download data files 📦 | ||
| if: steps.cache-data_files.outputs.cache-hit != 'true' | ||
| run: | | ||
| sh download_test_data.sh | ||
| - name: Restore cached numba compile code 📮 | ||
| id: cache-numba | ||
| uses: actions/cache@v4 | ||
| with: | ||
| path: src/pineko/__pycache__ | ||
| key: numba-cache-${{ runner.os }}-${{ hashFiles('**/*.py') }} | ||
| restore-keys: numba-cache-${{ runner.os }}- | ||
| - name: Generate FK table predictions and perform regression tests 💣 | ||
| run: | | ||
| sh regression_check.sh | ||
| - name: Save updated numba cache 📮 | ||
| uses: actions/cache@v4 | ||
| with: | ||
| path: src/pineko/__pycache__ | ||
| key: numba-cache-${{ runner.os }}-${{ hashFiles('**/*.py') }} | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,4 @@ | ||
| #!/bin/bash | ||
| wget -r -np -nH --cut-dirs=1 -l 4 -e robots=off --no-verbose -R index.* https://data.nnpdf.science/pineko/theory_productions/ | ||
| wget -r -np -nH --cut-dirs=1 -l 4 -e robots=off --no-verbose -P benchmarks -R index.* https://data.nnpdf.science/pineko/data_files/ | ||
| wget -r -np -nH --cut-dirs=1 -l 4 -e robots=off --no-verbose -P benchmarks -R index.* https://data.nnpdf.science/pineko/fakepdfs/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| [general] | ||
| nnpdf=true | ||
|
|
||
| [paths] | ||
| # inputs | ||
| grids = "./theory_productions/data/grids" | ||
| operator_card_template_name = "_template.cli.toml" | ||
|
Radonirinaunimi marked this conversation as resolved.
Outdated
|
||
| # outputs | ||
| operator_cards = "./theory_productions/operator_cards" | ||
| ekos = "./theory_productions/data/ekos" | ||
| fktables = "./theory_productions/data/fktables" | ||
|
|
||
| [paths.logs] | ||
| eko = "./theory_productions/logs/eko" | ||
| fk = "./theory_productions/logs/fk" | ||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,86 @@ | ||
| #!/bin/bash | ||
|
|
||
| set -euo pipefail | ||
|
|
||
| THEORY_ID=40008005 | ||
| PDF_NAME="NNPDF40_nnlo_as_01180" | ||
|
|
||
| LIST_DIS_DATASETS=("HERA_CC_318GEV_EP-SIGMARED") | ||
| LIST_HADRONIC_DATASETS=("ATLAS_Z0_7TEV_36PB_ETA") | ||
|
|
||
| dis_predictions() { | ||
| THEORYID=$1 | ||
| DIS_DATASETS=$2 | ||
| NFONLL_ID=$(($THEORYID*100)) | ||
|
|
||
| for dataset in "${DIS_DATASETS[@]}"; do | ||
| pineko fonll -c pineko.cli.toml tcards $THEORYID | ||
| pineko fonll -c pineko.cli.toml ekos --overwrite $THEORYID $dataset | ||
| pineko fonll -c pineko.cli.toml fks --overwrite $THEORYID $dataset | ||
| pineko fonll -c pineko.cli.toml combine --overwrite $THEORYID $dataset \ | ||
| --FFNS3 $NFONLL_ID \ | ||
| --FFN03 $(($NFONLL_ID+1)) \ | ||
| --FFNS4zeromass $(($NFONLL_ID+2)) \ | ||
| --FFNS4massive $(($NFONLL_ID+3)) \ | ||
| --FFN04 $(($NFONLL_ID+4)) \ | ||
| --FFNS5zeromass $(($NFONLL_ID+5)) \ | ||
| --FFNS5massive $(($NFONLL_ID+6)) | ||
| done | ||
| } | ||
|
|
||
| hadronic_predictions() { | ||
| THEORYID=$1 | ||
| HADRONIC_DATASETS=$2 | ||
|
|
||
| for dataset in "${HADRONIC_DATASETS[@]}"; do | ||
| pineko theory -c pineko.cli.toml opcards --overwrite $THEORYID $dataset | ||
| pineko theory -c pineko.cli.toml ekos --overwrite $THEORYID $dataset | ||
| pineko theory -c pineko.cli.toml fks --overwrite $THEORYID $dataset | ||
| done | ||
|
|
||
| # Compare the Hadronic FK tables with the Grids | ||
| grids=(theory_productions/data/grids/"$THEORYID"/*.pineappl.lz4) | ||
| for gridpath in "${grids[@]}"; do | ||
| gridname=$(basename "$gridpath") | ||
| pineko compare ./theory_productions/data/fktables/"$THEORYID"/"$gridname" \ | ||
| ./theory_productions/data/grids/"$THEORYID"/"$gridname" 3 0 \ | ||
| $PDF_NAME --threshold 1 | ||
| done | ||
| } | ||
|
|
||
| compare_predictions() { | ||
| REFERED_FK=$1 | ||
| CURRENT_FK=$2 | ||
|
|
||
| # Extract the predictions - the last column | ||
| diffs=($(pineappl diff $REFERED_FK $CURRENT_FK $PDF_NAME | awk 'NR>2 {print $NF}')) | ||
|
|
||
| preds_length=${#diffs[@]} # Get the length of the predictions | ||
| for ((bin=0; bin<preds_length; bin++)); do | ||
| pred_value=${diffs[bin]} | ||
| value=$(printf "%.16f" "$pred_value") # Make sure it is in float representation | ||
| # https://www.shell-tips.com/bash/math-arithmetic-calculation/#gsc.tab=0 | ||
| abs_diff=$(echo "scale=10; if ($value< 0) -($value) else $value" | bc) | ||
| check_diff=$(echo "$abs_diff > 0.001" | bc) # Set threshold to 1 permille | ||
|
|
||
| if [[ $check_diff -eq 1 ]]; then | ||
| echo "Bin $bin: ($REFERED_FK) and ($CURRENT_FK) differ more than 1 permille." | ||
| exit 1 | ||
| fi | ||
| done | ||
| } | ||
|
|
||
| compare_fks_with_reference() { | ||
| THEORYID=$1 | ||
| fktables=(./theory_productions/data/fktables/"$THEORYID"/*.pineappl.lz4) | ||
| for fktable_path in "${fktables[@]}"; do | ||
| fkname=$(basename "$fktable_path") | ||
| fkref="./theory_productions/data/fktables/$THEORYID/$fkname" | ||
| fkcur="./theory_productions/reference_fks/$THEORYID/$fkname" | ||
| compare_predictions "$fkref" "$fkcur" | ||
| done | ||
| } | ||
|
|
||
| dis_predictions $THEORY_ID $LIST_DIS_DATASETS | ||
| hadronic_predictions $THEORY_ID $LIST_HADRONIC_DATASETS | ||
| compare_fks_with_reference $THEORY_ID |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.