-
Notifications
You must be signed in to change notification settings - Fork 37
Description
This is a generalisation of an issue previously discussed with @valassi and @roiser. The long and short of it is that some parameters which should be stored in the P-directories are stored in the src-directory. Here are two examples.
generate p p > t t~ g g
This process has two subprocesses, g g > t t~ g g and u u~ > t t~ g g (the latter one being the combined file for the four different quark cases). Both subprocesses compile, but g g > t t~ g g seg faults at runtime due to needing to store more internal wavefunctions in memory than are allocated. Shown in the warning raised at compile time:
CPPProcess.cc:1723:36: warning: array subscript 25 is above array bounds of ‘mgOnGpu::fptype* [17]’ {aka ‘double* [17]’} [-Warray-bounds] 1723 | VVV1P0_1<W_ACCESS, CD_ACCESS>( w_fp[0], w_fp[7], COUPs[0], 0., 0., w_fp[25] ); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ CPPProcess.cc:160:13: note: while referencing ‘w_fp’ 160 | fptype* w_fp[nwf]; | ^~~~
Another case is when running multiprocesses, e.g.
generate g g > t t~ add process g g > t t~ g
which will generate code with multiple subprocess directories, i.e. directories P1... and P2.... In this case, g g > t t~ g fails already at compile time,
``
gCPPProcess.cu(639): error: too many initializer values
gCPPProcess.cu(640): error: too many initializer values
gCPPProcess.cu(641): error: too many initializer values
gCPPProcess.cu(642): error: too many initializer values
gCPPProcess.cu(643): error: too many initializer values
gCPPProcess.cu(644): error: too many initializer values
gCPPProcess.cu(645): error: too many initializer values
gCPPProcess.cu(646): error: too many initializer values
gCPPProcess.cu(647): error: too many initializer values
gCPPProcess.cu(648): error: too many initializer values
gCPPProcess.cu(649): error: too many initializer values
gCPPProcess.cu(650): error: too many initializer values
gCPPProcess.cu(651): error: too many initializer values
gCPPProcess.cu(652): error: too many initializer values
gCPPProcess.cu(653): error: too many initializer values
gCPPProcess.cu(654): error: too many initializer values
gCPPProcess.cu(655): error: too many initializer values
CPPProcess.cc: In constructor ‘mg5amcCpu::CPPProcess::CPPProcess(bool, bool)’:
CPPProcess.cc:670:26: error: too many initializers for ‘const short int [4]’
670 | { 1, 1, 1, -1, 1 } };
| ^
17 errors detected in the compilation of "gCPPProcess.cu".
``
Both of these are instances of the same underlying issue: in the file mgOnGpuConfig.h (and similarly I expect for C++?) there is a block with information which is process dependent:
115 // --- Physics process-specific constants that are best declared at compile time 116 117 const int np4 = 4; // dimensions of 4-momenta (E,px,py,pz) 118 119 const int npari = 2; // #particles in the initial state (incoming): e.g. 2 (e+ e-) for e+ e- -> mu+ mu- 120 121 const int nparf = 2; // #particles in the final state (outgoing): e.g. 2 (mu+ mu-) for e+ e- -> mu+ mu- 122 123 const int npar = npari + nparf; // #particles in total (external = initial + final): e.g. 4 for e+ e- -> mu+ mu- 124 125 const int ncomb = 16; // #helicity combinations: e.g. 16 for e+ e- -> mu+ mu- (2**4 = fermion spin up/down ** npar) 126 127 const int nw6 = 6; // dimensions of each wavefunction (HELAS KEK 91-11): e.g. 6 for e+ e- -> mu+ mu- (fermions and vectors) 128 129 const int nwf = 5; // #wavefunctions = #external (npar) + #internal: e.g. 5 for e+ e- -> mu+ mu- (1 internal is gamma or Z)
Aside from np4, all of these can vary between subprocesses -- essentially, the /src/ directory can only contain things that should be shared between all possible processes, and anything that varies with the given process (at least within a single UFO model) should be kept exclusively within the P-subdirectories.