Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove add_input_for_banner from output.py (plugin_run_card is not needed in cudacpp) #1016

Merged
merged 9 commits into from
Oct 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[submodule "MG5aMC/mg5amcnlo"]
path = MG5aMC/mg5amcnlo
url = https://github.com/mg5amcnlo/mg5amcnlo
branch = gpucpp
branch = 3.6.1
# See https://git-scm.com/docs/gitmodules#Documentation/gitmodules.txt-submoduleltnamegtignore
ignore = untracked
4 changes: 3 additions & 1 deletion epochX/cudacpp/CODEGEN/PLUGIN/CUDACPP_SA_OUTPUT/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ The format is loosely based on [Keep a Changelog](https://keepachangelog.com).

--------------------------------------------------------------------------------

## [Unreleased] - 2024-10-03
## [Unreleased] - 2024-10-05

### Changed

Expand All @@ -19,6 +19,7 @@ The format is loosely based on [Keep a Changelog](https://keepachangelog.com).

- Infrastructure issues
- AV ([#1013]) Fix release scripts to create 'v1.00.01' tags from a '(1,0,1)' python tuple.
- AV ([#1015]) Remove add_input_for_banner from output.py (plugin_run_card is not needed in cudacpp).

--------------------------------------------------------------------------------

Expand Down Expand Up @@ -61,3 +62,4 @@ The format is loosely based on [Keep a Changelog](https://keepachangelog.com).
[#993]: https://github.com/madgraph5/madgraph4gpu/issues/993
[#1011]: https://github.com/madgraph5/madgraph4gpu/issues/1011
[#1013]: https://github.com/madgraph5/madgraph4gpu/issues/1013
[#1015]: https://github.com/madgraph5/madgraph4gpu/issues/1015
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
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 1124a9164..27a6e4674 100644
index af6d02998..ec5722702 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
@@ -76,7 +76,15 @@ c common/to_colstats/ncols,ncolflow,ncolalt,ic

include 'coupl.inc' ! needs VECSIZE_MEMMAX (defined in vector.inc)
INTEGER VECSIZE_USED
Expand All @@ -19,10 +19,10 @@ index 1124a9164..27a6e4674 100644

C-----
C BEGIN CODE
C-----
@@ -84,6 +92,61 @@ C-----
call cpu_time(t_before)
CUMULATED_TIMING = t_before
+
+#ifdef _OPENMP
+ CALL OMPNUMTHREADS_NOT_SET_MEANS_ONE_THREAD()
+#endif
Expand Down Expand Up @@ -81,13 +81,13 @@ index 1124a9164..27a6e4674 100644
c
c Read process number
c
@@ -208,8 +272,33 @@ c call sample_result(xsec,xerr)
@@ -217,9 +280,33 @@ c call sample_result(xsec,xerr)
c write(*,*) 'Final xsec: ',xsec

rewind(lun)
-
close(lun)
+
+#ifdef MG5AMC_MEEXPORTER_CUDACPP
+ CALL FBRIDGEDELETE(FBRIDGE_PBRIDGE) ! this must be at the end as it shuts down the CUDA device
+ IF( FBRIDGE_MODE .LE. -1 ) THEN ! (BothQuiet=-1 or BothDebug=-2)
Expand Down Expand Up @@ -116,7 +116,7 @@ index 1124a9164..27a6e4674 100644
end

c $B$ get_user_params $B$ ! tag for MadWeight
@@ -387,7 +476,7 @@ c
@@ -402,7 +489,7 @@ c
fopened=.false.
tempname=filename
fine=index(tempname,' ')
Expand All @@ -126,7 +126,7 @@ index 1124a9164..27a6e4674 100644
open(unit=lun,file=tempname,status='old',ERR=20)
fopened=.true.
diff --git b/epochX/cudacpp/gg_tt.mad/SubProcesses/P1_gg_ttx/matrix1.f a/epochX/cudacpp/gg_tt.mad/SubProcesses/P1_gg_ttx/matrix1.f
index 1acba8200..069c74ef4 100644
index bf488e4b0..707ea4032 100644
--- b/epochX/cudacpp/gg_tt.mad/SubProcesses/P1_gg_ttx/matrix1.f
+++ a/epochX/cudacpp/gg_tt.mad/SubProcesses/P1_gg_ttx/matrix1.f
@@ -71,7 +71,10 @@ C
Expand All @@ -141,7 +141,7 @@ index 1acba8200..069c74ef4 100644
C
C This is just to temporarily store the reference grid for
C helicity of the DiscreteSampler so as to obtain its number of
@@ -211,6 +214,17 @@ C ----------
@@ -224,6 +227,17 @@ C update.
ENDIF
IF(NTRY(1).EQ.MAXTRIES)THEN
ISHEL=MIN(ISUM_HEL,NGOOD)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,6 @@ def reset_makeopts(self, old_value, new_value, name):
Sourcedir = pjoin(os.path.dirname(os.path.dirname(self.path)), 'Source')
subprocess.call(['make', 'cleanall'], cwd=Sourcedir, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)

def plugin_input(self, finput):
return

def default_setup(self):
super().default_setup()
self.add_param('floating_type', 'm', include=False, hidden=True,
Expand Down
9 changes: 0 additions & 9 deletions epochX/cudacpp/CODEGEN/PLUGIN/CUDACPP_SA_OUTPUT/output.py
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,6 @@ def finalize(self, matrix_element, cmdhistory, MG5options, outputflag):
outputflags is a list of options provided when doing the output command"""
###misc.sprint('Entering PLUGIN_ProcessExporter.finalize', self.in_madevent_mode, type(self))
if self.in_madevent_mode:
self.add_input_for_banner()
if 'CUDACPP_CODEGEN_PATCHLEVEL' in os.environ: patchlevel = os.environ['CUDACPP_CODEGEN_PATCHLEVEL']
else: patchlevel = ''
# OLDEST implementation (AV)
Expand Down Expand Up @@ -282,14 +281,6 @@ def modify_grouping(self, matrix_element):
misc.sprint('Entering PLUGIN_ProcessExporter.modify_grouping')
return False, matrix_element

# OM additional fixes for madevent+cudacpp mode
def add_input_for_banner(self):
# Note: this is only called in madevent mode (self.in_madevent_mode = True)
new_parameters = ["{'name':'cudacpp_backend', 'value':'CPP', 'include':False, 'hidden':False}"]
finput = open(pjoin(self.dir_path, 'bin', 'internal', 'plugin_run_card'), 'w')
for entry in new_parameters:
finput.write(entry)

# OM adding a new way to "patch" python file such that the launch command of MG5aMC is working
# this consist in a file plugin_interface.py
# which contains a series of functions and one dictionary variable TO_OVERWRITE
Expand Down
20 changes: 8 additions & 12 deletions epochX/cudacpp/ee_mumu.mad/CODEGEN_mad_ee_mumu_log.txt
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ generate e+ e- > mu+ mu-
No model currently active, so we import the Standard Model
INFO: load particles
INFO: load vertices
DEBUG: model prefixing takes 0.006434440612792969 
DEBUG: model prefixing takes 0.006119966506958008 
INFO: Restrict model sm with file models/sm/restrict_default.dat .
DEBUG: Simplifying conditional expressions 
DEBUG: remove interactions: u s w+ at order: QED=1 
Expand Down Expand Up @@ -181,18 +181,17 @@ INFO: Finding symmetric diagrams for subprocess group epem_mupmum
DEBUG: diag_to_iconfig =  {1: 1, 2: 2} [model_handling.py at line 1552] 
Generated helas calls for 1 subprocesses (2 diagrams) in 0.004 s
Wrote files for 8 helas calls in 0.069 s
DEBUG: self.vector_size =  32 [export_v4.py at line 7023] 
ALOHA: aloha starts to compute helicity amplitudes
ALOHA: aloha creates FFV1 routines
ALOHA: aloha creates FFV2 routines
ALOHA: aloha creates FFV4 routines
ALOHA: aloha creates 3 routines in 0.201 s
ALOHA: aloha creates 3 routines in 0.202 s
ALOHA: aloha starts to compute helicity amplitudes
ALOHA: aloha creates FFV1 routines
ALOHA: aloha creates FFV2 routines
ALOHA: aloha creates FFV4 routines
ALOHA: aloha creates FFV2_4 routines
ALOHA: aloha creates 7 routines in 0.255 s
ALOHA: aloha creates 7 routines in 0.257 s
<class 'aloha.create_aloha.AbstractRoutine'> FFV1
<class 'aloha.create_aloha.AbstractRoutine'> FFV1
<class 'aloha.create_aloha.AbstractRoutine'> FFV2
Expand Down Expand Up @@ -220,21 +219,18 @@ DEBUG: cd /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_ee_mumu
patching file SubProcesses/makefile
DEBUG: cd /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_ee_mumu/SubProcesses/P1_epem_mupmum; patch -p6 -i /data/avalassi/GPU2023/madgraph4gpuX/epochX/cudacpp/CODEGEN/PLUGIN/CUDACPP_SA_OUTPUT/MG5aMC_patches/PROD/patch.P1
patching file driver.f
Hunk #1 succeeded at 76 (offset 2 lines).
Hunk #2 succeeded at 280 (offset 8 lines).
Hunk #3 succeeded at 489 (offset 13 lines).
patching file matrix1.f
Hunk #2 succeeded at 236 (offset 22 lines).
DEBUG: p.returncode =  0 [output.py at line 264] 
Hunk #2 succeeded at 236 (offset 9 lines).
DEBUG: p.returncode =  0 [output.py at line 263] 
Output to directory /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_ee_mumu done.
Type "launch" to generate events from this process, or see
/data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_ee_mumu/README
Run "open index.html" to see more information about this process.
quit

real 0m2.097s
user 0m1.775s
sys 0m0.272s
real 0m2.379s
user 0m1.796s
sys 0m0.241s
Code generation completed in 2 seconds
************************************************************
* *
Expand Down
2 changes: 1 addition & 1 deletion epochX/cudacpp/ee_mumu.mad/Cards/param_card.dat
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ Block mass
Block sminputs
1 1.325070e+02 # aEWM1
2 1.166390e-05 # Gf
3 1.180000e-01 # aS (Note that Parameter not used if you use a PDF set)
3 1.180000e-01 # aS (Note: this Parameter is not used if you use a PDF set)

###################################
## INFORMATION FOR YUKAWA
Expand Down
2 changes: 1 addition & 1 deletion epochX/cudacpp/ee_mumu.mad/Cards/param_card_default.dat
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ Block mass
Block sminputs
1 1.325070e+02 # aEWM1
2 1.166390e-05 # Gf
3 1.180000e-01 # aS (Note that Parameter not used if you use a PDF set)
3 1.180000e-01 # aS (Note: this Parameter is not used if you use a PDF set)

###################################
## INFORMATION FOR YUKAWA
Expand Down
28 changes: 0 additions & 28 deletions epochX/cudacpp/ee_mumu.mad/bin/internal/banner.py
Original file line number Diff line number Diff line change
Expand Up @@ -1006,18 +1006,10 @@ def __init__(self, finput=None, **opt):
self.allowed_value = {}

self.default_setup()
self.plugin_input(finput)


# if input is define read that input
if isinstance(finput, (file, str, StringIO.StringIO)):
self.read(finput, **opt)




def plugin_input(self, finput=None):
pass


def default_setup(self):
Expand Down Expand Up @@ -2654,26 +2646,6 @@ class RunCard(ConfigFile):
donewarning = []
include_as_parameter = []

def plugin_input(self, finput):

if not finput and not MADEVENT:
return
curr_dir = None
if isinstance(finput, file):
# expected path to be like "XXXX/Cards/run_card.dat"
curr_dir = os.path.dirname(os.path.dirname(finput.name))
elif isinstance(finput, str):
curr_dir = os.path.dirname(os.path.dirname(finput))

if curr_dir:
if os.path.exists(pjoin(curr_dir, 'bin', 'internal', 'plugin_run_card')):
# expected format {} passing everything as optional argument
for line in open(pjoin(curr_dir, 'bin', 'internal', 'plugin_run_card')):
if line.startswith('#'):
continue
opts = dict(eval(line))
self.add_param(**opts)

@classmethod
def fill_post_set_from_blocks(cls):
"""set the post_set function for any parameter defined in a run_block"""
Expand Down
3 changes: 0 additions & 3 deletions epochX/cudacpp/ee_mumu.mad/bin/internal/launch_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,6 @@ def reset_makeopts(self, old_value, new_value, name):
Sourcedir = pjoin(os.path.dirname(os.path.dirname(self.path)), 'Source')
subprocess.call(['make', 'cleanall'], cwd=Sourcedir, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)

def plugin_input(self, finput):
return

def default_setup(self):
super().default_setup()
self.add_param('floating_type', 'm', include=False, hidden=True,
Expand Down
18 changes: 12 additions & 6 deletions epochX/cudacpp/ee_mumu.mad/bin/internal/madevent_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -2959,6 +2959,7 @@ def update_width_in_param_card(decay_info, initial=None, output=None):
param_card_file.close()

decay_lines = []
comment = collections.defaultdict(str)
line_number = 0
# Read and remove all decays from the param_card
while line_number < len(param_card):
Expand All @@ -2968,6 +2969,7 @@ def update_width_in_param_card(decay_info, initial=None, output=None):
# DECAY 6 1.455100e+00
line = param_card.pop(line_number)
line = line.split()
comment[int(line[1])] = ' '.join(line).split('#',1)[1] if '#' in line else ''
particle = 0
if int(line[1]) not in decay_info:
try: # If formatting is wrong, don't want this particle
Expand Down Expand Up @@ -3013,7 +3015,7 @@ def update_width_in_param_card(decay_info, initial=None, output=None):
for key in sorted(decay_info.keys()):
width = sum([r for p,r in decay_info[key]])
param_card.append("#\n# PDG Width")
param_card.append("DECAY %i %e" % (key, width.real))
param_card.append("DECAY %i %e # %s" % (key, width.real, comment[int(key)]))
if not width:
continue
if decay_info[key][0][0]:
Expand Down Expand Up @@ -6883,11 +6885,15 @@ def launch(self, nb_event, seed):
self.exec_cmd('systematics %s --from_card' % self.run_name,
postcmd=False,printcmd=False)
self.exec_cmd('decay_events -from_cards', postcmd=False)
elif self.run_card['use_syst'] and self.run_card['systematics_program'] == 'systematics':
self.options['nb_core'] = 1
self.exec_cmd('systematics %s --from_card' %
pjoin('Events', self.run_name, 'unweighted_events.lhe.gz'),
postcmd=False,printcmd=False)
if self.run_card['time_of_flight']>=0:
self.exec_cmd("add_time_of_flight --threshold=%s" % self.run_card['time_of_flight'] ,postcmd=False)
else:
path = pjoin('Events', self.run_name, 'unweighted_events.lhe.gz')
if self.run_card['use_syst'] and self.run_card['systematics_program'] == 'systematics':
self.options['nb_core'] = 1
self.exec_cmd('systematics %s --from_card' % path, postcmd=False, printcmd=False)
if self.run_card['time_of_flight']>=0:
self.exec_cmd("add_time_of_flight %s --threshold=%s" % (path, self.run_card['time_of_flight']) ,postcmd=False)


def refine4grid(self, nb_event):
Expand Down
1 change: 0 additions & 1 deletion epochX/cudacpp/ee_mumu.mad/bin/internal/plugin_run_card

This file was deleted.

12 changes: 6 additions & 6 deletions epochX/cudacpp/ee_mumu.sa/CODEGEN_cudacpp_ee_mumu_log.txt
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ generate e+ e- > mu+ mu-
No model currently active, so we import the Standard Model
INFO: load particles
INFO: load vertices
DEBUG: model prefixing takes 0.0062215328216552734 
DEBUG: model prefixing takes 0.006151437759399414 
INFO: Restrict model sm with file models/sm/restrict_default.dat .
DEBUG: Simplifying conditional expressions 
DEBUG: remove interactions: u s w+ at order: QED=1 
Expand Down Expand Up @@ -175,7 +175,7 @@ ALOHA: aloha creates FFV1 routines
ALOHA: aloha creates FFV2 routines
ALOHA: aloha creates FFV4 routines
ALOHA: aloha creates FFV2_4 routines
ALOHA: aloha creates 4 routines in 0.267 s
ALOHA: aloha creates 4 routines in 0.266 s
<class 'aloha.create_aloha.AbstractRoutine'> FFV1
<class 'aloha.create_aloha.AbstractRoutine'> FFV1
<class 'aloha.create_aloha.AbstractRoutine'> FFV2
Expand All @@ -194,7 +194,7 @@ INFO: Created files Parameters_sm.h and Parameters_sm.cc in directory
INFO: /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_cudacpp_ee_mumu/src/. and /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_cudacpp_ee_mumu/src/.
quit

real 0m0.781s
user 0m0.590s
sys 0m0.053s
Code generation completed in 1 seconds
real 0m0.661s
user 0m0.583s
sys 0m0.061s
Code generation completed in 0 seconds
2 changes: 1 addition & 1 deletion epochX/cudacpp/ee_mumu.sa/Cards/param_card.dat
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ Block mass
Block sminputs
1 1.325070e+02 # aEWM1
2 1.166390e-05 # Gf
3 1.180000e-01 # aS (Note that Parameter not used if you use a PDF set)
3 1.180000e-01 # aS (Note: this Parameter is not used if you use a PDF set)

###################################
## INFORMATION FOR YUKAWA
Expand Down
Loading
Loading