Skip to content

Commit

Permalink
[june24] move to banner.py from the latest upstream/master for easier…
Browse files Browse the repository at this point in the history
… merging (except gg_tt.mad, to inspect it)

git checkout upstream/master $(git ls-tree --name-only upstream/master */bin/internal/banner.py | grep -v ^gg_tt.mad/)
  • Loading branch information
valassi committed Sep 1, 2024
1 parent b15033d commit 289efb9
Show file tree
Hide file tree
Showing 11 changed files with 55 additions and 165 deletions.
20 changes: 5 additions & 15 deletions epochX/cudacpp/ee_mumu.mad/bin/internal/banner.py
Original file line number Diff line number Diff line change
Expand Up @@ -3157,7 +3157,6 @@ def get_value_from_include(self, path, list_of_params, output_dir):
if path does not exists return the current value in self for all parameter"""

#WARNING DOES NOT HANDLE LIST/DICT so far
misc.sprint(output_dir, path)
# handle case where file is missing
if not os.path.exists(pjoin(output_dir,path)):
misc.sprint("include file not existing", pjoin(output_dir,path))
Expand All @@ -3166,13 +3165,9 @@ def get_value_from_include(self, path, list_of_params, output_dir):
with open(pjoin(output_dir,path), 'r') as fsock:
text = fsock.read()

for name in list_of_params:
misc.sprint(name, name in self.fortran_name)
misc.sprint(self.fortran_name[name] if name in self.fortran_name[name] else name)
to_track = [self.fortran_name[name] if name in self.fortran_name else name for name in list_of_params]
pattern = re.compile(r"\(?(%(names)s)\s?=\s?([^)]*)\)?" % {'names':'|'.join(to_track)}, re.I)
out = dict(pattern.findall(text))
misc.sprint(out)
for name in list_of_params:
if name in self.fortran_name:
value = out[self.fortran_name[name]]
Expand Down Expand Up @@ -3483,10 +3478,8 @@ def write_include_file(self, output_dir, output_file=None):
#ensusre that system only parameter are correctly set
self.update_system_parameter_for_include()

if output_dir: #output_dir is set to None in some unittest
value_in_old_include = self.get_last_value_include(output_dir)
else:
value_in_old_include = {}
value_in_old_include = self.get_last_value_include(output_dir)


if output_dir:
self.write_autodef(output_dir, output_file=None)
Expand All @@ -3503,6 +3496,7 @@ def write_include_file(self, output_dir, output_file=None):
def write_one_include_file(self, output_dir, incname, output_file=None):
"""write one include file at the time"""

misc.sprint(incname)
if incname is True:
pathinc = self.default_include_file
elif incname is False:
Expand Down Expand Up @@ -3917,7 +3911,6 @@ def remove_all_cut(self):
%(aloha_flag)s = aloha_flag ! fortran optimization flag for aloha function. Suggestions: '-ffast-math'
%(matrix_flag)s = matrix_flag ! fortran optimization flag for matrix.f function. Suggestions: '-O3'
%(vector_size)s = vector_size ! size of fortran arrays allocated in the multi-event API for SIMD/GPU (VECSIZE_MEMMAX)
%(nb_warp)s = nb_warp ! total number of warp/frontwave
"""

template_off = '# To see advanced option for Phase-Space optimization: type "update psoptim"'
Expand Down Expand Up @@ -4321,10 +4314,7 @@ def default_setup(self):
self.add_param('matrix_flag', '', include=False, hidden=True, comment='fortran compilation flag for the matrix-element files, suggestion -O3',
fct_mod=(self.make_Ptouch, ('matrix'),{}))
self.add_param('vector_size', 1, include='vector.inc', hidden=True, comment='lockstep size for parralelism run',
fortran_name='WARP_SIZE', fct_mod=(self.reset_simd,(),{}))
self.add_param('nb_warp', 1, include='vector.inc', hidden=True, comment='number of warp for parralelism run',
fortran_name='NB_WARP', fct_mod=(self.reset_simd,(),{}))
self.add_param('vecsize_memmax', 0, include='vector.inc', system=True)
fortran_name='VECSIZE_MEMMAX', fct_mod=(self.reset_simd,(),{}))

# parameter allowing to define simple cut via the pdg
# Special syntax are related to those. (can not be edit directly)
Expand Down Expand Up @@ -4615,7 +4605,7 @@ def update_system_parameter_for_include(self):
self['mxxmin4pdg'] =[0.]
self['mxxpart_antipart'] = [False]

self['vecsize_memmax'] = self['nb_warp'] * self['vector_size']

def create_default_for_process(self, proc_characteristic, history, proc_def):
"""Rules
Expand Down
20 changes: 5 additions & 15 deletions epochX/cudacpp/gg_tt01g.mad/bin/internal/banner.py
Original file line number Diff line number Diff line change
Expand Up @@ -3157,7 +3157,6 @@ def get_value_from_include(self, path, list_of_params, output_dir):
if path does not exists return the current value in self for all parameter"""

#WARNING DOES NOT HANDLE LIST/DICT so far
misc.sprint(output_dir, path)
# handle case where file is missing
if not os.path.exists(pjoin(output_dir,path)):
misc.sprint("include file not existing", pjoin(output_dir,path))
Expand All @@ -3166,13 +3165,9 @@ def get_value_from_include(self, path, list_of_params, output_dir):
with open(pjoin(output_dir,path), 'r') as fsock:
text = fsock.read()

for name in list_of_params:
misc.sprint(name, name in self.fortran_name)
misc.sprint(self.fortran_name[name] if name in self.fortran_name[name] else name)
to_track = [self.fortran_name[name] if name in self.fortran_name else name for name in list_of_params]
pattern = re.compile(r"\(?(%(names)s)\s?=\s?([^)]*)\)?" % {'names':'|'.join(to_track)}, re.I)
out = dict(pattern.findall(text))
misc.sprint(out)
for name in list_of_params:
if name in self.fortran_name:
value = out[self.fortran_name[name]]
Expand Down Expand Up @@ -3483,10 +3478,8 @@ def write_include_file(self, output_dir, output_file=None):
#ensusre that system only parameter are correctly set
self.update_system_parameter_for_include()

if output_dir: #output_dir is set to None in some unittest
value_in_old_include = self.get_last_value_include(output_dir)
else:
value_in_old_include = {}
value_in_old_include = self.get_last_value_include(output_dir)


if output_dir:
self.write_autodef(output_dir, output_file=None)
Expand All @@ -3503,6 +3496,7 @@ def write_include_file(self, output_dir, output_file=None):
def write_one_include_file(self, output_dir, incname, output_file=None):
"""write one include file at the time"""

misc.sprint(incname)
if incname is True:
pathinc = self.default_include_file
elif incname is False:
Expand Down Expand Up @@ -3917,7 +3911,6 @@ def remove_all_cut(self):
%(aloha_flag)s = aloha_flag ! fortran optimization flag for aloha function. Suggestions: '-ffast-math'
%(matrix_flag)s = matrix_flag ! fortran optimization flag for matrix.f function. Suggestions: '-O3'
%(vector_size)s = vector_size ! size of fortran arrays allocated in the multi-event API for SIMD/GPU (VECSIZE_MEMMAX)
%(nb_warp)s = nb_warp ! total number of warp/frontwave
"""

template_off = '# To see advanced option for Phase-Space optimization: type "update psoptim"'
Expand Down Expand Up @@ -4321,10 +4314,7 @@ def default_setup(self):
self.add_param('matrix_flag', '', include=False, hidden=True, comment='fortran compilation flag for the matrix-element files, suggestion -O3',
fct_mod=(self.make_Ptouch, ('matrix'),{}))
self.add_param('vector_size', 1, include='vector.inc', hidden=True, comment='lockstep size for parralelism run',
fortran_name='WARP_SIZE', fct_mod=(self.reset_simd,(),{}))
self.add_param('nb_warp', 1, include='vector.inc', hidden=True, comment='number of warp for parralelism run',
fortran_name='NB_WARP', fct_mod=(self.reset_simd,(),{}))
self.add_param('vecsize_memmax', 0, include='vector.inc', system=True)
fortran_name='VECSIZE_MEMMAX', fct_mod=(self.reset_simd,(),{}))

# parameter allowing to define simple cut via the pdg
# Special syntax are related to those. (can not be edit directly)
Expand Down Expand Up @@ -4615,7 +4605,7 @@ def update_system_parameter_for_include(self):
self['mxxmin4pdg'] =[0.]
self['mxxpart_antipart'] = [False]

self['vecsize_memmax'] = self['nb_warp'] * self['vector_size']

def create_default_for_process(self, proc_characteristic, history, proc_def):
"""Rules
Expand Down
20 changes: 5 additions & 15 deletions epochX/cudacpp/gg_ttg.mad/bin/internal/banner.py
Original file line number Diff line number Diff line change
Expand Up @@ -3157,7 +3157,6 @@ def get_value_from_include(self, path, list_of_params, output_dir):
if path does not exists return the current value in self for all parameter"""

#WARNING DOES NOT HANDLE LIST/DICT so far
misc.sprint(output_dir, path)
# handle case where file is missing
if not os.path.exists(pjoin(output_dir,path)):
misc.sprint("include file not existing", pjoin(output_dir,path))
Expand All @@ -3166,13 +3165,9 @@ def get_value_from_include(self, path, list_of_params, output_dir):
with open(pjoin(output_dir,path), 'r') as fsock:
text = fsock.read()

for name in list_of_params:
misc.sprint(name, name in self.fortran_name)
misc.sprint(self.fortran_name[name] if name in self.fortran_name[name] else name)
to_track = [self.fortran_name[name] if name in self.fortran_name else name for name in list_of_params]
pattern = re.compile(r"\(?(%(names)s)\s?=\s?([^)]*)\)?" % {'names':'|'.join(to_track)}, re.I)
out = dict(pattern.findall(text))
misc.sprint(out)
for name in list_of_params:
if name in self.fortran_name:
value = out[self.fortran_name[name]]
Expand Down Expand Up @@ -3483,10 +3478,8 @@ def write_include_file(self, output_dir, output_file=None):
#ensusre that system only parameter are correctly set
self.update_system_parameter_for_include()

if output_dir: #output_dir is set to None in some unittest
value_in_old_include = self.get_last_value_include(output_dir)
else:
value_in_old_include = {}
value_in_old_include = self.get_last_value_include(output_dir)


if output_dir:
self.write_autodef(output_dir, output_file=None)
Expand All @@ -3503,6 +3496,7 @@ def write_include_file(self, output_dir, output_file=None):
def write_one_include_file(self, output_dir, incname, output_file=None):
"""write one include file at the time"""

misc.sprint(incname)
if incname is True:
pathinc = self.default_include_file
elif incname is False:
Expand Down Expand Up @@ -3917,7 +3911,6 @@ def remove_all_cut(self):
%(aloha_flag)s = aloha_flag ! fortran optimization flag for aloha function. Suggestions: '-ffast-math'
%(matrix_flag)s = matrix_flag ! fortran optimization flag for matrix.f function. Suggestions: '-O3'
%(vector_size)s = vector_size ! size of fortran arrays allocated in the multi-event API for SIMD/GPU (VECSIZE_MEMMAX)
%(nb_warp)s = nb_warp ! total number of warp/frontwave
"""

template_off = '# To see advanced option for Phase-Space optimization: type "update psoptim"'
Expand Down Expand Up @@ -4321,10 +4314,7 @@ def default_setup(self):
self.add_param('matrix_flag', '', include=False, hidden=True, comment='fortran compilation flag for the matrix-element files, suggestion -O3',
fct_mod=(self.make_Ptouch, ('matrix'),{}))
self.add_param('vector_size', 1, include='vector.inc', hidden=True, comment='lockstep size for parralelism run',
fortran_name='WARP_SIZE', fct_mod=(self.reset_simd,(),{}))
self.add_param('nb_warp', 1, include='vector.inc', hidden=True, comment='number of warp for parralelism run',
fortran_name='NB_WARP', fct_mod=(self.reset_simd,(),{}))
self.add_param('vecsize_memmax', 0, include='vector.inc', system=True)
fortran_name='VECSIZE_MEMMAX', fct_mod=(self.reset_simd,(),{}))

# parameter allowing to define simple cut via the pdg
# Special syntax are related to those. (can not be edit directly)
Expand Down Expand Up @@ -4615,7 +4605,7 @@ def update_system_parameter_for_include(self):
self['mxxmin4pdg'] =[0.]
self['mxxpart_antipart'] = [False]

self['vecsize_memmax'] = self['nb_warp'] * self['vector_size']

def create_default_for_process(self, proc_characteristic, history, proc_def):
"""Rules
Expand Down
20 changes: 5 additions & 15 deletions epochX/cudacpp/gg_ttgg.mad/bin/internal/banner.py
Original file line number Diff line number Diff line change
Expand Up @@ -3157,7 +3157,6 @@ def get_value_from_include(self, path, list_of_params, output_dir):
if path does not exists return the current value in self for all parameter"""

#WARNING DOES NOT HANDLE LIST/DICT so far
misc.sprint(output_dir, path)
# handle case where file is missing
if not os.path.exists(pjoin(output_dir,path)):
misc.sprint("include file not existing", pjoin(output_dir,path))
Expand All @@ -3166,13 +3165,9 @@ def get_value_from_include(self, path, list_of_params, output_dir):
with open(pjoin(output_dir,path), 'r') as fsock:
text = fsock.read()

for name in list_of_params:
misc.sprint(name, name in self.fortran_name)
misc.sprint(self.fortran_name[name] if name in self.fortran_name[name] else name)
to_track = [self.fortran_name[name] if name in self.fortran_name else name for name in list_of_params]
pattern = re.compile(r"\(?(%(names)s)\s?=\s?([^)]*)\)?" % {'names':'|'.join(to_track)}, re.I)
out = dict(pattern.findall(text))
misc.sprint(out)
for name in list_of_params:
if name in self.fortran_name:
value = out[self.fortran_name[name]]
Expand Down Expand Up @@ -3483,10 +3478,8 @@ def write_include_file(self, output_dir, output_file=None):
#ensusre that system only parameter are correctly set
self.update_system_parameter_for_include()

if output_dir: #output_dir is set to None in some unittest
value_in_old_include = self.get_last_value_include(output_dir)
else:
value_in_old_include = {}
value_in_old_include = self.get_last_value_include(output_dir)


if output_dir:
self.write_autodef(output_dir, output_file=None)
Expand All @@ -3503,6 +3496,7 @@ def write_include_file(self, output_dir, output_file=None):
def write_one_include_file(self, output_dir, incname, output_file=None):
"""write one include file at the time"""

misc.sprint(incname)
if incname is True:
pathinc = self.default_include_file
elif incname is False:
Expand Down Expand Up @@ -3917,7 +3911,6 @@ def remove_all_cut(self):
%(aloha_flag)s = aloha_flag ! fortran optimization flag for aloha function. Suggestions: '-ffast-math'
%(matrix_flag)s = matrix_flag ! fortran optimization flag for matrix.f function. Suggestions: '-O3'
%(vector_size)s = vector_size ! size of fortran arrays allocated in the multi-event API for SIMD/GPU (VECSIZE_MEMMAX)
%(nb_warp)s = nb_warp ! total number of warp/frontwave
"""

template_off = '# To see advanced option for Phase-Space optimization: type "update psoptim"'
Expand Down Expand Up @@ -4321,10 +4314,7 @@ def default_setup(self):
self.add_param('matrix_flag', '', include=False, hidden=True, comment='fortran compilation flag for the matrix-element files, suggestion -O3',
fct_mod=(self.make_Ptouch, ('matrix'),{}))
self.add_param('vector_size', 1, include='vector.inc', hidden=True, comment='lockstep size for parralelism run',
fortran_name='WARP_SIZE', fct_mod=(self.reset_simd,(),{}))
self.add_param('nb_warp', 1, include='vector.inc', hidden=True, comment='number of warp for parralelism run',
fortran_name='NB_WARP', fct_mod=(self.reset_simd,(),{}))
self.add_param('vecsize_memmax', 0, include='vector.inc', system=True)
fortran_name='VECSIZE_MEMMAX', fct_mod=(self.reset_simd,(),{}))

# parameter allowing to define simple cut via the pdg
# Special syntax are related to those. (can not be edit directly)
Expand Down Expand Up @@ -4615,7 +4605,7 @@ def update_system_parameter_for_include(self):
self['mxxmin4pdg'] =[0.]
self['mxxpart_antipart'] = [False]

self['vecsize_memmax'] = self['nb_warp'] * self['vector_size']

def create_default_for_process(self, proc_characteristic, history, proc_def):
"""Rules
Expand Down
20 changes: 5 additions & 15 deletions epochX/cudacpp/gg_ttggg.mad/bin/internal/banner.py
Original file line number Diff line number Diff line change
Expand Up @@ -3157,7 +3157,6 @@ def get_value_from_include(self, path, list_of_params, output_dir):
if path does not exists return the current value in self for all parameter"""

#WARNING DOES NOT HANDLE LIST/DICT so far
misc.sprint(output_dir, path)
# handle case where file is missing
if not os.path.exists(pjoin(output_dir,path)):
misc.sprint("include file not existing", pjoin(output_dir,path))
Expand All @@ -3166,13 +3165,9 @@ def get_value_from_include(self, path, list_of_params, output_dir):
with open(pjoin(output_dir,path), 'r') as fsock:
text = fsock.read()

for name in list_of_params:
misc.sprint(name, name in self.fortran_name)
misc.sprint(self.fortran_name[name] if name in self.fortran_name[name] else name)
to_track = [self.fortran_name[name] if name in self.fortran_name else name for name in list_of_params]
pattern = re.compile(r"\(?(%(names)s)\s?=\s?([^)]*)\)?" % {'names':'|'.join(to_track)}, re.I)
out = dict(pattern.findall(text))
misc.sprint(out)
for name in list_of_params:
if name in self.fortran_name:
value = out[self.fortran_name[name]]
Expand Down Expand Up @@ -3483,10 +3478,8 @@ def write_include_file(self, output_dir, output_file=None):
#ensusre that system only parameter are correctly set
self.update_system_parameter_for_include()

if output_dir: #output_dir is set to None in some unittest
value_in_old_include = self.get_last_value_include(output_dir)
else:
value_in_old_include = {}
value_in_old_include = self.get_last_value_include(output_dir)


if output_dir:
self.write_autodef(output_dir, output_file=None)
Expand All @@ -3503,6 +3496,7 @@ def write_include_file(self, output_dir, output_file=None):
def write_one_include_file(self, output_dir, incname, output_file=None):
"""write one include file at the time"""

misc.sprint(incname)
if incname is True:
pathinc = self.default_include_file
elif incname is False:
Expand Down Expand Up @@ -3917,7 +3911,6 @@ def remove_all_cut(self):
%(aloha_flag)s = aloha_flag ! fortran optimization flag for aloha function. Suggestions: '-ffast-math'
%(matrix_flag)s = matrix_flag ! fortran optimization flag for matrix.f function. Suggestions: '-O3'
%(vector_size)s = vector_size ! size of fortran arrays allocated in the multi-event API for SIMD/GPU (VECSIZE_MEMMAX)
%(nb_warp)s = nb_warp ! total number of warp/frontwave
"""

template_off = '# To see advanced option for Phase-Space optimization: type "update psoptim"'
Expand Down Expand Up @@ -4321,10 +4314,7 @@ def default_setup(self):
self.add_param('matrix_flag', '', include=False, hidden=True, comment='fortran compilation flag for the matrix-element files, suggestion -O3',
fct_mod=(self.make_Ptouch, ('matrix'),{}))
self.add_param('vector_size', 1, include='vector.inc', hidden=True, comment='lockstep size for parralelism run',
fortran_name='WARP_SIZE', fct_mod=(self.reset_simd,(),{}))
self.add_param('nb_warp', 1, include='vector.inc', hidden=True, comment='number of warp for parralelism run',
fortran_name='NB_WARP', fct_mod=(self.reset_simd,(),{}))
self.add_param('vecsize_memmax', 0, include='vector.inc', system=True)
fortran_name='VECSIZE_MEMMAX', fct_mod=(self.reset_simd,(),{}))

# parameter allowing to define simple cut via the pdg
# Special syntax are related to those. (can not be edit directly)
Expand Down Expand Up @@ -4615,7 +4605,7 @@ def update_system_parameter_for_include(self):
self['mxxmin4pdg'] =[0.]
self['mxxpart_antipart'] = [False]

self['vecsize_memmax'] = self['nb_warp'] * self['vector_size']

def create_default_for_process(self, proc_characteristic, history, proc_def):
"""Rules
Expand Down
Loading

0 comments on commit 289efb9

Please sign in to comment.