Skip to content

Commit

Permalink
add the option to choose the floating_point interface from the run_ca…
Browse files Browse the repository at this point in the history
…rd (via make_opts)
  • Loading branch information
oliviermattelaer committed Nov 3, 2023
1 parent 00dbc53 commit 114a816
Showing 1 changed file with 29 additions and 4 deletions.
33 changes: 29 additions & 4 deletions epochX/cudacpp/CODEGEN/PLUGIN/CUDACPP_SA_OUTPUT/launch_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,13 @@
import internal.misc as misc
import internal.extended_cmd as extended_cmd
import internal.banner as banner_mod
import internal.common_run_interface as common_run_interface
else:
import madgraph.interface.madevent_interface as madevent_interface
import madgraph.various.misc as misc
import madgraph.interface.extended_cmd as extended_cmd
import madgraph.various.banner as banner_mod
import madgraph.interface.common_run_interface as common_run_interface

class CPPMEInterface(madevent_interface.MadEventCmdShell):

Expand All @@ -31,7 +33,12 @@ def compile(self, *args, **opts):
import pathlib
import os
pjoin = os.path.join

if 'cwd' in opts:
path = pjoin(opts['cwd'], os.pardir, os.pardir, 'Source', 'make_opts')
common_run_interface.CommonRunCmd.update_make_opts_full(
path,
{'FPTYPE': self.run_card['floating_type']})




Expand Down Expand Up @@ -61,13 +68,29 @@ def reset_simd(self, old_value, new_value, name):

Sourcedir = pjoin(os.path.dirname(os.path.dirname(self.path)), 'Source')
subprocess.call(['make', 'cleanavx'], cwd=Sourcedir, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)


def reset_makeopts(self, old_value, new_value, name):

misc.sprint("PASS IN RESET MAKEOPTS", old_value, new_value, name)
if not hasattr(self, 'path'):
raise Exception

if name == 'floating_type':
common_run_interface.CommonRunCmd.update_make_opts_full({'FPTYPE': new_value})
else:
raise Exception

Sourcedir = pjoin(os.path.dirname(os.path.dirname(self.path)), 'Source')
subprocess.call(['make', 'cleanavx'], cwd=Sourcedir, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)

def plugin_input(self, finput):
return

def default_setup(self):
super().default_setup()
self.add_param('cudacpp_backend', 'CPP', include=False, hidden=False)
self.add_param('floating_type', 'd', include=False, hidden=False,
fct_mod=(self.reset_makeopts,(),{}))


def write_one_include_file(self, output_dir, incname, output_file=None):
Expand All @@ -89,12 +112,14 @@ def check_validity(self):

if self['hel_recycling']:
self['hel_recycling'] = False

class GPURunCard(CPPRunCard):

def default_setup(self):
super(CPPRunCard, self).default_setup()
self.add_param('cudacpp_backend', 'CUDA', include=False, hidden=False)

self.add_param('floating_type', 'd', include=False, hidden=False)


MEINTERFACE = CPPMEInterface
RunCard = CPPRunCard

0 comments on commit 114a816

Please sign in to comment.