Skip to content

Commit

Permalink
WIP WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
valassi committed Apr 26, 2023
1 parent 1d6d572 commit 53811de
Show file tree
Hide file tree
Showing 5 changed files with 54 additions and 46 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,9 @@
// Hardcoded parameters for this process (constant class variables)
// [NB: this class assumes nprocesses==1 i.e. a single DSIG1 and no DSIG2 in Fortran (#272 and #343)]
// [NB: these parameters (e.g. nwf) are P1-specific, i.e. they are different for different P1 subdirectories (#644)]
static const int nwf = %(nwavefunc)d; // #wavefunctions = #external (npar) + #internal: e.g. 5 for e+ e- -> mu+ mu- (1 internal is gamma or Z)

// Other variables of this instance (???)
//static const int ninitial = mgOnGpu::npari;
//static const int nexternal = %(nexternal)d; // mgOnGpu::npar (nexternal was nioparticles)
//static const int nwavefuncs = %(nwavefuncs)d; // (?!?! this is not nwf: nwavefuncs vs nwavefunc in python code ?!?!)
//static const int nwavefuncs = %(nwavefuncs)d; // (?!?! this is the wrong value of nwf, nwavefuncs vs nwavefunc in python code, see #644)
//static const int namplitudes = %(namp)d;
//static const int ncomb = %(ncomb)d; // mgOnGpu::ncomb

Expand Down
24 changes: 17 additions & 7 deletions epochX/cudacpp/CODEGEN/PLUGIN/CUDACPP_SA_OUTPUT/model_handling.py
Original file line number Diff line number Diff line change
Expand Up @@ -1037,9 +1037,11 @@ def __init__(self, *args, **kwargs):
def get_process_class_definitions(self, write=True):
replace_dict = super().get_process_class_definitions(write=False)
replace_dict['process_lines'] = replace_dict['process_lines'].replace('\n','\n ')
misc.sprint( replace_dict['nwavefuncs'] ) # NB: this (from export_cpp) is the WRONG value of nwf, e.g. 6 for ggtt (#644)
misc.sprint( self.matrix_elements[0].get_number_of_wavefunctions() ) # NB: this is a different WRONG value of nwf, e.g. 7 for gg_tt (#644)
replace_dict['nwavefunc'] = self.matrix_elements[0].get_number_of_wavefunctions() # how do I get HERE the right value of nwf, e.g. 5 for gg_tt? (#644)
###misc.sprint( replace_dict['nwavefuncs'] ) # NB: this (from export_cpp) is the WRONG value of nwf, e.g. 6 for ggtt! (#644)
###misc.sprint( replace_dict['sizew'] ) # NB: this (from export_cpp) is the WRONG value of nwf, e.g. 7 for ggtt! (#644)
###misc.sprint( len(self.wavefunctions) ) # NB: this is the WRONG value of nwf, e.g. 7 for gg_tt! (#644)
###misc.sprint( self.matrix_elements[0].get_number_of_wavefunctions() ) # NB: this is a different WRONG value of nwf, e.g. 7 for gg_tt! (#644)
###replace_dict['nwavefunc'] = ??? # how do I get HERE the right value of nwf, e.g. 5 for gg_tt? (#644)
file = self.read_template_file(self.process_class_template) % replace_dict # HACK! ignore write=False case
file = '\n'.join( file.split('\n')[8:] ) # skip first 8 lines in process_class.inc (copyright)
return file
Expand Down Expand Up @@ -1140,6 +1142,7 @@ def get_sigmaKin_lines(self, color_amplitudes, write=True):
# AV - modify export_cpp.OneProcessExporterGPU method (fix gCPPProcess.cu)
def get_all_sigmaKin_lines(self, color_amplitudes, class_name):
"""Get sigmaKin_process for all subprocesses for gCPPProcess.cu"""
nwavefunc = self.matrix_elements[0].get_number_of_wavefunctions()
ret_lines = []
if self.single_helicities:
###assert self.include_multi_channel # remove this assert: must handle both cases and produce two different code bases (#473)
Expand Down Expand Up @@ -1192,11 +1195,15 @@ def get_all_sigmaKin_lines(self, color_amplitudes, class_name):
#endif
#endif /* clang-format on */
mgDebug( 0, __FUNCTION__ );
//printf( \"calculate_wavefunctions: ihel=%2d\\n\", ihel );
//printf( \"calculate_wavefunctions: ihel=%%2d\\n\", ihel );
#ifndef __CUDACC__
//printf( \"calculate_wavefunctions: ievt00=%d\\n\", ievt00 );
//printf( \"calculate_wavefunctions: ievt00=%%d\\n\", ievt00 );
#endif
// The variable nwf (which is specific to each P1 subdirectory, #644) is only used here
// It is hardcoded here because various attempts to hardcode it in CPPProcess.h at generation time gave the wrong result...
static const int nwf = %(nwavefunc)d; // #wavefunctions = #external (npar) + #internal: e.g. 5 for e+ e- -> mu+ mu- (1 internal is gamma or Z)
// Local TEMPORARY variables for a subset of Feynman diagrams in the given CUDA event (ievt) or C++ event page (ipagV)
// [NB these variables are reused several times (and re-initialised each time) within the same event or event page]
// ** NB: in other words, amplitudes and wavefunctions still have TRIVIAL ACCESS: there is currently no need
Expand Down Expand Up @@ -1227,7 +1234,7 @@ def get_all_sigmaKin_lines(self, color_amplitudes, class_name):
{ // START LOOP ON IPARITY
#ifndef __CUDACC__
const int ievt0 = ievt00 + iParity * neppV;
#endif""")
#endif"""%{'nwavefunc':nwavefunc})
misc.sprint(type(self.helas_call_writer))
misc.sprint(self.support_multichannel, self.include_multi_channel)
multi_channel = None
Expand All @@ -1245,7 +1252,6 @@ def get_all_sigmaKin_lines(self, color_amplitudes, class_name):
self.couplings2order = self.helas_call_writer.couplings2order
self.params2order = self.helas_call_writer.params2order
misc.sprint( self.matrix_elements[0].get_number_of_wavefunctions() )
self.nwavefuncP1 = self.matrix_elements[0].get_number_of_wavefunctions() # this is the correct P1-specific nwf, now in CPPProcess.h (#644)
ret_lines += helas_calls
else:
ret_lines.extend([self.get_sigmaKin_single_process(i, me) \
Expand Down Expand Up @@ -1281,10 +1287,14 @@ def generate_process_files(self):
if self.matrix_elements[0].get('has_mirror_process'):
self.matrix_elements[0].set('has_mirror_process', False)
self.nprocesses/=2
misc.sprint( self.matrix_elements[0].get_number_of_wavefunctions() ) # NB: this is the WRONG value of nwf, e.g. 7 for gg_tt! (#644)
super(PLUGIN_export_cpp.OneProcessExporterGPU, self).generate_process_files()
misc.sprint( self.matrix_elements[0].get_number_of_wavefunctions() ) # NB: this is the RIGHT value of nwf, e.g. 5 for gg_tt! (#644)
self.edit_CMakeLists()
self.edit_check_sa()
misc.sprint( self.matrix_elements[0].get_number_of_wavefunctions() ) # NB: this is a different WRONG value of nwf, e.g. 7 for gg_tt! (#644)
self.edit_mgonGPU()
misc.sprint( self.matrix_elements[0].get_number_of_wavefunctions() ) # NB: this is a different WRONG value of nwf, e.g. 7 for gg_tt! (#644)
self.edit_processidfile() # AV new file (NB this is Sigma-specific, should not be a symlink to Subprocesses)
if self.include_multi_channel:
self.edit_coloramps() # AV new file (NB this is Sigma-specific, should not be a symlink to Subprocesses)
Expand Down
59 changes: 32 additions & 27 deletions epochX/cudacpp/gg_tt.sa/CODEGEN_cudacpp_gg_tt_log.txt
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ generate g g > t t~
No model currently active, so we import the Standard Model
INFO: load particles
INFO: load vertices
DEBUG: model prefixing takes 0.005867719650268555 
DEBUG: model prefixing takes 0.006296634674072266 
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 @@ -174,37 +174,42 @@ INFO: Processing color information for process: g g > t t~ @1
DEBUG: Entering PLUGIN_OneProcessExporter.__init__ [model_handling.py at line 1027] 
DEBUG: proc_id =  0 [model_handling.py at line 1033] 
INFO: Creating files in directory /data/avalassi/GPU2023/MG5aMC/ghav-mg5amcnlo/CODEGEN_cudacpp_gg_tt/SubProcesses/P1_Sigma_sm_gg_ttx
DEBUG: Entering PLUGIN_OneProcessExporter.generate_process_files [model_handling.py at line 1272] 
DEBUG: self.include_multi_channel is not yet defined: this is standalone_cudacpp mode [model_handling.py at line 1276] 
DEBUG: Entering PLUGIN_OneProcessExporter.generate_process_files [model_handling.py at line 1282] 
DEBUG: self.include_multi_channel is not yet defined: this is standalone_cudacpp mode [model_handling.py at line 1286] 
DEBUG: self.matrix_elements[0].get_number_of_wavefunctions() ) # NB: this is a different WRONG value of nwf, e.g. 7 for gg_tt! (#644 =  7 [model_handling.py at line 1290] 
FileWriter <class 'PLUGIN.CUDACPP_SA_OUTPUT.model_handling.PLUGIN_CPPWriter'> for /data/avalassi/GPU2023/MG5aMC/ghav-mg5amcnlo/CODEGEN_cudacpp_gg_tt/SubProcesses/P1_Sigma_sm_gg_ttx/./CPPProcess.h
DEBUG: Entering PLUGIN_OneProcessExporter.write_process_h_file [model_handling.py at line 1415] 
DEBUG: Entering PLUGIN_OneProcessExporter.write_process_h_file [model_handling.py at line 1429] 
FileWriter <class 'PLUGIN.CUDACPP_SA_OUTPUT.model_handling.PLUGIN_CPPWriter'> for /data/avalassi/GPU2023/MG5aMC/ghav-mg5amcnlo/CODEGEN_cudacpp_gg_tt/SubProcesses/P1_Sigma_sm_gg_ttx/./CPPProcess.cc
DEBUG: Entering PLUGIN_OneProcessExporter.write_process_cc_file [model_handling.py at line 1437] 
DEBUG: Entering PLUGIN_OneProcessExporter.get_sigmaKin_lines [model_handling.py at line 1124] 
DEBUG: self.include_multi_channel =  False [model_handling.py at line 1125] 
DEBUG: self.support_multichannel =  True [model_handling.py at line 1126] 
DEBUG: type(self.helas_call_writer) =  <class 'PLUGIN.CUDACPP_SA_OUTPUT.model_handling.PLUGIN_GPUFOHelasCallWriter'> [model_handling.py at line 1228] 
DEBUG: self.support_multichannel, self.include_multi_channel =  True False [model_handling.py at line 1229] 
DEBUG: multi_channel_map =  None [model_handling.py at line 1616] 
DEBUG: diag_to_config =  {} [model_handling.py at line 1671] 
DEBUG: call =  vxxxxx( momenta,m_pars->%s, cHel[ihel][%d],%+d, w_sv[%d], %d ); [model_handling.py at line 1783] 
DEBUG: ('ZERO', 0, -1, 0, 0) [model_handling.py at line 1784] 
DEBUG: call =  vxxxxx( momenta,m_pars->%s, cHel[ihel][%d],%+d, w_sv[%d], %d ); [model_handling.py at line 1783] 
DEBUG: ('ZERO', 1, -1, 1, 1) [model_handling.py at line 1784] 
DEBUG: Entering PLUGIN_OneProcessExporter.write_process_cc_file [model_handling.py at line 1451] 
DEBUG: Entering PLUGIN_OneProcessExporter.get_sigmaKin_lines [model_handling.py at line 1129] 
DEBUG: self.include_multi_channel =  False [model_handling.py at line 1130] 
DEBUG: self.support_multichannel =  True [model_handling.py at line 1131] 
DEBUG: type(self.helas_call_writer) =  <class 'PLUGIN.CUDACPP_SA_OUTPUT.model_handling.PLUGIN_GPUFOHelasCallWriter'> [model_handling.py at line 1238] 
DEBUG: self.support_multichannel, self.include_multi_channel =  True False [model_handling.py at line 1239] 
DEBUG: multi_channel_map =  None [model_handling.py at line 1630] 
DEBUG: diag_to_config =  {} [model_handling.py at line 1685] 
DEBUG: call =  vxxxxx( momenta,m_pars->%s, cHel[ihel][%d],%+d, w_sv[%d], %d ); [model_handling.py at line 1797] 
DEBUG: ('ZERO', 0, -1, 0, 0) [model_handling.py at line 1798] 
DEBUG: call =  vxxxxx( momenta,m_pars->%s, cHel[ihel][%d],%+d, w_sv[%d], %d ); [model_handling.py at line 1797] 
DEBUG: ('ZERO', 1, -1, 1, 1) [model_handling.py at line 1798] 
DEBUG: self.matrix_elements[0].get_number_of_wavefunctions() =  5 [model_handling.py at line 1254] 
INFO: Created files CPPProcess.h and CPPProcess.cc in directory /data/avalassi/GPU2023/MG5aMC/ghav-mg5amcnlo/CODEGEN_cudacpp_gg_tt/SubProcesses/P1_Sigma_sm_gg_ttx/.
DEBUG: Entering PLUGIN_OneProcessExporter.edit_CMakeLists [model_handling.py at line 1305] 
DEBUG: Entering PLUGIN_OneProcessExporter.edit_check_sa [model_handling.py at line 1314] 
DEBUG: Entering PLUGIN_OneProcessExporter.edit_mgonGPU [model_handling.py at line 1331] 
DEBUG: Entering PLUGIN_OneProcessExporter.edit_processidfile [model_handling.py at line 1351] 
DEBUG: Entering PLUGIN_OneProcessExporter.edit_testxxx [model_handling.py at line 1381] 
DEBUG: Entering PLUGIN_OneProcessExporter.edit_memorybuffers [model_handling.py at line 1392] 
DEBUG: Entering PLUGIN_OneProcessExporter.edit_memoryaccesscouplings [model_handling.py at line 1403] 
DEBUG: self.matrix_elements[0].get_number_of_wavefunctions() ) # NB: this is a different WRONG value of nwf, e.g. 7 for gg_tt! (#644 =  5 [model_handling.py at line 1292] 
DEBUG: Entering PLUGIN_OneProcessExporter.edit_CMakeLists [model_handling.py at line 1319] 
DEBUG: Entering PLUGIN_OneProcessExporter.edit_check_sa [model_handling.py at line 1328] 
DEBUG: self.matrix_elements[0].get_number_of_wavefunctions() ) # NB: this is a different WRONG value of nwf, e.g. 7 for gg_tt! (#644 =  5 [model_handling.py at line 1295] 
DEBUG: Entering PLUGIN_OneProcessExporter.edit_mgonGPU [model_handling.py at line 1345] 
DEBUG: self.matrix_elements[0].get_number_of_wavefunctions() ) # NB: this is a different WRONG value of nwf, e.g. 7 for gg_tt! (#644 =  5 [model_handling.py at line 1297] 
DEBUG: Entering PLUGIN_OneProcessExporter.edit_processidfile [model_handling.py at line 1365] 
DEBUG: Entering PLUGIN_OneProcessExporter.edit_testxxx [model_handling.py at line 1395] 
DEBUG: Entering PLUGIN_OneProcessExporter.edit_memorybuffers [model_handling.py at line 1406] 
DEBUG: Entering PLUGIN_OneProcessExporter.edit_memoryaccesscouplings [model_handling.py at line 1417] 
Generated helas calls for 1 subprocesses (3 diagrams) in 0.006 s
DEBUG: Entering PLUGIN_ProcessExporter.convert_model (create the model) [output.py at line 187] 
ALOHA: aloha starts to compute helicity amplitudes
ALOHA: aloha creates VVV1 set of routines with options: P0
ALOHA: aloha creates FFV1 routines
ALOHA: aloha creates 2 routines in 0.156 s
ALOHA: aloha creates 2 routines in 0.155 s
<class 'aloha.create_aloha.AbstractRoutine'> VVV1
<class 'aloha.create_aloha.AbstractRoutine'> FFV1
<class 'aloha.create_aloha.AbstractRoutine'> FFV1
Expand Down Expand Up @@ -238,6 +243,6 @@ INFO: /data/avalassi/GPU2023/MG5aMC/ghav-mg5amcnlo/CODEGEN_cudacpp_gg_tt/src/. a
DEBUG: Entering PLUGIN_ProcessExporter.finalize [output.py at line 196] 
quit

real 0m0.849s
user 0m0.642s
sys 0m0.077s
real 0m0.766s
user 0m0.653s
sys 0m0.068s
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,11 @@ namespace mg5amcCpu

using mgOnGpu::nw6; // dimensions of each wavefunction (HELAS KEK 91-11): e.g. 6 for e+ e- -> mu+ mu- (fermions and vectors)

using CPPProcess::nwf; // #wavefunctions = #external (npar) + #internal: e.g. 5 for e+ e- -> mu+ mu- (1 internal is gamma or Z)

using Parameters_sm_dependentCouplings::ndcoup; // #couplings that vary event by event (depend on running alphas QCD)
using Parameters_sm_independentCouplings::nicoup; // #couplings that are fixed for all events (do not depend on running alphas QCD)

//using CPPProcess::nwf; // #wavefunctions = #external (npar) + #internal: e.g. 5 for e+ e- -> mu+ mu- (1 internal is gamma or Z)

// The number of colors
constexpr int ncolor = 2;

Expand Down Expand Up @@ -158,7 +158,7 @@ namespace mg5amcCpu

// The variable nwf (which is specific to each P1 subdirectory, #644) is only used here
// It is hardcoded here because various attempts to hardcode it in CPPProcess.h at generation time gave the wrong result...
static const int nwf = 5; // #wavefunctions = #external (npar) + #internal: e.g. 5 for e+ e- -> mu+ mu- (1 internal is gamma or Z)
static const int nwf = 7; // #wavefunctions = #external (npar) + #internal: e.g. 5 for e+ e- -> mu+ mu- (1 internal is gamma or Z)

// Local TEMPORARY variables for a subset of Feynman diagrams in the given CUDA event (ievt) or C++ event page (ipagV)
// [NB these variables are reused several times (and re-initialised each time) within the same event or event page]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,9 @@ namespace mg5amcCpu
// Hardcoded parameters for this process (constant class variables)
// [NB: this class assumes nprocesses==1 i.e. a single DSIG1 and no DSIG2 in Fortran (#272 and #343)]
// [NB: these parameters (e.g. nwf) are P1-specific, i.e. they are different for different P1 subdirectories (#644)]
// [NB: I am currently unable to get the right value of nwf here - will hardcode it in CPPProcess.cc instead (#644)]
//static const int nwf = ??; // #wavefunctions = #external (npar) + #internal: e.g. 5 for e+ e- -> mu+ mu- (1 internal is gamma or Z)

// Other variables of this instance (???)
//static const int ninitial = mgOnGpu::npari;
//static const int nexternal = 4; // mgOnGpu::npar (nexternal was nioparticles)
//static const int nwavefuncs = 6; // (?!?! this is not nwf: nwavefuncs vs nwavefunc in python code ?!?!)
//static const int nwavefuncs = 6; // (?!?! this is the wrong value of nwf, nwavefuncs vs nwavefunc in python code, see #644)
//static const int namplitudes = 3;
//static const int ncomb = 16; // mgOnGpu::ncomb

Expand Down

0 comments on commit 53811de

Please # to comment.