From c1509dce1522a629df56d3023cfc48953e8c80bb Mon Sep 17 00:00:00 2001 From: Andrea Valassi Date: Tue, 8 Oct 2024 09:53:07 +0200 Subject: [PATCH] in export_v4.py and madevent_driver.f, allow adding extra header/initialise/finalise to driver.f (for cudacpp) --- madgraph/iolibs/export_v4.py | 4 ++++ madgraph/iolibs/template_files/madevent_driver.f | 4 +++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/madgraph/iolibs/export_v4.py b/madgraph/iolibs/export_v4.py index d4b7d58a74..a9e7fe755c 100755 --- a/madgraph/iolibs/export_v4.py +++ b/madgraph/iolibs/export_v4.py @@ -6042,6 +6042,10 @@ def write_driver(self, writer, ncomb, n_grouped_proc, v5=True): else: replace_dict['secondparam']='' + replace_dict['DRIVER_EXTRA_HEADER'] = "" + replace_dict['DRIVER_EXTRA_INITIALISE'] = "" + replace_dict['DRIVER_EXTRA_FINALISE'] = "" + if writer: text = open(path).read() % replace_dict writer.write(text) diff --git a/madgraph/iolibs/template_files/madevent_driver.f b/madgraph/iolibs/template_files/madevent_driver.f index 6d30751420..e34e97b13d 100644 --- a/madgraph/iolibs/template_files/madevent_driver.f +++ b/madgraph/iolibs/template_files/madevent_driver.f @@ -77,12 +77,13 @@ Program DRIVER include 'coupl.inc' ! needs VECSIZE_MEMMAX (defined in vector.inc) INTEGER VECSIZE_USED DATA VECSIZE_USED/VECSIZE_MEMMAX/ ! can be changed at runtime - +%(DRIVER_EXTRA_HEADER)s C----- C BEGIN CODE C----- call cpu_time(t_before) CUMULATED_TIMING = t_before +%(DRIVER_EXTRA_INITIALISE)s c c Read process number c @@ -218,6 +219,7 @@ Program DRIVER rewind(lun) close(lun) +%(DRIVER_EXTRA_FINALISE)s end c $B$ get_user_params $B$ ! tag for MadWeight