Skip to content

Commit 610a721

Browse files
authored
Merge pull request #5 from runtingt/trunting/AD-in-CI
Add AD tests to CI
2 parents 763c733 + 4647c49 commit 610a721

File tree

3 files changed

+374
-37
lines changed

3 files changed

+374
-37
lines changed

.github/actions/run-in-cvmfs/action.yml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,20 @@ runs:
99
using: "composite"
1010
steps:
1111
# Case 1: Run inside a Docker container if image is provided and assume CMSSW
12+
- name: Setup output directory
13+
if: ${{ env.IMAGE != '' }}
14+
shell: bash
15+
run: |
16+
mkdir -p outputs
17+
chmod 777 outputs
18+
1219
- name: Run command inside container
1320
if: ${{ env.IMAGE != '' }}
1421
uses: rhaschke/docker-run-action@v5
1522
with:
1623
image: ${{ env.IMAGE }}
1724
shell: bash
18-
options: -v /cvmfs:/cvmfs:shared -v cmsusr:/home/cmsusr/cmssw/:ro -w /home/cmsusr/ -e CMSSW_VERSION=${{ env.CMSSW_VERSION }}
25+
options: --rm -v /cvmfs:/cvmfs:shared -v cmsusr:/home/cmsusr/cmssw/:ro -v ${{ github.workspace }}:/workspace:rw -w /home/cmsusr/ -e CMSSW_VERSION=${{ env.CMSSW_VERSION }}
1926
run: >-
2027
cp -r cmssw/${CMSSW_VERSION} .;
2128
cd /home/cmsusr/${CMSSW_VERSION}/src;
@@ -25,7 +32,6 @@ runs:
2532
cd HiggsAnalysis/CombinedLimit;
2633
${{ inputs.script }}
2734
28-
2935
# Case 2: Run directly on the GitHub runner if no image is provided and assume LCG
3036
- name: Run command on host
3137
if: ${{ env.IMAGE == '' }}
Lines changed: 238 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
name: CI with CVMFS for AD tests
22

33
on:
4+
workflow_dispatch:
45
pull_request_target:
56
types: [ labeled ]
67
branches: [ main ]
78

8-
99
jobs:
1010
test_workflow:
1111
runs-on: ubuntu-latest
@@ -20,24 +20,59 @@ jobs:
2020
CMSSW_VERSION: "CMSSW_15_1_ROOT6_X_2025-04-27-2300"
2121
SCRAM_ARCH: "el8_amd64_gcc12"
2222
ROOT: "ROOT v6.35/01"
23-
24-
env:
25-
docker_opt_rw: -v /cvmfs:/cvmfs:shared -v ${{ github.workspace }}:/work/CombinedLimit --mount source=cmsusr,destination=/home/cmsusr -w /home/cmsusr -e CMSSW_VERSION=${{ matrix.CMSSW_VERSION }} -e SCRAM_ARCH=${{ matrix.SCRAM_ARCH }}
26-
docker_opt_ro: -v /cvmfs:/cvmfs:shared -v cmsusr:/home/cmsusr/cmssw/:ro -w /home/cmsusr/ -e CMSSW_VERSION=${{ matrix.CMSSW_VERSION }} -e SCRAM_ARCH=${{ matrix.SCRAM_ARCH }}
23+
- LCG_RELEASE: "LCG_108"
24+
LCG_ARCH: "x86_64-ubuntu2204-gcc11-opt"
25+
ROOT: "6.36.02"
26+
- LCG_RELEASE: "dev3/latest"
27+
LCG_ARCH: "x86_64-ubuntu2204-gcc11-opt"
28+
ROOT: "LCG master"
2729
name: Test with ${{ matrix.CMSSW_VERSION }} and ${{ matrix.ROOT }}
30+
env:
31+
CMSSW_VERSION: ${{ matrix.CMSSW_VERSION }}
32+
IMAGE: ${{ matrix.IMAGE }}
33+
LCG_RELEASE: ${{ matrix.LCG_RELEASE }}
34+
LCG_ARCH: ${{ matrix.LCG_ARCH }}
2835
steps:
2936
- uses: actions/checkout@v4
37+
3038
- uses: cvmfs-contrib/github-action-cvmfs@v4
3139
with:
32-
cvmfs_repositories: 'cms.cern.ch'
40+
cvmfs_repositories: ${{ (env.CMSSW_VERSION != '') && 'cms.cern.ch' || 'sft.cern.ch' }}
41+
42+
- name: Build Combine (LCG)
43+
if: ${{ env.CMSSW_VERSION == '' }}
44+
env:
45+
LCG_RELEASE: ${{ matrix.LCG_RELEASE }}
46+
LCG_ARCH: ${{ matrix.LCG_ARCH }}
47+
# VDT doesn't seem to be available in LCG_102.
48+
# But also it's very good to also test builds with USE_VDT=OFF.
49+
USE_VDT: ${{ matrix.LCG_RELEASE != 'LCG_102' && 'TRUE' || 'FALSE' }}
50+
run: >-
51+
source /cvmfs/sft.cern.ch/lcg/views/${LCG_RELEASE}/${LCG_ARCH}/setup.sh;
52+
root --version;
53+
mkdir build;
54+
cd build;
55+
cmake -DCMAKE_INSTALL_PREFIX=../install \
56+
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
57+
-DUSE_VDT=${USE_VDT} \
58+
-DBUILD_TESTS=TRUE \
59+
..;
60+
make install -j$(nproc);
61+
echo "RooFit.Banner: 0" > .rootrc;
62+
echo "RooFit.Banner: 0" > test/.rootrc;
63+
cd ..;
64+
export PATH=$PWD/install/bin:$PATH;
65+
export LD_LIBRARY_PATH=$PWD/install/lib:$LD_LIBRARY_PATH;
66+
3367
- uses: rhaschke/docker-run-action@v5
34-
name: Build Combine
35-
if: github.event.label.name == 'testAD'
68+
name: Build Combine (CMSSW)
69+
# Only run the CMSSW build step if the CMSSW_VERSION is defined. Otherwise we build for LCG.
70+
if: ${{ env.CMSSW_VERSION != '' }}
3671
with:
3772
image: ${{ matrix.IMAGE }}
3873
shell: bash
39-
options: ${{env.docker_opt_rw}}
40-
run: |
74+
options: -v /cvmfs:/cvmfs:shared -v ${{ github.workspace }}:/work/CombinedLimit --mount source=cmsusr,destination=/home/cmsusr -w /home/cmsusr -e CMSSW_VERSION=${{ matrix.CMSSW_VERSION }} -e SCRAM_ARCH=${{ matrix.SCRAM_ARCH }}
75+
run: |
4176
cd /home/cmsusr/
4277
source /cvmfs/cms.cern.ch/cmsset_default.sh
4378
scram project ${CMSSW_VERSION}
@@ -50,33 +85,201 @@ jobs:
5085
root --version
5186
combine --help
5287
53-
- uses: rhaschke/docker-run-action@v5
88+
- name: Get output directory
89+
id: get_output_dir
90+
run: |
91+
if [ "${{ env.CMSSW_VERSION }}" == "" ]; then
92+
echo "OUTPUT_DIR=${{ github.workspace }}/outputs" >> "$GITHUB_OUTPUT"
93+
else
94+
echo "OUTPUT_DIR=/workspace/outputs" >> "$GITHUB_OUTPUT"
95+
fi
96+
97+
- uses: ./.github/actions/run-in-cvmfs
5498
name: Counting datacard
55-
if: github.event.label.name == 'testAD'
5699
with:
57-
image: ${{ matrix.IMAGE }}
58-
shell: bash
59-
options: ${{env.docker_opt_ro}}
60-
run: |
61-
cp -r cmssw/${CMSSW_VERSION} .
62-
cd /home/cmsusr/${CMSSW_VERSION}/src
63-
source /cvmfs/cms.cern.ch/cmsset_default.sh
64-
cmsenv
65-
text2workspace.py HiggsAnalysis/CombinedLimit/data/tutorials/multiDim/toy-hgg-125.txt -m 125 -P HiggsAnalysis.CombinedLimit.PhysicsModel:floatingXSHiggs --PO modes=ggH,qqH
66-
combine -M MultiDimFit HiggsAnalysis/CombinedLimit/data/tutorials/multiDim/toy-hgg-125.root --setParameterRanges r=-1,1 --nllbackend codegen
100+
script: |-
101+
COMBINE_COMMAND="combine -M MultiDimFit data/tutorials/multiDim/toy-hgg-125.root --setParameterRanges r=-1,1"
102+
OUTDIR=${{ steps.get_output_dir.outputs.OUTPUT_DIR }}
103+
mkdir -p $OUTDIR/counting $OUTDIR/counting_codegen
104+
text2workspace.py data/tutorials/multiDim/toy-hgg-125.txt -m 125 -P HiggsAnalysis.CombinedLimit.PhysicsModel:floatingXSHiggs --PO modes=ggH,qqH
105+
$COMBINE_COMMAND
106+
mv higgsCombine*.root $OUTDIR/counting
107+
$COMBINE_COMMAND --nllbackend codegen
108+
mv higgsCombine*.root $OUTDIR/counting_codegen/
67109
68-
- uses: rhaschke/docker-run-action@v5
110+
- uses: ./.github/actions/run-in-cvmfs
111+
name: Counting datacard Fixed Point from csv
112+
with:
113+
script: |-
114+
COMBINE_COMMAND="combineTool.py -M MultiDimFit data/tutorials/multiDim/toy-hgg-125.root --fromfile data/tutorials/multiDim/fixed.csv"
115+
OUTDIR=${{ steps.get_output_dir.outputs.OUTPUT_DIR }}
116+
mkdir -p $OUTDIR/counting_fixed_csv $OUTDIR/counting_fixed_csv_codegen
117+
text2workspace.py data/tutorials/multiDim/toy-hgg-125.txt -m 125 -P HiggsAnalysis.CombinedLimit.PhysicsModel:floatingXSHiggs --PO modes=ggH,qqH
118+
$COMBINE_COMMAND
119+
mv higgsCombine*.root $OUTDIR/counting_fixed_csv
120+
$COMBINE_COMMAND --nllbackend codegen
121+
mv higgsCombine*.root $OUTDIR/counting_fixed_csv_codegen/
122+
123+
- uses: ./.github/actions/run-in-cvmfs
124+
name: Parametric analysis
125+
with:
126+
script: |-
127+
COMBINE_COMMAND="combine -M MultiDimFit ws_parametric-analysis.root --algo singles --setParameterRanges r=-2,1"
128+
OUTDIR=${{ steps.get_output_dir.outputs.OUTPUT_DIR }}
129+
mkdir -p $OUTDIR/parametric $OUTDIR/parametric_codegen
130+
text2workspace.py data/tutorials/CAT23001/datacard-3-parametric-analysis.txt -o ws_parametric-analysis.root --mass 125
131+
$COMBINE_COMMAND
132+
mv higgsCombine*.root $OUTDIR/parametric
133+
$COMBINE_COMMAND --nllbackend codegen
134+
mv higgsCombine*.root $OUTDIR/parametric_codegen/
135+
136+
- uses: ./.github/actions/run-in-cvmfs
137+
name: Template analysis CMSHistFunc
138+
with:
139+
script: |-
140+
COMBINE_COMMAND_1="combine -M MultiDimFit ws_template-analysis.root --algo singles --setParameterRanges r=-1,1"
141+
COMBINE_COMMAND_2="combine -M FitDiagnostics ws_template-analysis.root -t -1 --setParameters r=1 --plots --setParameterRanges r=-1,1"
142+
OUTDIR=${{ steps.get_output_dir.outputs.OUTPUT_DIR }}
143+
mkdir -p $OUTDIR/template $OUTDIR/template_codegen
144+
text2workspace.py data/ci/template-analysis_shapeInterp.txt -o ws_template-analysis.root --mass 200
145+
$COMBINE_COMMAND_1
146+
$COMBINE_COMMAND_2
147+
mv higgsCombine*.root fitDiagnostics*.root $OUTDIR/template
148+
$COMBINE_COMMAND_1 --nllbackend codegen; $COMBINE_COMMAND_2 --nllbackend codegen
149+
mv higgsCombine*.root fitDiagnostics*.root $OUTDIR/template_codegen/
150+
151+
- uses: ./.github/actions/run-in-cvmfs
152+
name: Template analysis CMSHistFunc shapeN
153+
with:
154+
script: |-
155+
COMBINE_COMMAND_1="combine -M MultiDimFit ws_template-analysis.root --algo singles --setParameterRanges r=-1,1"
156+
COMBINE_COMMAND_2="combine -M FitDiagnostics ws_template-analysis.root -t -1 --setParameters r=1 --plots --setParameterRanges r=-1,1"
157+
OUTDIR=${{ steps.get_output_dir.outputs.OUTPUT_DIR }}
158+
mkdir -p $OUTDIR/template_shapeN $OUTDIR/template_shapeN_codegen
159+
text2workspace.py data/ci/template-analysis_shapeNInterp.txt -o ws_template-analysis.root --mass 200
160+
$COMBINE_COMMAND_1
161+
$COMBINE_COMMAND_2
162+
mv higgsCombine*.root fitDiagnostics*.root $OUTDIR/template_shapeN
163+
$COMBINE_COMMAND_1 --nllbackend codegen; $COMBINE_COMMAND_2 --nllbackend codegen
164+
mv higgsCombine*.root fitDiagnostics*.root $OUTDIR/template_shapeN_codegen/
165+
166+
- uses: ./.github/actions/run-in-cvmfs
167+
name: Template analysis CMSHistSum
168+
with:
169+
script: |-
170+
COMBINE_COMMAND="combine -M MultiDimFit ws_template-analysis.root --algo singles --setParameterRanges r=-1,1 --X-rtd FAST_VERTICAL_MORPH"
171+
OUTDIR=${{ steps.get_output_dir.outputs.OUTPUT_DIR }}
172+
mkdir -p $OUTDIR/template_histsum $OUTDIR/template_histsum_codegen
173+
text2workspace.py data/ci/template-analysis_shapeInterp.txt -o ws_template-analysis.root --mass 200 --for-fits --no-wrappers --use-histsum
174+
$COMBINE_COMMAND
175+
mv higgsCombine*.root $OUTDIR/template_histsum
176+
$COMBINE_COMMAND --nllbackend codegen
177+
mv higgsCombine*.root $OUTDIR/template_histsum_codegen/
178+
179+
- uses: ./.github/actions/run-in-cvmfs
180+
name: Template analysis CMSHistSum with shapeN
181+
with:
182+
script: |-
183+
COMBINE_COMMAND="combine -M MultiDimFit ws_template-analysis.root --algo singles --setParameterRanges r=-1,1 --X-rtd FAST_VERTICAL_MORPH"
184+
OUTDIR=${{ steps.get_output_dir.outputs.OUTPUT_DIR }}
185+
mkdir -p $OUTDIR/template_histsum_shapeN $OUTDIR/template_histsum_shapeN_codegen
186+
text2workspace.py data/ci/template-analysis_shapeNInterp.txt -o ws_template-analysis.root --mass 200 --for-fits --no-wrappers --use-histsum
187+
$COMBINE_COMMAND
188+
mv higgsCombine*.root $OUTDIR/template_histsum_shapeN
189+
$COMBINE_COMMAND --nllbackend codegen
190+
mv higgsCombine*.root $OUTDIR/template_histsum_shapeN_codegen/
191+
192+
- uses: ./.github/actions/run-in-cvmfs
193+
name: RooMultiPdf
194+
if: ${{ !matrix.CMSSW_VERSION || startsWith(matrix.CMSSW_VERSION, 'CMSSW_14') }}
195+
with:
196+
script: |-
197+
COMBINE_COMMAND="combine -M MultiDimFit -m 125.38 --setParameters pdf_index_ggh=2 --freezeParameters MH --cminDefaultMinimizerStrategy 0 --X-rtd FAST_VERTICAL_MORPH --X-rtd MINIMIZER_freezeDisassociatedParams --X-rtd MINIMIZER_multiMin_maskChannels=2 --algo singles ws_RooMultiPdf.root"
198+
OUTDIR=${{ steps.get_output_dir.outputs.OUTPUT_DIR }}
199+
mkdir -p $OUTDIR/roo_multipdf $OUTDIR/roo_multipdf_codegen
200+
text2workspace.py data/ci/datacard_RooMultiPdf.txt.gz -o ws_RooMultiPdf.root
201+
$COMBINE_COMMAND
202+
mv higgsCombine*.root $OUTDIR/roo_multipdf
203+
$COMBINE_COMMAND --nllbackend codegen
204+
mv higgsCombine*.root $OUTDIR/roo_multipdf_codegen/
205+
206+
- uses: ./.github/actions/run-in-cvmfs
207+
name: RooParametricHist
208+
with:
209+
script: |-
210+
COMBINE_COMMAND="combine -M MultiDimFit ws_RooParametricHist.root --algo singles"
211+
OUTDIR=${{ steps.get_output_dir.outputs.OUTPUT_DIR }}
212+
mkdir -p $OUTDIR/roo_parametric_hist $OUTDIR/roo_parametric_hist_codegen
213+
text2workspace.py -P HiggsAnalysis.CombinedLimit.PhysicsModel:multiSignalModel --PO verbose --PO 'map=.*/*hcc*:r[1,-500,500]' --PO 'map=.*/zcc:z[1,-5,5]' data/ci/datacard_RooParametricHist.txt -o ws_RooParametricHist.root
214+
$COMBINE_COMMAND
215+
mv higgsCombine*.root $OUTDIR/roo_parametric_hist
216+
$COMBINE_COMMAND --nllbackend codegen
217+
mv higgsCombine*.root $OUTDIR/roo_parametric_hist_codegen/
218+
219+
- uses: ./.github/actions/run-in-cvmfs
69220
name: RooHistPdf
70-
if: github.event.label.name == 'testAD'
221+
if: ${{ !matrix.CMSSW_VERSION || startsWith(matrix.CMSSW_VERSION, 'CMSSW_14') }}
71222
with:
72-
image: ${{ matrix.IMAGE }}
73-
shell: bash
74-
options: ${{env.docker_opt_ro}}
75-
run: |
76-
cp -r cmssw/${CMSSW_VERSION} .
77-
cd /home/cmsusr/${CMSSW_VERSION}/src
78-
source /cvmfs/cms.cern.ch/cmsset_default.sh
79-
cmsenv
80-
ulimit -s unlimited
81-
text2workspace.py HiggsAnalysis/CombinedLimit/data/ci/datacard_RooHistPdf.txt.gz -o ws_RooHistPdf.root
82-
combine -M MultiDimFit ws_RooHistPdf.root --algo singles --setParameterRanges r=-1,2. --nllbackend codegen
223+
script: |-
224+
COMBINE_COMMAND="combine -M MultiDimFit ws_RooHistPdf.root --algo singles -v -2 --setParameterRanges r=-1,2."
225+
OUTDIR=${{ steps.get_output_dir.outputs.OUTPUT_DIR }}
226+
mkdir -p $OUTDIR/roo_hist_pdf $OUTDIR/roo_hist_pdf_codegen
227+
text2workspace.py data/ci/datacard_RooHistPdf.txt.gz -o ws_RooHistPdf.root
228+
$COMBINE_COMMAND
229+
mv higgsCombine*.root $OUTDIR/roo_hist_pdf
230+
$COMBINE_COMMAND --nllbackend codegen
231+
mv higgsCombine*.root $OUTDIR/roo_hist_pdf_codegen/
232+
233+
- uses: ./.github/actions/run-in-cvmfs
234+
name: Template analysis with large integrals
235+
with:
236+
script: |-
237+
COMBINE_COMMAND="combine -M MultiDimFit ws_template-analysis.root --algo singles --setParameterRanges r=-1,1"
238+
OUTDIR=${{ steps.get_output_dir.outputs.OUTPUT_DIR }}
239+
mkdir -p $OUTDIR/template_large_integrals $OUTDIR/template_large_integrals_codegen
240+
text2workspace.py data/ci/templ_datacard_largeYields.txt -o ws_template-analysis.root
241+
$COMBINE_COMMAND
242+
mv higgsCombine*.root $OUTDIR/template_large_integrals
243+
$COMBINE_COMMAND --nllbackend codegen
244+
mv higgsCombine*.root $OUTDIR/template_large_integrals_codegen/
245+
246+
- uses: ./.github/actions/run-in-cvmfs
247+
name: Template analysis with large integrals using CMSHistSum
248+
with:
249+
script: |-
250+
COMBINE_COMMAND="combine -M MultiDimFit ws_template-analysis.root --algo singles --setParameterRanges r=-1,1 --X-rtd FAST_VERTICAL_MORPH"
251+
OUTDIR=${{ steps.get_output_dir.outputs.OUTPUT_DIR }}
252+
mkdir -p $OUTDIR/template_large_integrals_histsum $OUTDIR/template_large_integrals_histsum_codegen
253+
text2workspace.py data/ci/templ_datacard_largeYields.txt -o ws_template-analysis.root --for-fits --no-wrappers --use-histsum
254+
$COMBINE_COMMAND
255+
mv higgsCombine*.root $OUTDIR/template_large_integrals_histsum
256+
$COMBINE_COMMAND --nllbackend codegen
257+
mv higgsCombine*.root $OUTDIR/template_large_integrals_histsum_codegen/
258+
259+
- uses: ./.github/actions/run-in-cvmfs
260+
name: InterferenceModel test in CMSSW
261+
with:
262+
script: |
263+
cd test
264+
python3 test_interference.py
265+
266+
- name: Prepare artifact name
267+
id: artifact_name
268+
run: |
269+
SAFE_NAME=$(echo "${{ matrix.CMSSW_VERSION || matrix.LCG_RELEASE }}" | tr '/' '_')
270+
SAFE_ROOT=$(echo "${{ matrix.ROOT }}" | tr ' /' '_')
271+
echo "name=outputs-${SAFE_NAME}-ROOT${SAFE_ROOT}" >> "$GITHUB_OUTPUT"
272+
273+
- uses: actions/upload-artifact@v4
274+
if: always()
275+
name: Upload outputs
276+
with:
277+
name: ${{ steps.artifact_name.outputs.name }}
278+
path: outputs/
279+
retention-days: 7
280+
281+
- uses: ./.github/actions/run-in-cvmfs
282+
name: Compare outputs
283+
with:
284+
script: |
285+
python3 test/codegen/compare_codegen.py outputs

0 commit comments

Comments
 (0)