From ddf5c7b58bf2044fe5ad1a25c3628d81e75ec9c6 Mon Sep 17 00:00:00 2001 From: Olivier Mattelaer Date: Fri, 7 Jun 2024 12:03:17 +0200 Subject: [PATCH] add file for the test-suite of MG5aMC and a ci related to it --- .github/workflows/madgraph_launch_test.yml | 53 ++++++++ .../acceptance_tests/test_simd_madevent.py | 114 ++++++++++++++++++ 2 files changed, 167 insertions(+) create mode 100644 .github/workflows/madgraph_launch_test.yml create mode 100755 epochX/cudacpp/CODEGEN/PLUGIN/CUDACPP_SA_OUTPUT/acceptance_tests/test_simd_madevent.py diff --git a/.github/workflows/madgraph_launch_test.yml b/.github/workflows/madgraph_launch_test.yml new file mode 100644 index 0000000000..63f72c9c65 --- /dev/null +++ b/.github/workflows/madgraph_launch_test.yml @@ -0,0 +1,53 @@ +# 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_GG_TT_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_ggtt_mixed + + + diff --git a/epochX/cudacpp/CODEGEN/PLUGIN/CUDACPP_SA_OUTPUT/acceptance_tests/test_simd_madevent.py b/epochX/cudacpp/CODEGEN/PLUGIN/CUDACPP_SA_OUTPUT/acceptance_tests/test_simd_madevent.py new file mode 100755 index 0000000000..4ba01f93e7 --- /dev/null +++ b/epochX/cudacpp/CODEGEN/PLUGIN/CUDACPP_SA_OUTPUT/acceptance_tests/test_simd_madevent.py @@ -0,0 +1,114 @@ +################################################################################ +# +# Copyright (c) 2009 The MadGraph5_aMC@NLO Development team and Contributors +# +# This file is a part of the MadGraph5_aMC@NLO project, an application which +# automatically generates Feynman diagrams and matrix elements for arbitrary +# high-energy processes in the Standard Model and beyond. +# +# It is subject to the MadGraph5_aMC@NLO license which should accompany this +# distribution. +# +# For more information, visit madgraph.phys.ucl.ac.be and amcatnlo.web.cern.ch +# +################################################################################ +from __future__ import division +from __future__ import absolute_import +import subprocess +import unittest +import os +import re +import shutil +import sys +import logging +import time +import tempfile +import math +import madgraph + + +logger = logging.getLogger('test_cmd') + +import tests.unit_tests.iolibs.test_file_writers as test_file_writers + +import madgraph.interface.master_interface as MGCmd +import madgraph.interface.madevent_interface as MECmd +import madgraph.interface.launch_ext_program as launch_ext +import madgraph.iolibs.files as files + +import madgraph.various.misc as misc +import madgraph.various.lhe_parser as lhe_parser +import madgraph.various.banner as banner_mod +import madgraph.various.lhe_parser as lhe_parser +import madgraph.various.banner as banner + +_file_path = os.path.split(os.path.dirname(os.path.realpath(__file__)))[0] +_pickle_path =os.path.join(_file_path, 'input_files') + +from madgraph import MG4DIR, MG5DIR, MadGraph5Error, InvalidCmd + +from tests.acceptance_tests.test_cmd_madevent import * + +pjoin = os.path.join + + +#=============================================================================== +# TestCmd +#=============================================================================== +class TestCPPfromfile(TestMEfromfile): # inherit from upstream test_cmd_madevent + """test that we can launch everything from a single file""" + + + + def test_ggtt_mixed(self): + """checking time of flight is working fine""" + + 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 = """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 + """ %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) + + self.check_parton_output(cross=505.5, error=2.749) + event = '%s/Events/run_01/unweighted_events.lhe' % self.run_dir + if not os.path.exists(event): + misc.gunzip(event) + + has_zero = False + has_non_zero = False + lhefile = lhe_parser.EventFile(event) + lhefile.apply_fct_on_event(fcts=lhe_parser.Event.check) + + nb_event = 0 + for event in lhe_parser.EventFile(event): + event.check() + nb_event+=1 + + self.assertEqual(nb_event, 100) + + self.assertFalse(self.debuging) + +