@@ -130,13 +130,13 @@ def copy_template(self, model):
130130 super ().copy_template (model )
131131
132132 # AV - add debug printouts (in addition to the default one from OM's tutorial)
133- def generate_subprocess_directory (self , subproc_group , fortran_model , me = None ):
133+ def generate_subprocess_directory (self , matrix_element , cpp_helas_call_writer , proc_number = None ):
134134 misc .sprint ('Entering ProcessExporterMadMatrix.generate_subprocess_directory (create the directory)' )
135- misc .sprint (' type(subproc_group )=%s' % type (subproc_group )) # e.g. madgraph.core.helas_objects.HelasMatrixElement
136- misc .sprint (' type(fortran_model )=%s' % type (fortran_model )) # e.g. madgraph.iolibs.helas_call_writers.GPUFOHelasCallWriter
137- misc .sprint (' type(me )=%s me=%s' % (type (me ) if me is not None else None , me )) # e.g. int
135+ misc .sprint (' type(matrix_element )=%s' % type (matrix_element )) # e.g. madgraph.core.helas_objects.HelasMatrixElement
136+ misc .sprint (' type(cpp_helas_call_writer )=%s' % type (cpp_helas_call_writer )) # e.g. madgraph.iolibs.helas_call_writers.GPUFOHelasCallWriter
137+ misc .sprint (' type(proc_number )=%s me=%s' % (type (proc_number ) if proc_number is not None else None , proc_number )) # e.g. int
138138 misc .sprint ("need to link" , self .to_link_in_P )
139- out = super ().generate_subprocess_directory (subproc_group , fortran_model , me )
139+ out = super ().generate_subprocess_directory (matrix_element , cpp_helas_call_writer , proc_number )
140140 return out
141141
142142 # AV (default from OM's tutorial) - add a debug printout
@@ -146,55 +146,6 @@ def convert_model(self, model, wanted_lorentz=[], wanted_couplings=[]):
146146 del model .cudacpp_wanted_ordered_couplings
147147 return super ().convert_model (model , wanted_lorentz , wanted_couplings )
148148
149- # AV (default from OM's tutorial) - add a debug printout
150- def finalize (self , matrix_element , cmdhistory , MG5options , outputflag ):
151- """Typically creating jpeg/HTML output/ compilation/...
152- cmdhistory is the list of command used so far.
153- MG5options are all the options of the main interface
154- outputflags is a list of options provided when doing the output command"""
155- ###misc.sprint('Entering ProcessExporterMadMatrix.finalize', self.in_madevent_mode, type(self))
156- if self .in_madevent_mode :
157- # Modify makefiles and symlinks to avoid doing
158- # make -f makefile -f cudacpp_overlay.mk to include the overlay
159- # and instead just use `make`, see #1052
160- subprocesses_dir = pjoin (self .dir_path , "SubProcesses" )
161- files .cp (pjoin (subprocesses_dir , "makefile" ), pjoin (subprocesses_dir , "makefile_original.mk" ))
162- files .rm (pjoin (subprocesses_dir , "makefile" ))
163- files .ln (pjoin (subprocesses_dir , "makefile_wrapper.mk" ), subprocesses_dir , 'makefile' )
164-
165- patch_coupl_write = r"""set -euo pipefail
166- # Get last fields from lines starting with WRITE(*,2)
167- gcs=$(awk '$1=="WRITE(*,2)" {print $NF}' coupl_write.inc)
168-
169- for gc in $gcs; do
170- if grep -q "$gc(VECSIZE_MEMMAX)" coupl.inc; then
171- awk -v gc="$gc" '{
172- if ($1=="WRITE(*,2)" && $NF==gc) print $0"(1)";
173- else print
174- }' coupl_write.inc > coupl_write.inc.new
175- mv coupl_write.inc.new coupl_write.inc
176- fi
177- done"""
178- try :
179- result = subprocess .run (
180- ["bash" , "-c" , patch_coupl_write ],
181- cwd = pjoin (self .dir_path , "Source" , "MODEL" ),
182- text = True ,
183- capture_output = True ,
184- check = True , # raise CalledProcessError on non-zero exit
185- )
186- misc .sprint (result .returncode )
187- except subprocess .CalledProcessError as e :
188- logger .debug ("####### \n stdout is \n %s" , e .stdout )
189- logger .info ("####### \n stderr is \n %s" , e .stderr )
190- logger .info ("return code is %s\n " , e .returncode )
191- raise Exception ("ERROR while patching coupl_write.inc" ) from e
192-
193- # Additional patching (OM)
194- self .add_madevent_plugin_fct () # Added by OM
195- # do not call standard finalize since is this is already done...
196- #return super().finalize(matrix_element, cmdhistory, MG5options, outputflag)
197-
198149 # AV (default from OM's tutorial) - overload settings and add a debug printout
199150 def modify_grouping (self , matrix_element ):
200151 """allow to modify the grouping (if grouping is in place)
@@ -204,18 +155,3 @@ def modify_grouping(self, matrix_element):
204155 # Irrelevant here since group_mode=False so this function is never called
205156 misc .sprint ('Entering ProcessExporterMadMatrix.modify_grouping' )
206157 return False , matrix_element
207-
208- # OM adding a new way to "patch" python file such that the launch command of MG5aMC is working
209- # this consist in a file plugin_interface.py
210- # which contains a series of functions and one dictionary variable TO_OVERWRITE
211- # that will be used to have temporary overwrite of all the key variable passed as string by their value.
212- # all variable that are file related should be called as madgraph.dir.file.variable
213- def add_madevent_plugin_fct (self ):
214- """this consist in a file plugin_interface.py
215- which contains a series of functions and one dictionary variable TO_OVERWRITE
216- that will be used to have temporary overwrite of all the key variable passed as string by their value.
217- all variable that are file related should be called as madgraph.dir.file.variable
218- """
219- plugin_path = os .path .dirname (os .path .realpath ( __file__ ))
220- files .cp (pjoin (plugin_path , 'launch_plugin.py' ), pjoin (self .dir_path , 'bin' , 'internal' ))
221- files .ln (pjoin (self .dir_path , 'lib' ), pjoin (self .dir_path , 'SubProcesses' ))
0 commit comments