Skip to content

Commit

Permalink
Merge pull request #979 from madgraph5/testsuite_only
Browse files Browse the repository at this point in the history
PR where I only add CI but not trying to fix them
  • Loading branch information
valassi authored Sep 1, 2024
2 parents 3f69b26 + 4cf1721 commit 2d95c01
Show file tree
Hide file tree
Showing 9 changed files with 777 additions and 0 deletions.
112 changes: 112 additions & 0 deletions .github/workflows/madgraph_launch_test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
# WARNING THIS FILE IS AUTOGENERATED -> edit test_simd_madevent.template


# This is a basic workflow to help you get started with Actions

name: running acceptance test
# Controls when the workflow will run
# branches: [ main LTS ]
on:
# Triggers the workflow on push or pull request events but only for the 3.4.0 branch
push:
paths-ignore:
- 'docs/**'
# - '.github/**'

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
inputs:
message:
description: 'running acceptance test'
required: true

env:
commitmsg: ${{ github.event.head_commit.message }}

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"

simd_cpp_heft_ggh_double:
# The type of runner that the job will run on
runs-on: ubuntu-latest

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
with:
submodules: 'true'

# Runs a set of commands using the runners shell
- name: test one of the test testIO_AcceptanceProcOutputIOTests
run: |
cd $GITHUB_WORKSPACE
cd MG5aMC/mg5amcnlo/
cp input/.mg5_configuration_default.txt input/mg5_configuration.txt
cp Template/LO/Source/.make_opts Template/LO/Source/make_opts
./tests/test_manager.py -p./PLUGIN/CUDACPP_OUTPUT/acceptance_tests/ test_simd_cpp_heft_ggh_double
simd_cpp_pptt_mixed:
# The type of runner that the job will run on
runs-on: ubuntu-latest

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
with:
submodules: 'true'

# Runs a set of commands using the runners shell
- name: test one of the test testIO_AcceptanceProcOutputIOTests
run: |
cd $GITHUB_WORKSPACE
cd MG5aMC/mg5amcnlo/
cp input/.mg5_configuration_default.txt input/mg5_configuration.txt
cp Template/LO/Source/.make_opts Template/LO/Source/make_opts
./tests/test_manager.py -p./PLUGIN/CUDACPP_OUTPUT/acceptance_tests/ test_simd_cpp_pptt_mixed
simd_cpp_eemumua_float:
# The type of runner that the job will run on
runs-on: ubuntu-latest

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
with:
submodules: 'true'

# Runs a set of commands using the runners shell
- name: test one of the test testIO_AcceptanceProcOutputIOTests
run: |
cd $GITHUB_WORKSPACE
cd MG5aMC/mg5amcnlo/
cp input/.mg5_configuration_default.txt input/mg5_configuration.txt
cp Template/LO/Source/.make_opts Template/LO/Source/make_opts
./tests/test_manager.py -p./PLUGIN/CUDACPP_OUTPUT/acceptance_tests/ test_simd_cpp_eemumua_float
simd_cpp_vector_size:
# The type of runner that the job will run on
runs-on: ubuntu-latest

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
with:
submodules: 'true'

# Runs a set of commands using the runners shell
- name: test one of the test testIO_AcceptanceProcOutputIOTests
run: |
cd $GITHUB_WORKSPACE
cd MG5aMC/mg5amcnlo/
cp input/.mg5_configuration_default.txt input/mg5_configuration.txt
cp Template/LO/Source/.make_opts Template/LO/Source/make_opts
./tests/test_manager.py -p./PLUGIN/CUDACPP_OUTPUT/acceptance_tests/ test_simd_cpp_vector_size
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
####
## Automatic creation of CI/CD for the plugin repo
## and automatic test in madgraph format style
## test can be added easily by adding a file in the directory
## simple_cross_check
## format of the file is the cmd file to pass to the code
## two type of additional metadata line are present
## #title provide the documentation information for the unittest (docstring)
## #check RUN_NAME CROSS ERROR NB_EVENT provide the target cross-section/error/requested event


import os
import glob

curr_dir = os.path.dirname(__file__)
pjoin = os.path.join
template_runtest = """
# WARNING THIS FILE IS AUTOGENERATED -> edit test_simd_madevent.template
def test_%(name)s(self):
\"\"\"%(doc)s\"\"\"
if logging.getLogger('madgraph').level <= 20:
stdout=None
stderr=None
else:
devnull =open(os.devnull,'w')
stdout=devnull
stderr=devnull
try:
shutil.rmtree('/tmp/MGPROCESS/')
except Exception as error:
pass
cmd = \"\"\"%(cmd)s
\"\"\" %%self.run_dir
open(pjoin(self.path, 'mg5_cmd'),'w').write(cmd)
subprocess.call([sys.executable, pjoin(MG5DIR, 'bin','mg5_aMC'),
pjoin(self.path, 'mg5_cmd')],
#cwd=self.path,
stdout=stdout, stderr=stderr)
"""

template_onecheck = """
self.check_parton_output(cross=%(cross)s, error=%(err)s, run_name='%(run_name)s', html=%(html)s)
event = '%%s/Events/%(run_name)s/unweighted_events.lhe' %% self.run_dir
if not os.path.exists(event):
misc.gunzip(event)
lhefile = lhe_parser.EventFile(event)
nb_event = 0
for event in lhe_parser.EventFile(event):
event.check()
nb_event+=1
self.assertEqual(nb_event, %(nb_event)s)"""


def create_test_simd_madevent():

text = "# WARNING THIS FILE IS AUTOGENERATED -> edit test_simd_madevent.template\n\n\n"
text += open(pjoin(curr_dir, 'test_simd_madevent.template'),'r').read()

for filename in os.listdir(pjoin(curr_dir, 'simple_cross_check')):

opt = {}
opt['name'] = filename
opt['cmd'] = open(pjoin(curr_dir, 'simple_cross_check',filename)).read()
opt['doc'] = "\n".join([line[5:] for line in opt['cmd'].split('\n') if line.startswith('#title')])

text += template_runtest % opt

checks = [line.split() for line in opt['cmd'].split('\n') if line.startswith('#check')]

for i, check in enumerate(checks):
_, name, cross, err, nb_event = check
opt['run_name'] = name
opt['cross'] = cross
opt['err'] = err
opt['nb_event'] = nb_event
opt['html'] = 'True' if i==0 else 'False'

text += template_onecheck % opt

open(pjoin(curr_dir, 'test_simd_madevent.py'), 'w').write(text)

template_one_cicd="""
%(name)s:
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
with:
submodules: 'true'
# Runs a set of commands using the runners shell
- name: test one of the test testIO_AcceptanceProcOutputIOTests
run: |
cd $GITHUB_WORKSPACE
cd MG5aMC/mg5amcnlo/
cp input/.mg5_configuration_default.txt input/mg5_configuration.txt
cp Template/LO/Source/.make_opts Template/LO/Source/make_opts
./tests/test_manager.py -p./PLUGIN/CUDACPP_OUTPUT/acceptance_tests/ test_%(name)s
"""

def create_cicd():

text = "# WARNING THIS FILE IS AUTOGENERATED -> edit test_simd_madevent.template\n\n\n"
text += open(pjoin(curr_dir, 'madgraph_launch.template'),'r').read()

for filename in os.listdir(pjoin(curr_dir, 'simple_cross_check')):
text += template_one_cicd % {'name': filename}

GITDIR =pjoin(os.path.realpath(curr_dir), os.path.pardir,os.path.pardir,os.path.pardir,os.path.pardir,os.path.pardir,os.path.pardir)
GITDIR = os.path.realpath(GITDIR)
open(pjoin(GITDIR, '.github', 'workflows', 'madgraph_launch_test.yml'), 'w').write(text)


if __name__ == '__main__':
create_test_simd_madevent()
create_cicd()


Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# This is a basic workflow to help you get started with Actions

name: running acceptance test
# Controls when the workflow will run
# branches: [ main LTS ]
on:
# Triggers the workflow on push or pull request events but only for the 3.4.0 branch
push:
paths-ignore:
- 'docs/**'
# - '.github/**'

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
inputs:
message:
description: 'running acceptance test'
required: true

env:
commitmsg: ${{ github.event.head_commit.message }}

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#title check eemumua in single precision
import model sm
set automatic_html_opening False --no_save
set notification_center False --no_save
generate e+ e- > mu+ mu- a
output madevent_simd %s -f -nojpeg
launch
set nevents 100
set floating_type f
#check run_01 0.0266 0.0002854 100
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#title testing a HEFT process gg>aa in double precision
import model heft
set automatic_html_opening False --no_save
set notification_center False --no_save
generate g g > h > a a
output madevent_simd %s -f -nojpeg
launch
set nevents 100
set floating_type d
#check run_01 0.01859 0.0002853789088650386 100
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#title check ggtt within mixed mode
import model sm
set automatic_html_opening False --no_save
set notification_center False --no_save
generate p p > t t~
output madevent_simd %s -f -nojpeg
launch
set nevents 100
set floating_type m
#check run_01 505.5 2.749 100
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#title: check that multiple vector size returns the same value
import model sm
set automatic_html_opening False --no_save
set notification_center False --no_save
generate p p > t t~
output madevent_simd %s -f -nojpeg
launch
set nevents 100
set floating_type m
set vector_size 16
launch
set vector_size 32
launch
set vector_size 64
#check run_01 505.5 2.749 100
#check run_02 505.5 2.749 100
#check run_03 505.5 2.749 100
Loading

0 comments on commit 2d95c01

Please sign in to comment.