Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' (new CI #794 and valgr…
Browse files Browse the repository at this point in the history
…ind fixes #869) into tmad
  • Loading branch information
valassi committed Jun 27, 2024
2 parents 9a0b46d + a87e640 commit f912941
Show file tree
Hide file tree
Showing 49 changed files with 608 additions and 60 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/testsuite_allprocesses.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Copyright (C) 2020-2023 CERN and UCLouvain.
# Copyright (C) 2020-2024 CERN and UCLouvain.
# Licensed under the GNU Lesser General Public License (version 3 or later).
# Created by: A. Valassi (Nov 2023) for the MG5aMC CUDACPP plugin.
# Further modified by: A. Valassi (2023) for the MG5aMC CUDACPP plugin.
# Further modified by: A. Valassi (2023-2024) for the MG5aMC CUDACPP plugin.

#----------------------------------------------------------------------------------------------------------------------------------

Expand Down
266 changes: 261 additions & 5 deletions .github/workflows/testsuite_oneprocess.sh

Large diffs are not rendered by default.

198 changes: 163 additions & 35 deletions .github/workflows/testsuite_oneprocess.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Copyright (C) 2020-2023 CERN and UCLouvain.
# Copyright (C) 2020-2024 CERN and UCLouvain.
# Licensed under the GNU Lesser General Public License (version 3 or later).
# Created by: A. Valassi (Oct 2023) for the MG5aMC CUDACPP plugin.
# Further modified by: A. Valassi (2023) for the MG5aMC CUDACPP plugin.
# Further modified by: A. Valassi (2023-2024) for the MG5aMC CUDACPP plugin.

#----------------------------------------------------------------------------------------------------------------------------------

Expand Down Expand Up @@ -29,13 +29,13 @@ on:
workflow_dispatch:
inputs:
process:
description: 'Physics process'
description: 'physics process'
default: 'gg_tt.mad'
required: true
###type: string
type: choice
# FIXME? Can the list of supported processes be specified only once in oneprocess.yml or allprocesses.yml?
options: [gg_tt.mad, gg_ttg.mad, gg_ttgg.mad, gg_ttggg.mad, ee_mumu.mad, nobm_pp_ttW.mad]
###options: [ee_mumu.mad, gg_tt.mad, gg_ttg.mad, gg_ttgg.mad, gg_ttggg.mad, gg_tt01g.mad, gq_ttq.mad, pp_tt012j.mad]

#----------------------------------------------------------------------------------------------------------------------------------

Expand All @@ -51,25 +51,52 @@ jobs:
actions: write # this is required to delete caches
contents: read
steps:
- name: split_prnum
# See https://stackoverflow.com/a/73467112
id: split
run: echo "prnum=PR${GITHUB_REF_NAME%%/*}" >> $GITHUB_OUTPUT
- name: cleanup_cache
run: |
gh extension install actions/gh-actions-cache
REPO=${{ github.repository }}
echo "List cache keys (start)"
gh actions-cache list -R $REPO --sort created-at --order asc --key cache-${{ runner.os }}-${{ inputs.process }}
echo "List cache keys (end)"
###cacheKeys=$(gh actions-cache list -R $REPO --sort created-at --order asc --key cache-${{ runner.os }}-${{ inputs.process }} | cut -f 1) # delete ALL caches
cacheKeys=$(gh actions-cache list -R $REPO --sort created-at --order asc --key cache-${{ runner.os }}-${{ inputs.process }} | cut -f 1 | head --lines=-1) # keep only the most recent cache
echo "Workflow run_id is ${{ github.run_id }}"
echo "Workflow ref_name is ${{ github.ref_name }}"
echo "Workflow PR number is ${{ steps.split.outputs.prnum }}"
#--- LIST CODEGEN CACHES FOR THIS RUN_ID
echo "List codegencache keys for this run_id (start)"
gh actions-cache list -R $REPO --sort created-at --order asc --key codegencache-${{ runner.os }}-${{ inputs.process }}-${{ github.run_id }}
echo "List codegencache keys for this run_id (end)"
cacheKeysCodegen=$(gh actions-cache list -R $REPO --sort created-at --order asc --key codegencache-${{ runner.os }}-${{ inputs.process }}-${{ github.run_id }} | cut -f 1) # delete ALL codegen caches
#--- LIST BUILD CACHES FOR THIS PRNUM (d)
echo "List buildcacheD keys for this prnum (start)"
gh actions-cache list -R $REPO --sort created-at --order asc --key buildcache-${{ runner.os }}-${{ inputs.process }}-d-${{ steps.split.outputs.prnum }}
echo "List buildcacheD keys for this prnum (end)"
cacheKeysBuildD=$(gh actions-cache list -R $REPO --sort created-at --order asc --key buildcache-${{ runner.os }}-${{ inputs.process }}-d-${{ steps.split.outputs.prnum }} | cut -f 1 | head --lines=-1) # keep only the most recent build cache
#--- LIST BUILD CACHES FOR THIS PRNUM (f)
echo "List buildcacheF keys for this prnum (start)"
gh actions-cache list -R $REPO --sort created-at --order asc --key buildcache-${{ runner.os }}-${{ inputs.process }}-f-${{ steps.split.outputs.prnum }}
echo "List buildcacheF keys for this prnum (end)"
cacheKeysBuildF=$(gh actions-cache list -R $REPO --sort created-at --order asc --key buildcache-${{ runner.os }}-${{ inputs.process }}-f-${{ steps.split.outputs.prnum }} | cut -f 1 | head --lines=-1) # keep only the most recent build cache
#--- LIST BUILD CACHES FOR THIS PRNUM (m)
echo "List buildcacheM keys for this prnum (start)"
gh actions-cache list -R $REPO --sort created-at --order asc --key buildcache-${{ runner.os }}-${{ inputs.process }}-m-${{ steps.split.outputs.prnum }}
echo "List buildcacheM keys for this prnum (end)"
cacheKeysBuildF=$(gh actions-cache list -R $REPO --sort created-at --order asc --key buildcache-${{ runner.os }}-${{ inputs.process }}-m-${{ steps.split.outputs.prnum }} | cut -f 1 | head --lines=-1) # keep only the most recent build cache
#--- DELETE CODEGEN AND BUILD CACHES
set +e # do not fail while deleting cache keys
echo "Deleting caches..."
for cacheKey in $cacheKeys; do gh actions-cache delete $cacheKey -R $REPO --confirm; done
echo "Deleting caches... done"
echo "Deleting codegen caches..."
for cacheKey in $cacheKeysCodegen; do gh actions-cache delete $cacheKey -R $REPO --confirm; done
echo "Deleting codegen caches... done"
echo "Deleting build caches..."
for cacheKey in $cacheKeysBuildD; do gh actions-cache delete $cacheKey -R $REPO --confirm; done
for cacheKey in $cacheKeysBuildF; do gh actions-cache delete $cacheKey -R $REPO --confirm; done
echo "Deleting build caches... done"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

testsuite:
codegen:
runs-on: ubuntu-latest
needs: cleanup

Expand All @@ -80,22 +107,116 @@ jobs:
with:
submodules: 'true'

- name: HELLO
- name: split_prnum
# See https://stackoverflow.com/a/73467112
id: split
run: echo "prnum=PR${GITHUB_REF_NAME%%/*}" >> $GITHUB_OUTPUT

- name: HELLO_CODEGEN
run: |
echo "HELLO ${{ inputs.process }}! $(date)"
echo "HELLO_CODEGEN ${{ inputs.process }} $(date)"
echo "Workflow run_id is ${{ github.run_id }}"
echo "Workflow ref_name is ${{ github.ref_name }}"
echo "Workflow PR number is ${{ steps.split.outputs.prnum }}"
echo "Current directory is $(pwd)"
echo "Current git commit is $(git log --oneline -n1 | cut -d' ' -f1)"
# See https://github.com/actions/cache/blob/main/tips-and-workarounds.md#force-deletion-of-caches-overriding-default-cache-eviction-policy
gh extension install actions/gh-actions-cache
REPO=${{ github.repository }}
echo "List cache keys (start)"
gh actions-cache list -R $REPO --sort created-at --order asc --key cache-${{ runner.os }}-${{ inputs.process }}
echo "List cache keys (end)"
echo "List codegencache keys for this run_id (start)"
gh actions-cache list -R $REPO --sort created-at --order asc --key codegencache-${{ runner.os }}-${{ inputs.process }}-${{ github.run_id }}
echo "List codegencache keys for this run_id (end)"
env:
GH_TOKEN: ${{ github.token }}

- name: restore_cache
id: cache-restore
- name: codegen
run: .github/workflows/testsuite_oneprocess.sh codegen ${{ inputs.process }}

- name: update_codegen_cache # update codegen caches
id: codegen-cache-update
# See https://github.com/actions/cache
uses: actions/cache/save@v4
with:
path: |
epochX/cudacpp/${{ inputs.process }}
key: codegencache-${{ runner.os }}-${{ inputs.process }}-${{ github.run_id }}

- name: GOODBYE_CODEGEN
run: |
echo "GOODBYE_CODEGEN ${{ inputs.process }} $(date)"
echo "Workflow run_id is ${{ github.run_id }}"
echo "Workflow ref_name is ${{ github.ref_name }}"
echo "Workflow PR number is ${{ steps.split.outputs.prnum }}"
echo "Current directory is $(pwd)"
echo "Current git commit is $(git log --oneline -n1 | cut -d' ' -f1)"
REPO=${{ github.repository }}
echo "List codegencache keys for this run_id (start)"
gh actions-cache list -R $REPO --sort created-at --order asc --key codegencache-${{ runner.os }}-${{ inputs.process }}-${{ github.run_id }}
echo "List codegencache keys for this run_id (end)"
env:
GH_TOKEN: ${{ github.token }}

#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

testsuite:
runs-on: ubuntu-latest
needs: codegen

strategy:
fail-fast: false # e.g. do not stop 'd' job if 'f' job has failed (fail-fast is true by default)
matrix:
fptype: [d, f, m]

env:
FPTYPE: ${{ matrix.fptype }}

steps:
- # See https://github.com/actions/checkout
# (NB actions/checkout needs "Allow owner and select non-owner" and "Allow actions created by github")
uses: actions/checkout@v4
with:
submodules: 'true'

- name: split_prnum
# See https://stackoverflow.com/a/73467112
id: split
run: echo "prnum=PR${GITHUB_REF_NAME%%/*}" >> $GITHUB_OUTPUT

- name: HELLO_TESTSUITE
run: |
echo "HELLO_TESTSUITE ${{ inputs.process }} FPTYPE=${{ matrix.fptype }} $(date)"
echo "Workflow run_id is ${{ github.run_id }}"
echo "Workflow ref_name is ${{ github.ref_name }}"
echo "Workflow PR number is ${{ steps.split.outputs.prnum }}"
echo "Current directory is $(pwd)"
###echo "Current git commit is $(git log --oneline -n1 | cut -d' ' -f1)"
# See https://github.com/actions/cache/blob/main/tips-and-workarounds.md#force-deletion-of-caches-overriding-default-cache-eviction-policy
gh extension install actions/gh-actions-cache
REPO=${{ github.repository }}
echo "List codegencache keys for this run_id (start)"
gh actions-cache list -R $REPO --sort created-at --order asc --key codegencache-${{ runner.os }}-${{ inputs.process }}-${{ github.run_id }}
echo "List codegencache keys for this run_id (end)"
echo "List buildcache keys (start)"
gh actions-cache list -R $REPO --sort created-at --order asc --key buildcache-${{ runner.os }}-${{ inputs.process }}-${{ matrix.fptype }}
echo "List buildcache keys (end)"
env:
GH_TOKEN: ${{ github.token }}

- name: restore_codegen_cache
id: codegen-cache-restore
# See https://github.com/actions/cache
# See https://github.com/actions/cache/blob/main/tips-and-workarounds.md#update-a-cache
uses: actions/cache/restore@v4
with:
path: |
epochX/cudacpp/${{ inputs.process }}
key: codegencache-${{ runner.os }}-${{ inputs.process }}-${{ github.run_id }}
# NB: only restore codegencache from this workflow run
restore-keys: |
codegencache-${{ runner.os }}-${{ inputs.process }}-${{ github.run_id }}
- name: restore_build_cache
id: build-cache-restore
# See https://github.com/actions/cache
# See https://github.com/actions/cache/blob/main/tips-and-workarounds.md#update-a-cache
uses: actions/cache/restore@v4
Expand All @@ -104,45 +225,52 @@ jobs:
CCACHE_DIR
DOWNLOADS
test/googletest
key: cache-${{ runner.os }}-${{ inputs.process }}-${{ github.run_id }}
restore-keys:
cache-${{ runner.os }}-${{ inputs.process }}

- name: codegen
run: .github/workflows/testsuite_oneprocess.sh codegen ${{ inputs.process }}
key: buildcache-${{ runner.os }}-${{ inputs.process }}-${{ matrix.fptype }}-${{ steps.split.outputs.prnum }}-${{ github.run_id }}
restore-keys: |
buildcache-${{ runner.os }}-${{ inputs.process }}-${{ matrix.fptype }}-${{ steps.split.outputs.prnum }}
buildcache-${{ runner.os }}-${{ inputs.process }}-${{ matrix.fptype }}
- name: before_build
run: .github/workflows/testsuite_oneprocess.sh before_build ${{ inputs.process }}

- name: build
run: .github/workflows/testsuite_oneprocess.sh build ${{ inputs.process }}

- name: after_build
run: .github/workflows/testsuite_oneprocess.sh after_build ${{ inputs.process }}

- name: update_cache # update caches after the builds but before the tests (which may fail even if builds succeed)
id: cache-update
- name: update_build_cache # update build caches after the builds but before the tests (which may fail even if builds succeed)
id: build-cache-update
# See https://github.com/actions/cache
uses: actions/cache/save@v4
with:
path: |
CCACHE_DIR
DOWNLOADS
test/googletest
key: cache-${{ runner.os }}-${{ inputs.process }}-${{ github.run_id }}
key: buildcache-${{ runner.os }}-${{ inputs.process }}-${{ matrix.fptype }}-${{ steps.split.outputs.prnum }}-${{ github.run_id }}

- name: tput_test
run: .github/workflows/testsuite_oneprocess.sh tput_test ${{ inputs.process }}

- name: GOODBYE
- name: tmad_test
run: .github/workflows/testsuite_oneprocess.sh tmad_test ${{ inputs.process }}

- name: GOODBYE_TESTSUITE
run: |
echo "GOODBYE ${{ inputs.process }}! $(date)"
echo "GOODBYE_TESTSUITE ${{ inputs.process }} FPTYPE=${{ matrix.fptype }} $(date)"
echo "Workflow run_id is ${{ github.run_id }}"
echo "Workflow ref_name is ${{ github.ref_name }}"
echo "Workflow PR number is ${{ steps.split.outputs.prnum }}"
echo "Current directory is $(pwd)"
echo "Current git commit is $(git log --oneline -n1 | cut -d' ' -f1)"
REPO=${{ github.repository }}
echo "List cache keys (start)"
gh actions-cache list -R $REPO --sort created-at --order asc --key cache-${{ runner.os }}-${{ inputs.process }}
echo "List cache keys (end)"
echo "List codegencache keys for this run_id (start)"
gh actions-cache list -R $REPO --sort created-at --order asc --key codegencache-${{ runner.os }}-${{ inputs.process }}-${{ github.run_id }}
echo "List codegencache keys for this run_id (end)"
echo "List buildcache keys (start)"
gh actions-cache list -R $REPO --sort created-at --order asc --key buildcache-${{ runner.os }}-${{ inputs.process }}-${{ matrix.fptype }}
echo "List buildcache keys (end)"
env:
GH_TOKEN: ${{ github.token }}

Expand Down
2 changes: 1 addition & 1 deletion MG5aMC/mg5amcnlo
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ index 4fbb8e6ba..f9e2335de 100644
END

diff --git b/epochX/cudacpp/gg_tt.mad/SubProcesses/P1_gg_ttx/driver.f a/epochX/cudacpp/gg_tt.mad/SubProcesses/P1_gg_ttx/driver.f
index 71fbf2b25..0f1d199fc 100644
index 1124a9164..27a6e4674 100644
--- b/epochX/cudacpp/gg_tt.mad/SubProcesses/P1_gg_ttx/driver.f
+++ a/epochX/cudacpp/gg_tt.mad/SubProcesses/P1_gg_ttx/driver.f
@@ -74,13 +74,77 @@ c common/to_colstats/ncols,ncolflow,ncolalt,ic
Expand Down Expand Up @@ -239,7 +239,7 @@ index 71fbf2b25..0f1d199fc 100644
c
c Read process number
c
@@ -207,8 +271,33 @@ c call sample_result(xsec,xerr)
@@ -208,8 +272,33 @@ c call sample_result(xsec,xerr)
c write(*,*) 'Final xsec: ',xsec

rewind(lun)
Expand Down Expand Up @@ -274,7 +274,7 @@ index 71fbf2b25..0f1d199fc 100644
end

c $B$ get_user_params $B$ ! tag for MadWeight
@@ -386,7 +475,7 @@ c
@@ -387,7 +476,7 @@ c
fopened=.false.
tempname=filename
fine=index(tempname,' ')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ Program DRIVER
l2=index(buf,'_')
if(l1.ne.0.and.l2.ne.0.and.l1.lt.l2-1)
$ read(buf(l1+1:l2-1),*,err=11) ngroup
close (lun+1)
11 print *,'Process in group number ',ngroup

c Read weight from results.dat if present, to allow event generation
Expand Down
13 changes: 12 additions & 1 deletion epochX/cudacpp/ee_mumu.mad/SubProcesses/reweight.f
Original file line number Diff line number Diff line change
Expand Up @@ -633,6 +633,17 @@ logical function setclscales(p, keepq2bck, ivec)
external is_octet
setclscales=.true.

setclscales=.true.

c Workaround for valgrind 'Conditional jump or move depends on uninitialised value(s)'
c See https://github.com/mg5amcnlo/mg5amcnlo/issues/111
c FIXME: this is just a workaround to avoid uninitialised values and undefined behaviour...
c FIXME: a real bug is probably hidden in the code (goodjet must be correctly defined!)...
c FIXME: adding this workaround may change the behaviour of existing code...
do i=1,n_max_cl
goodjet(i)=.false. !!FIXME!! there is no reason to choose false instead of true here...
end do

if(ickkw.le.0.and.xqcut.le.0d0.and.q2fact(1).gt.0.and.q2fact(2).gt.0.and.scale.gt.0) then
if(use_syst)then
s_scale(ivec)=scale
Expand Down Expand Up @@ -1227,7 +1238,7 @@ logical function setclscales(p, keepq2bck, ivec)
do i=1,2
do j=1,2
c First adjust goodjet based on iqjets
if(goodjet(ida(i)).and.ipart(j,ida(i)).gt.2)then
if(goodjet(ida(i)).and.ipart(j,ida(i)).gt.2)then ! FIXME: goodjet is uninitialised #111
if(iqjets(ipart(j,ida(i))).eq.0) goodjet(ida(i))=.false.
endif
c Now reset ptclus if jet vertex
Expand Down
1 change: 1 addition & 0 deletions epochX/cudacpp/gg_tt.mad/SubProcesses/P1_gg_ttx/driver.f
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ Program DRIVER
l2=index(buf,'_')
if(l1.ne.0.and.l2.ne.0.and.l1.lt.l2-1)
$ read(buf(l1+1:l2-1),*,err=11) ngroup
close (lun+1)
11 print *,'Process in group number ',ngroup

c Read weight from results.dat if present, to allow event generation
Expand Down
13 changes: 12 additions & 1 deletion epochX/cudacpp/gg_tt.mad/SubProcesses/reweight.f
Original file line number Diff line number Diff line change
Expand Up @@ -633,6 +633,17 @@ logical function setclscales(p, keepq2bck, ivec)
external is_octet
setclscales=.true.

setclscales=.true.

c Workaround for valgrind 'Conditional jump or move depends on uninitialised value(s)'
c See https://github.com/mg5amcnlo/mg5amcnlo/issues/111
c FIXME: this is just a workaround to avoid uninitialised values and undefined behaviour...
c FIXME: a real bug is probably hidden in the code (goodjet must be correctly defined!)...
c FIXME: adding this workaround may change the behaviour of existing code...
do i=1,n_max_cl
goodjet(i)=.false. !!FIXME!! there is no reason to choose false instead of true here...
end do

if(ickkw.le.0.and.xqcut.le.0d0.and.q2fact(1).gt.0.and.q2fact(2).gt.0.and.scale.gt.0) then
if(use_syst)then
s_scale(ivec)=scale
Expand Down Expand Up @@ -1227,7 +1238,7 @@ logical function setclscales(p, keepq2bck, ivec)
do i=1,2
do j=1,2
c First adjust goodjet based on iqjets
if(goodjet(ida(i)).and.ipart(j,ida(i)).gt.2)then
if(goodjet(ida(i)).and.ipart(j,ida(i)).gt.2)then ! FIXME: goodjet is uninitialised #111
if(iqjets(ipart(j,ida(i))).eq.0) goodjet(ida(i))=.false.
endif
c Now reset ptclus if jet vertex
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ Program DRIVER
l2=index(buf,'_')
if(l1.ne.0.and.l2.ne.0.and.l1.lt.l2-1)
$ read(buf(l1+1:l2-1),*,err=11) ngroup
close (lun+1)
11 print *,'Process in group number ',ngroup

c Read weight from results.dat if present, to allow event generation
Expand Down
Loading

0 comments on commit f912941

Please sign in to comment.