Skip to content

Commit

Permalink
[om852asis] regenerate susy_gg_t1t1.mad, gg_ttgg.mad, gq_ttq.mad usin…
Browse files Browse the repository at this point in the history
…g AS-IS Olivier's patches from the latest fix_826 branch for PR madgraph5#852

The gg_ttgg test still crashes (rotxxx madgraph5#855?)
./tmad/madX.sh -ggttgg -iconfig 104 -makeclean
  *** (2-none) EXECUTE MADEVENT_CPP x1 (create events.lhe) ***
  Program received signal SIGFPE: Floating-point exception - erroneous arithmetic operation.
  Backtrace for this error:
   0  0x7fce5ec23860 in ???
   1  0x7fce5ec22a05 in ???
   2  0x7fce5e854def in ???
   3  0x44b5ff in ???
   4  0x4087df in ???
   5  0x409848 in ???
   6  0x40bb83 in ???
   7  0x40d1a9 in ???
   8  0x45c804 in ???
   9  0x434269 in ???
   10  0x40371e in ???
   11  0x7fce5e83feaf in ???
   12  0x7fce5e83ff5f in ???
   13  0x403844 in ???
   14  0xffffffffffffffff in ???
  ./tmad/madX.sh: line 387: 3913008 Floating point exception(core dumped) $timecmd $cmd < ${tmpin} > ${tmp}

The susy_gg_t1t1 test also still crashes (see madgraph5#826?), this looks like the same crash as ggttgg above
./tmad/madX.sh -susyggt1t1 -iconfig 2 -makeclean
  *** (2-none) EXECUTE MADEVENT_CPP x1 (create events.lhe) ***
  Program received signal SIGFPE: Floating-point exception - erroneous arithmetic operation.
  Backtrace for this error:
   0  0x7f9f03423860 in ???
   1  0x7f9f03422a05 in ???
   2  0x7f9f03054def in ???
   3  0x43809f in ???
   4  0x40581f in ???
   5  0x4067b1 in ???
   6  0x408c71 in ???
   7  0x40a0a9 in ???
   8  0x444fdf in ???
   9  0x42bb38 in ???
   10  0x40371e in ???
   11  0x7f9f0303feaf in ???
   12  0x7f9f0303ff5f in ???
   13  0x403844 in ???
   14  0xffffffffffffffff in ???
  ./tmad/madX.sh: line 387: 3907179 Floating point exception(core dumped) $timecmd $cmd < ${tmpin} > ${tmp}

The gqttq test also still crashes intermittently, i.e. only on the second execution (madgraph5#845?)
./tmad/teeMadX.sh -gqttq +10x -fltonly -makeclean
./tmad/teeMadX.sh -gqttq +10x -fltonly
  Executing ' ./build.512z_f_inl0_hrd0/madevent_cpp < /tmp/avalassi/input_gqttq_x1_cudacpp > /tmp/avalassi/output_gqttq_x1_cudacpp'
  Program received signal SIGFPE: Floating-point exception - erroneous arithmetic operation.
  Backtrace for this error:
   0  0x7fbafa623860 in ???
   1  0x7fbafa622a05 in ???
   2  0x7fbafa254def in ???
   3  0x7fbafad24034 in ???
   4  0x7fbafa9a1575 in ???
   5  0x7fbafad20c89 in ???
   6  0x7fbafad2abfd in ???
   7  0x7fbafad30491 in ???
   8  0x43008b in ???
   9  0x431c10 in ???
   10  0x432d47 in ???
   11  0x433b1e in ???
   12  0x44a921 in ???
   13  0x42ebbf in ???
   14  0x40371e in ???
   15  0x7fbafa23feaf in ???
   16  0x7fbafa23ff5f in ???
   17  0x403844 in ???
   18  0xffffffffffffffff in ???
  ./madX.sh: line 387: 3922797 Floating point exception(core dumped) $timecmd $cmd < ${tmpin} > ${tmp}
  ERROR! ' ./build.512z_f_inl0_hrd0/madevent_cpp < /tmp/avalassi/input_gqttq_x1_cudacpp > /tmp/avalassi/output_gqttq_x1_cudacpp' failed
  • Loading branch information
valassi committed Jun 26, 2024
1 parent 15238f4 commit a7c25a3
Show file tree
Hide file tree
Showing 11 changed files with 799 additions and 183 deletions.
347 changes: 335 additions & 12 deletions epochX/cudacpp/gg_ttgg.mad/CODEGEN_mad_gg_ttgg_log.txt

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -3153,15 +3153,15 @@ namespace mg5amcCpu
// Event-by-event random choice of color #402
if( channelId != 0 ) // no event-by-event choice of color if channelId == 0 (fix FPE #783)
{
const unsigned int channelIdC = channelId - 1; // coloramps.h uses the C array indexing starting at 0
const unsigned int iconfigC = mgOnGpu::channelId_to_iconfigC[channelId]; // coloramps.h uses a channel ordering not the diagram id
fptype targetamp[ncolor] = { 0 };
for( int icolC = 0; icolC < ncolor; icolC++ )
{
if( icolC == 0 )
targetamp[icolC] = 0;
else
targetamp[icolC] = targetamp[icolC - 1];
if( mgOnGpu::icolamp[channelIdC][icolC] ) targetamp[icolC] += jamp2_sv[icolC];
if( mgOnGpu::icolamp[iconfigC][icolC] ) targetamp[icolC] += jamp2_sv[icolC];
}
//printf( "sigmaKin: ievt=%4d rndcol=%f\n", ievt, allrndcol[ievt] );
for( int icolC = 0; icolC < ncolor; icolC++ )
Expand Down Expand Up @@ -3196,7 +3196,7 @@ namespace mg5amcCpu
// - firstprivate: give each thread its own copy, and initialise with value from outside
#define _OMPLIST0 allcouplings, allMEs, allmomenta, allrndcol, allrndhel, allselcol, allselhel, cGoodHel, cNGoodHel, npagV2
#ifdef MGONGPU_SUPPORTS_MULTICHANNEL
#define _OMPLIST1 , allDenominators, allNumerators, channelId, mgOnGpu::icolamp
#define _OMPLIST1 , allDenominators, allNumerators, channelId, mgOnGpu::icolamp, mgOnGpu::channelId_to_iconfigC
#else
#define _OMPLIST1
#endif
Expand Down Expand Up @@ -3268,25 +3268,26 @@ namespace mg5amcCpu
// Event-by-event random choice of color #402
if( channelId != 0 ) // no event-by-event choice of color if channelId == 0 (fix FPE #783)
{
const unsigned int channelIdC = channelId - 1; // coloramps.h uses the C array indexing starting at 0
const unsigned int iconfigC = mgOnGpu::channelId_to_iconfigC[channelId]; // coloramps.h uses a channel ordering not the diagram id
fptype_sv targetamp[ncolor] = { 0 };
for( int icolC = 0; icolC < ncolor; icolC++ )
{
if( icolC == 0 )
targetamp[icolC] = fptype_sv{ 0 };
else
targetamp[icolC] = targetamp[icolC - 1];
if( mgOnGpu::icolamp[channelIdC][icolC] ) targetamp[icolC] += jamp2_sv[icolC];
if( mgOnGpu::icolamp[iconfigC][icolC] ) targetamp[icolC] += jamp2_sv[icolC];
}
#if defined MGONGPU_CPPSIMD and defined MGONGPU_FPTYPE_DOUBLE and defined MGONGPU_FPTYPE2_FLOAT
const unsigned int iconfigC = mgOnGpu::channelId_to_iconfigC[channelId]; // coloramps.h uses a channel ordering not the diagram id
fptype_sv targetamp2[ncolor] = { 0 };
for( int icolC = 0; icolC < ncolor; icolC++ )
{
if( icolC == 0 )
targetamp2[icolC] = fptype_sv{ 0 };
else
targetamp2[icolC] = targetamp2[icolC - 1];
if( mgOnGpu::icolamp[channelIdC][icolC] ) targetamp2[icolC] += jamp2_sv[ncolor + icolC];
if( mgOnGpu::icolamp[iconfigC][icolC] ) targetamp2[icolC] += jamp2_sv[ncolor + icolC];
}
#endif
for( int ieppV = 0; ieppV < neppV; ++ieppV )
Expand Down
348 changes: 242 additions & 106 deletions epochX/cudacpp/gg_ttgg.mad/SubProcesses/P1_gg_ttxgg/coloramps.h

Large diffs are not rendered by default.

71 changes: 58 additions & 13 deletions epochX/cudacpp/gq_ttq.mad/CODEGEN_mad_gq_ttq_log.txt
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ set zerowidth_tchannel F
define q = u c d s u~ c~ d~ s~
INFO: load particles
INFO: load vertices
DEBUG: model prefixing takes 0.005826234817504883 
DEBUG: model prefixing takes 0.005254507064819336 
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 @@ -170,7 +170,7 @@ INFO: Crossed process found for g u~ > t t~ u~, reuse diagrams.
INFO: Crossed process found for g c~ > t t~ c~, reuse diagrams.
INFO: Crossed process found for g d~ > t t~ d~, reuse diagrams.
INFO: Crossed process found for g s~ > t t~ s~, reuse diagrams.
8 processes with 40 diagrams generated in 0.083 s
8 processes with 40 diagrams generated in 0.077 s
Total: 8 processes with 40 diagrams
output madevent_simd ../TMPOUT/CODEGEN_mad_gq_ttq --hel_recycling=False --vector_size=32
Load PLUGIN.CUDACPP_OUTPUT
Expand Down Expand Up @@ -200,8 +200,8 @@ INFO: Combined process g c~ > t t~ c~ WEIGHTED<=3 @1 with process g u~ > t t~ u~
INFO: Combined process g d~ > t t~ d~ WEIGHTED<=3 @1 with process g u~ > t t~ u~ WEIGHTED<=3 @1
INFO: Combined process g s~ > t t~ s~ WEIGHTED<=3 @1 with process g u~ > t t~ u~ WEIGHTED<=3 @1
INFO: Creating files in directory P1_gu_ttxu
DEBUG: kwargs[prefix] = 0 [model_handling.py at line 1148] 
DEBUG: process_exporter_cpp =  <PLUGIN.CUDACPP_OUTPUT.model_handling.PLUGIN_OneProcessExporter object at 0x7f7353aadac0> [export_v4.py at line 6261] 
DEBUG: kwargs[prefix] = 0 [model_handling.py at line 1151] 
DEBUG: process_exporter_cpp =  <PLUGIN.CUDACPP_OUTPUT.model_handling.PLUGIN_OneProcessExporter object at 0x7f07ce8ad100> [export_v4.py at line 6261] 
INFO: Creating files in directory .
FileWriter <class 'PLUGIN.CUDACPP_OUTPUT.model_handling.PLUGIN_CPPWriter'> for ././CPPProcess.h
FileWriter <class 'PLUGIN.CUDACPP_OUTPUT.model_handling.PLUGIN_CPPWriter'> for ././CPPProcess.cc
Expand All @@ -216,9 +216,31 @@ INFO: Created files CPPProcess.h and CPPProcess.cc in directory ./.
DEBUG: vector, subproc_group,self.opt['vector_size'] =  32 True 32 [export_v4.py at line 1871] 
INFO: Generating Feynman diagrams for Process: g u > t t~ u WEIGHTED<=3 @1
INFO: Finding symmetric diagrams for subprocess group gu_ttxu
DEBUG: os.getcwd() =  /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_gq_ttq/SubProcesses/P1_gu_ttxu [export_v4.py at line 6438] 
DEBUG: len(subproc_diagrams_for_config) =  5 [model_handling.py at line 1519] 
DEBUG: iconfig_to_diag =  {1: 1, 2: 2, 3: 3, 4: 4, 5: 5} [model_handling.py at line 1544] 
DEBUG: diag_to_iconfig =  {1: 1, 2: 2, 3: 3, 4: 4, 5: 5} [model_handling.py at line 1545] 
DEBUG: multi_channel =  {1: [0], 2: [1], 3: [2], 4: [3], 5: [4]} [model_handling.py at line 1574] 
DEBUG: self.path, os.getcwd() =  . /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_gq_ttq/SubProcesses/P1_gu_ttxu [model_handling.py at line 1575] 
DEBUG: replace_dict['is_LC'] =  {{true,false,false,false};,{true,false,false,false};,{false,false,false,true};,{false,false,false,true};,{true,false,false,true};}; [model_handling.py at line 1580] 
DEBUG: split[i] =  {{true,false,false,false} [model_handling.py at line 1582] 
DEBUG: split[i] =  {true, false, false, false} [model_handling.py at line 1584] 
DEBUG: split[i] =  {true, false, false, false}, // iconfigC=0, diag=1 [model_handling.py at line 1589] 
DEBUG: split[i] =  {true,false,false,false} [model_handling.py at line 1582] 
DEBUG: split[i] =  {true, false, false, false} [model_handling.py at line 1584] 
DEBUG: split[i] =  {true, false, false, false}, // iconfigC=1, diag=2 [model_handling.py at line 1589] 
DEBUG: split[i] =  {false,false,false,true} [model_handling.py at line 1582] 
DEBUG: split[i] =  {false, false, false, true} [model_handling.py at line 1584] 
DEBUG: split[i] =  {false, false, false, true}, // iconfigC=2, diag=3 [model_handling.py at line 1589] 
DEBUG: split[i] =  {false,false,false,true} [model_handling.py at line 1582] 
DEBUG: split[i] =  {false, false, false, true} [model_handling.py at line 1584] 
DEBUG: split[i] =  {false, false, false, true}, // iconfigC=3, diag=4 [model_handling.py at line 1589] 
DEBUG: split[i] =  {true,false,false,true};}; [model_handling.py at line 1582] 
DEBUG: split[i] =  {true, false, false, true};}; [model_handling.py at line 1584] 
DEBUG: split[i] =  {true, false, false, true}, // iconfigC=4, diag=5 [model_handling.py at line 1589] 
INFO: Creating files in directory P1_gux_ttxux
DEBUG: kwargs[prefix] = 0 [model_handling.py at line 1148] 
DEBUG: process_exporter_cpp =  <PLUGIN.CUDACPP_OUTPUT.model_handling.PLUGIN_OneProcessExporter object at 0x7f7353b297c0> [export_v4.py at line 6261] 
DEBUG: kwargs[prefix] = 0 [model_handling.py at line 1151] 
DEBUG: process_exporter_cpp =  <PLUGIN.CUDACPP_OUTPUT.model_handling.PLUGIN_OneProcessExporter object at 0x7f07ce8960d0> [export_v4.py at line 6261] 
INFO: Creating files in directory .
FileWriter <class 'PLUGIN.CUDACPP_OUTPUT.model_handling.PLUGIN_CPPWriter'> for ././CPPProcess.h
FileWriter <class 'PLUGIN.CUDACPP_OUTPUT.model_handling.PLUGIN_CPPWriter'> for ././CPPProcess.cc
Expand All @@ -233,17 +255,39 @@ INFO: Created files CPPProcess.h and CPPProcess.cc in directory ./.
DEBUG: vector, subproc_group,self.opt['vector_size'] =  32 True 32 [export_v4.py at line 1871] 
INFO: Generating Feynman diagrams for Process: g u~ > t t~ u~ WEIGHTED<=3 @1
INFO: Finding symmetric diagrams for subprocess group gux_ttxux
Generated helas calls for 2 subprocesses (10 diagrams) in 0.033 s
Wrote files for 32 helas calls in 0.234 s
DEBUG: os.getcwd() =  /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_gq_ttq/SubProcesses/P1_gux_ttxux [export_v4.py at line 6438] 
DEBUG: len(subproc_diagrams_for_config) =  5 [model_handling.py at line 1519] 
DEBUG: iconfig_to_diag =  {1: 1, 2: 2, 3: 3, 4: 4, 5: 5} [model_handling.py at line 1544] 
DEBUG: diag_to_iconfig =  {1: 1, 2: 2, 3: 3, 4: 4, 5: 5} [model_handling.py at line 1545] 
DEBUG: multi_channel =  {1: [0], 2: [1], 3: [2], 4: [3], 5: [4]} [model_handling.py at line 1574] 
DEBUG: self.path, os.getcwd() =  . /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_gq_ttq/SubProcesses/P1_gux_ttxux [model_handling.py at line 1575] 
DEBUG: replace_dict['is_LC'] =  {{false,false,false,true};,{false,false,false,true};,{true,false,false,false};,{true,false,false,false};,{true,false,false,true};}; [model_handling.py at line 1580] 
DEBUG: split[i] =  {{false,false,false,true} [model_handling.py at line 1582] 
DEBUG: split[i] =  {false, false, false, true} [model_handling.py at line 1584] 
DEBUG: split[i] =  {false, false, false, true}, // iconfigC=0, diag=1 [model_handling.py at line 1589] 
DEBUG: split[i] =  {false,false,false,true} [model_handling.py at line 1582] 
DEBUG: split[i] =  {false, false, false, true} [model_handling.py at line 1584] 
DEBUG: split[i] =  {false, false, false, true}, // iconfigC=1, diag=2 [model_handling.py at line 1589] 
DEBUG: split[i] =  {true,false,false,false} [model_handling.py at line 1582] 
DEBUG: split[i] =  {true, false, false, false} [model_handling.py at line 1584] 
DEBUG: split[i] =  {true, false, false, false}, // iconfigC=2, diag=3 [model_handling.py at line 1589] 
DEBUG: split[i] =  {true,false,false,false} [model_handling.py at line 1582] 
DEBUG: split[i] =  {true, false, false, false} [model_handling.py at line 1584] 
DEBUG: split[i] =  {true, false, false, false}, // iconfigC=3, diag=4 [model_handling.py at line 1589] 
DEBUG: split[i] =  {true,false,false,true};}; [model_handling.py at line 1582] 
DEBUG: split[i] =  {true, false, false, true};}; [model_handling.py at line 1584] 
DEBUG: split[i] =  {true, false, false, true}, // iconfigC=4, diag=5 [model_handling.py at line 1589] 
Generated helas calls for 2 subprocesses (10 diagrams) in 0.031 s
Wrote files for 32 helas calls in 0.348 s
ALOHA: aloha starts to compute helicity amplitudes
ALOHA: aloha creates FFV1 routines
ALOHA: aloha creates VVV1 routines
ALOHA: aloha creates 2 routines in 0.154 s
ALOHA: aloha creates 2 routines in 0.145 s
DEBUG: Entering PLUGIN_ProcessExporter.convert_model (create the model) [output.py at line 205] 
ALOHA: aloha starts to compute helicity amplitudes
ALOHA: aloha creates FFV1 routines
ALOHA: aloha creates VVV1 routines
ALOHA: aloha creates 4 routines in 0.140 s
ALOHA: aloha creates 4 routines in 0.131 s
<class 'aloha.create_aloha.AbstractRoutine'> FFV1
<class 'aloha.create_aloha.AbstractRoutine'> FFV1
<class 'aloha.create_aloha.AbstractRoutine'> FFV1
Expand All @@ -262,6 +306,7 @@ If you want to make this value the default for future session, you can run 'save
save configuration file to /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_gq_ttq/Cards/me5_configuration.txt
INFO: Use Fortran compiler gfortran
INFO: Use c++ compiler g++
INFO: Generate jpeg diagrams
INFO: Generate web pages
DEBUG: cd /data/avalassi/GPU2023/madgraph4gpuX/MG5aMC/TMPOUT/CODEGEN_mad_gq_ttq; patch -p4 -i /data/avalassi/GPU2023/madgraph4gpuX/epochX/cudacpp/CODEGEN/PLUGIN/CUDACPP_SA_OUTPUT/MG5aMC_patches/PROD/patch.common
patching file Source/genps.inc
Expand Down Expand Up @@ -296,9 +341,9 @@ Type "launch" to generate events from this process, or see
Run "open index.html" to see more information about this process.
quit

real 0m2.041s
user 0m1.799s
sys 0m0.227s
real 0m2.377s
user 0m2.058s
sys 0m0.288s
Code generation completed in 2 seconds
************************************************************
* *
Expand Down
13 changes: 7 additions & 6 deletions epochX/cudacpp/gq_ttq.mad/SubProcesses/P1_gu_ttxu/CPPProcess.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1043,15 +1043,15 @@ namespace mg5amcCpu
// Event-by-event random choice of color #402
if( channelId != 0 ) // no event-by-event choice of color if channelId == 0 (fix FPE #783)
{
const unsigned int channelIdC = channelId - 1; // coloramps.h uses the C array indexing starting at 0
const unsigned int iconfigC = mgOnGpu::channelId_to_iconfigC[channelId]; // coloramps.h uses a channel ordering not the diagram id
fptype targetamp[ncolor] = { 0 };
for( int icolC = 0; icolC < ncolor; icolC++ )
{
if( icolC == 0 )
targetamp[icolC] = 0;
else
targetamp[icolC] = targetamp[icolC - 1];
if( mgOnGpu::icolamp[channelIdC][icolC] ) targetamp[icolC] += jamp2_sv[icolC];
if( mgOnGpu::icolamp[iconfigC][icolC] ) targetamp[icolC] += jamp2_sv[icolC];
}
//printf( "sigmaKin: ievt=%4d rndcol=%f\n", ievt, allrndcol[ievt] );
for( int icolC = 0; icolC < ncolor; icolC++ )
Expand Down Expand Up @@ -1086,7 +1086,7 @@ namespace mg5amcCpu
// - firstprivate: give each thread its own copy, and initialise with value from outside
#define _OMPLIST0 allcouplings, allMEs, allmomenta, allrndcol, allrndhel, allselcol, allselhel, cGoodHel, cNGoodHel, npagV2
#ifdef MGONGPU_SUPPORTS_MULTICHANNEL
#define _OMPLIST1 , allDenominators, allNumerators, channelId, mgOnGpu::icolamp
#define _OMPLIST1 , allDenominators, allNumerators, channelId, mgOnGpu::icolamp, mgOnGpu::channelId_to_iconfigC
#else
#define _OMPLIST1
#endif
Expand Down Expand Up @@ -1158,25 +1158,26 @@ namespace mg5amcCpu
// Event-by-event random choice of color #402
if( channelId != 0 ) // no event-by-event choice of color if channelId == 0 (fix FPE #783)
{
const unsigned int channelIdC = channelId - 1; // coloramps.h uses the C array indexing starting at 0
const unsigned int iconfigC = mgOnGpu::channelId_to_iconfigC[channelId]; // coloramps.h uses a channel ordering not the diagram id
fptype_sv targetamp[ncolor] = { 0 };
for( int icolC = 0; icolC < ncolor; icolC++ )
{
if( icolC == 0 )
targetamp[icolC] = fptype_sv{ 0 };
else
targetamp[icolC] = targetamp[icolC - 1];
if( mgOnGpu::icolamp[channelIdC][icolC] ) targetamp[icolC] += jamp2_sv[icolC];
if( mgOnGpu::icolamp[iconfigC][icolC] ) targetamp[icolC] += jamp2_sv[icolC];
}
#if defined MGONGPU_CPPSIMD and defined MGONGPU_FPTYPE_DOUBLE and defined MGONGPU_FPTYPE2_FLOAT
const unsigned int iconfigC = mgOnGpu::channelId_to_iconfigC[channelId]; // coloramps.h uses a channel ordering not the diagram id
fptype_sv targetamp2[ncolor] = { 0 };
for( int icolC = 0; icolC < ncolor; icolC++ )
{
if( icolC == 0 )
targetamp2[icolC] = fptype_sv{ 0 };
else
targetamp2[icolC] = targetamp2[icolC - 1];
if( mgOnGpu::icolamp[channelIdC][icolC] ) targetamp2[icolC] += jamp2_sv[ncolor + icolC];
if( mgOnGpu::icolamp[iconfigC][icolC] ) targetamp2[icolC] += jamp2_sv[ncolor + icolC];
}
#endif
for( int ieppV = 0; ieppV < neppV; ++ieppV )
Expand Down
40 changes: 34 additions & 6 deletions epochX/cudacpp/gq_ttq.mad/SubProcesses/P1_gu_ttxu/coloramps.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,43 @@
#ifndef COLORAMPS_H
#define COLORAMPS_H 1

#include <map>

namespace mgOnGpu
{
// Summary of numbering and indexing conventions for the relevant concepts (see issue #826 and PR #852)
// - Diagram number (no variable) in [1, N_diagrams]: all values are allowed (N_diagrams distinct values)
// => this number is displayed for information before each block of code in CPPProcess.cc
// - Channel number (CHANNEL_ID) in [0, N_diagrams]: not all values are allowed (N_config <= N_diagrams distinct values)
// => this number (with indexing like ps/pdf output) is passed around as an API argument between cudacpp functions
// 0 is allowed to fallback to no multi-channel mode.
// - Channel number in C indexing: "IconfiC", this is the equivalent of the Fortran iconfig
// iconfigC = iconfig -1
// provides a continuous index [0, N_config-1] for array
// iconfigC = ChannelId_to_iconfigC[channelId]
//NOTE: All those ordering are event by event specific (with the intent to have those fix within a vector size/wrap

// Map channelId to iconfigC
// This array has N_diagrams+1 elements, but only N_config <= N_diagrams valid values
// unvalid values are set to -1
// The 0 entry is a fall back to still write events even if no multi-channel is setup (wrong color selected in that mode)
__device__ constexpr int channelId_to_iconfigC[6] = {
0, // channelId=0: This value means not multi-channel, color will be wrong anyway -> pick the first
0, // channelId=1 (diagram=1) --> iconfig=1 (f77 conv) and iconfigC=0 (c conv)
1, // channelId=2 (diagram=2) --> iconfig=2 (f77 conv) and iconfigC=1 (c conv)
2, // channelId=3 (diagram=3) --> iconfig=3 (f77 conv) and iconfigC=2 (c conv)
3, // channelId=4 (diagram=4) --> iconfig=4 (f77 conv) and iconfigC=3 (c conv)
4, // channelId=5 (diagram=5) --> iconfig=5 (f77 conv) and iconfigC=4 (c conv)
};

__device__ constexpr bool icolamp[5][4] = {
{ true, false, false, false },
{ true, false, false, false },
{ false, false, false, true },
{ false, false, false, true },
{ true, false, false, true }
// Map iconfigC (in C indexing, i.e. iconfig-1) to the set of allowed colors
// This array has N_config <= N_diagrams elements
__device__ constexpr bool icolamp[5][4] = {
{true, false, false, false}, // iconfigC=0, diag=1
{true, false, false, false}, // iconfigC=1, diag=2
{false, false, false, true}, // iconfigC=2, diag=3
{false, false, false, true}, // iconfigC=3, diag=4
{true, false, false, true}, // iconfigC=4, diag=5
};

}
Expand Down
Loading

0 comments on commit a7c25a3

Please sign in to comment.