Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: susy tests for issue 826 #853

Closed
wants to merge 49 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
8955457
Merge remote-tracking branch 'upstream/fix_825' (Olivier's WIP PR #85…
valassi May 30, 2024
23398dc
[susy] regenerate susy_gg_tt and susy_gg_t1t1 with Olivier's PR #850 …
valassi May 30, 2024
6d15bf9
[susy] quick tmad test on susy_gg_tt and susy_gg_t1t1: cpp/fortran xs…
valassi May 30, 2024
6cbb606
[susy] regenerate all processes after Olivier's WIP patch in PR #850 …
valassi May 30, 2024
11d8b38
[susy] go back to upstream/master CODEGEN logs to allow the merge wit…
valassi May 30, 2024
e4d3336
Merge branch 'launch' (PR #851 fixing bin/madevent .gitignore) into susy
valassi May 30, 2024
37f8631
[susy] regenerate all processes with both PR #835 and PR #851 patches…
valassi May 30, 2024
b010198
[susy] in susy_gg_t1t1.mad make_opts, try to add -fno-tree-vectorize …
valassi May 30, 2024
6d3ebbc
[susy] in susy_gg_t1t1.mad runcard, try to add -fno-tree-vectorize to…
valassi May 30, 2024
40ef953
[susy] in susy_gg_t1t1.mad runcard and make_opts, try to change -O3 t…
valassi May 30, 2024
dd4df95
[susy] in susy_gg_t1t1.mad runcard and make_opts, add -g in global_fl…
valassi May 30, 2024
7b160e8
[susy] in susy_gg_t1t1.mad runcard and make_opts, try to change -O2 t…
valassi May 30, 2024
539659c
Merge remote-tracking branch 'upstream/master' (with merged PR #851 f…
valassi May 30, 2024
bed2e12
try to fix the segfault on issue 826
oliviermattelaer May 31, 2024
41ddc38
fix a issue for omp compilation
oliviermattelaer May 31, 2024
d34c2c2
[susy] revert the five recent WIP attempts to debug #826 in susy_gg_t…
valassi May 31, 2024
335d6d2
[susy] regenerate susy_gg_t1t1.mad, check that all is ok - prepare to…
valassi May 31, 2024
e58cdce
Merge remote-tracking branch 'upstream/fix_826' (Olivier's PR #852 fo…
valassi May 31, 2024
f77b903
[susy] in CODEGEN process_sigmaKin_function.inc, fix clang formatting…
valassi May 31, 2024
1485eb3
[susy] regenerate susy_gg_t1t1.mad with Olivier's patch PR #852 for i…
valassi May 31, 2024
c8fc741
[susy] in susy_gg_t1t1.mad coloramps.h, improve visual formatting (st…
valassi May 31, 2024
05265af
[susy] in CODEGEN coloramps.h, improve visual formatting (strangely, …
valassi May 31, 2024
8bdbfe2
[susy] in CODEGEN/checkFormatting.sh, add coloramps.h to the list of …
valassi May 31, 2024
7a9258c
[susy] in susy_gg_t1t1.mad coloramps.h, add a comment that a trailing…
valassi May 31, 2024
4521b65
[susy] in CODEGEN coloramps.h, add a comment that a trailing comma is…
valassi May 31, 2024
db56226
[susy] in CODEGEN, fix clang formatting for coloramps.h
valassi May 31, 2024
ade95e8
[susy] regenerate susy_gg_t1t1.mad after fixing clang formatting, all ok
valassi May 31, 2024
38b3afd
[susy] in susy_gg_t1t1.mad, try to fix coloramps.h by defining the ma…
valassi May 31, 2024
d3c29a0
[susy] in susy_gg_t1t1.mad, revert the attempt to fix coloramps.h by …
valassi May 31, 2024
5a2a6e9
[susy] in susy_gg_t1t1.mad, try to fix coloramps.h by changing the ma…
valassi May 31, 2024
340baab
[susy] in CODEGEN, try to fix coloramps.h by changing the map into a …
valassi May 31, 2024
a04a900
[susy] regenerate susy_gg_t1t1.mad with the latest CODEGEN, all ok (i…
valassi May 31, 2024
3da9868
[susy] rerun tmad test for susy_gg_t1t1: still no cross section (#826…
valassi May 31, 2024
7b786b0
Merge branch 'susy2' (PR #854 adding matrix.pdf files) into susy
valassi Jun 1, 2024
4454d2e
[susy] in tmad/madX.sh, use channelId=1 by default but use a differen…
valassi Jun 1, 2024
6e76ade
[susy] improve comments and variable names in tmad/madX.sh: iconfig n…
valassi Jun 1, 2024
0212043
[susy] in tmad/madX.sh, keep iconfig=1 for the moment also for susy_g…
valassi Jun 2, 2024
3208fd9
[susy] in susy_gg_t1t1.mad, document and clean up the mapping between…
valassi Jun 2, 2024
abccd5e
[susy] rerun susy_gg_t1t1 tmad test - not surprisingly, still no cros…
valassi Jun 2, 2024
06425c6
Merge remote-tracking branch 'upstream/master' (with fixes in PR #850…
valassi Jun 3, 2024
4b1c532
Merge remote-tracking branch 'upstream/master' (with matrix.pdf #854)…
valassi Jun 3, 2024
8d2c82b
[susy] go back to CODEGEN logs from upstream/master to ease merges
valassi Jun 26, 2024
d9d898a
[om852asis] update MG5aMC/mg5amcnlo to e4d9df4ab in gpucpp_826 includ…
valassi Jun 27, 2024
a399b47
Merge remote-tracking branch 'upstream/master' (new CI #794 and valgr…
valassi Jun 27, 2024
3269e6b
[tmad] in tmad/madX.sh, add optional argument "-iconfig <iconfig>" to…
valassi Jun 2, 2024
0920709
[tmad] in tmad/madX.sh, use iconfig=104 in ggttgg and iconfig=2 in su…
valassi Jun 2, 2024
c39b5fb
[susy] go back to older tmad logs to allow merging upstream/master
valassi Jun 27, 2024
d24723e
[om852asis] update MG5aMC/mg5amcnlo to 74fd166c1 in gpucpp_826 includ…
valassi Jun 27, 2024
5364731
Merge remote-tracking branch 'upstream/master' (PR #857 fixing rotxxx…
valassi Jun 27, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion MG5aMC/mg5amcnlo
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,17 @@
#ifndef COLORAMPS_H
#define COLORAMPS_H 1

#include <map>

namespace mgOnGpu
{

__device__ constexpr bool icolamp[%(nb_channel)s][%(nb_color)s] = {
%(is_LC)s
__device__ constexpr int diag_to_channel[%(nb_diagmax)s] = {
%(diag_to_channel)s
};

__device__ constexpr bool icolamp[%(nb_channel)s][%(nb_color)s] = {
%(is_LC)s };

}
#endif // COLORAMPS_H
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
! Copyright (C) 2020-2024 CERN and UCLouvain.
! Licensed under the GNU Lesser General Public License (version 3 or later).
! Modified by: A. Valassi (Sep 2021) for the MG5aMC CUDACPP plugin.
! Further modified by: J. Teig, A. Valassi (2021-2024) for the MG5aMC CUDACPP plugin.
! Further modified by: O. Mattelaer, J. Teig, A. Valassi (2021-2024) for the MG5aMC CUDACPP plugin.
!==========================================================================

#include "GpuAbstraction.h"
Expand Down Expand Up @@ -72,7 +72,7 @@
// 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 channelIdC = mgOnGpu::diag_to_channel[channelId]; // coloramps.h uses a channel ordering not the diagram id
fptype targetamp[ncolor] = { 0 };
for( int icolC = 0; icolC < ncolor; icolC++ )
{
Expand Down Expand Up @@ -115,7 +115,7 @@
// - 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::diag_to_channel
#else
#define _OMPLIST1
#endif
Expand Down Expand Up @@ -187,7 +187,7 @@
// 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 channelIdC = mgOnGpu::diag_to_channel[channelId]; // coloramps.h uses a channel ordering not the diagram id
fptype_sv targetamp[ncolor] = { 0 };
for( int icolC = 0; icolC < ncolor; icolC++ )
{
Expand Down
42 changes: 39 additions & 3 deletions epochX/cudacpp/CODEGEN/PLUGIN/CUDACPP_SA_OUTPUT/model_handling.py
Original file line number Diff line number Diff line change
Expand Up @@ -1432,8 +1432,7 @@ def generate_process_files(self):
self.edit_check_sa()
self.edit_mgonGPU()
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)

self.edit_testxxx() # AV new file (NB this is generic in Subprocesses and then linked in Sigma-specific)
self.edit_memorybuffers() # AV new file (NB this is generic in Subprocesses and then linked in Sigma-specific)
self.edit_memoryaccesscouplings() # AV new file (NB this is generic in Subprocesses and then linked in Sigma-specific)
Expand Down Expand Up @@ -1511,19 +1510,55 @@ def edit_processidfile(self):
ff.write(template % replace_dict)
ff.close()


def generate_subprocess_directory_end(self, **opt):
""" opt contain all local variable of the fortran original function"""
if self.include_multi_channel:
#self.edit_coloramps() # AV new file (NB this is Sigma-specific, should not be a symlink to Subprocesses)
subproc_diagrams_for_config = opt['subproc_diagrams_for_config']
misc.sprint(len(subproc_diagrams_for_config))
self.edit_coloramps( subproc_diagrams_for_config)

# AV - new method
def edit_coloramps(self):
def edit_coloramps(self, config_subproc_map):
"""Generate coloramps.h"""


###misc.sprint('Entering PLUGIN_OneProcessExporter.edit_coloramps')
template = open(pjoin(self.template_path,'gpu','coloramps.h'),'r').read()
ff = open(pjoin(self.path, 'coloramps.h'),'w')
# The following five lines from OneProcessExporterCPP.get_sigmaKin_lines (using OneProcessExporterCPP.get_icolamp_lines)
replace_dict={}

# Channel numbers are only defined for configs that have some corresponding diagrams
diag_to_channel = {}
iconfig = 0
for config in config_subproc_map:
if set(config) == set([0]): continue
if config[0] in diag_to_channel: raise Exception( 'Internal error while generating coloramps.h:', config[0], 'is already in', diag_to_channel )
diag_to_channel[config[0]] = iconfig
iconfig += 1
nb_diagmax = max(diag_to_channel.keys()) + 1
replace_dict['nb_diagmax'] = nb_diagmax
lines = []
for idiag in range( nb_diagmax ):
if idiag == nb_diagmax-1: sep=' // '
else: sep=', // '
if idiag in diag_to_channel: lines.append(" %+i%s%i --> %s"%( diag_to_channel[idiag], sep, idiag, diag_to_channel[idiag] ) )
else: lines.append(" %+i%s%i --> %s"%( -1, sep, idiag, 'None' ) )
replace_dict['diag_to_channel'] = '\n'.join(lines)
misc.sprint(replace_dict)

if self.include_multi_channel: # NB unnecessary as edit_coloramps is not called otherwise...
multi_channel = self.get_multi_channel_dictionary(self.matrix_elements[0].get('diagrams'), self.include_multi_channel)
replace_dict['is_LC'] = self.get_icolamp_lines(multi_channel, self.matrix_elements[0], 1)
replace_dict['nb_channel'] = len(multi_channel)
replace_dict['nb_color'] = max(1,len(self.matrix_elements[0].get('color_basis')))

misc.sprint(multi_channel)
misc.sprint(self.path, os.getcwd())
#raise Exception

# AV extra formatting (e.g. gg_tt was "{{true,true};,{true,false};,{false,true};};")
replace_dict['is_LC'] = replace_dict['is_LC'].replace(',',', ').replace('{{',' { ').replace('};, {',' },\n { ').replace('};};',' }')
ff.write(template % replace_dict)
Expand Down Expand Up @@ -1675,6 +1710,7 @@ def get_reset_jamp_lines(self, color_amplitudes):
if ret_lines != '' : ret_lines = ' // Reset jamp (reset color flows)\n' + ret_lines # AV THIS SHOULD NEVER HAPPEN!
return ret_lines


#------------------------------------------------------------------------------------

import madgraph.core.helas_objects as helas_objects
Expand Down
2 changes: 1 addition & 1 deletion epochX/cudacpp/CODEGEN/checkFormatting.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ function checkProcdir()
cd $TOPDIR
if [ ! -d $procdir ]; then echo "ERROR! Directory not found $TOPDIR/$procdir"; exit 1; fi
# Define the list of files to be checked
files=$(\ls $procdir/src/*.cc $procdir/src/*.h $procdir/SubProcesses/*.cc $procdir/SubProcesses/*.h $procdir/SubProcesses/P*/check_sa.cc $procdir/SubProcesses/P*/CPPProcess.cc $procdir/SubProcesses/P*/CPPProcess.h $procdir/SubProcesses/P*/epoch_process_id.h)
files=$(\ls $procdir/src/*.cc $procdir/src/*.h $procdir/SubProcesses/*.cc $procdir/SubProcesses/*.h $procdir/SubProcesses/P*/check_sa.cc $procdir/SubProcesses/P*/CPPProcess.cc $procdir/SubProcesses/P*/CPPProcess.h $procdir/SubProcesses/P*/epoch_process_id.h $procdir/SubProcesses/P*/coloramps.h)
if [ "$files" == "" ]; then echo "ERROR! No files to check found in directory $TOPDIR/$procdir"; exit 1; fi
# Check each file
status=0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1009,15 +1009,17 @@ 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 channelIdC = channelId - 1; // channelIdC_to_iconfig in coloramps.h uses the C array indexing starting at 0
const unsigned int iconfig = mgOnGpu::channelIdC_to_iconfig[channelIdC]; // map N_diagrams to N_config <= N_diagrams configs (see #826 and #852)
const unsigned int iconfigC = iconfig - 1; // icolamp in coloramps.h uses the C array indexing starting at 0
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 @@ -1052,7 +1054,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::channelIdC_to_iconfig
#else
#define _OMPLIST1
#endif
Expand Down Expand Up @@ -1124,15 +1126,17 @@ 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 channelIdC = channelId - 1; // channelIdC_to_iconfig in coloramps.h uses the C array indexing starting at 0
const unsigned int iconfig = mgOnGpu::channelIdC_to_iconfig[channelIdC]; // map N_diagrams to N_config <= N_diagrams configs (see #826 and #852)
const unsigned int iconfigC = iconfig - 1; // icolamp in coloramps.h uses the C array indexing starting at 0
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
fptype_sv targetamp2[ncolor] = { 0 };
Expand All @@ -1142,7 +1146,7 @@ namespace mg5amcCpu
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
Original file line number Diff line number Diff line change
@@ -1,21 +1,43 @@
// Copyright (C) 2020-2024 CERN and UCLouvain.
// Licensed under the GNU Lesser General Public License (version 3 or later).
// Created by: A. Valassi (Dec 2022) for the MG5aMC CUDACPP plugin.
// Further modified by: A. Valassi (2022-2024) for the MG5aMC CUDACPP plugin.
// Further modified by: O. Mattelaer, A. Valassi (2022-2024) for the MG5aMC CUDACPP plugin.

#ifndef COLORAMPS_H
#define COLORAMPS_H 1

namespace mgOnGpu
namespace mgOnGpu /* clang-format off */
{
// 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 ("channelId" in C, CHANNEL_ID in F) in [1, N_diagrams]: not all values are allowed (N_config <= N_diagrams distinct values)
// => this number (with F indexing) is passed around as an API argument between cudacpp functions
// - Channel number in C indexing: "channelIdC" = channelID - 1
// => this number (with C indexing) is used as the index of the channelIdC_to_iconfig array below
// - Config number ("iconfig" in C, ICONFIG in F) in [1, N_config]: all values are allowed (N_config <= N_diagrams distinct values)
// - Config number in C indexing: "iconfigC" = iconfig - 1

// Map channelIdC (in C indexing, i.e. channelId-1) to iconfig (in F indexing)
// This array has N_diagrams elements, but only N_config <= N_diagrams valid (non-zero) values
__device__ constexpr int channelIdC_to_iconfig[6] = {
0, // channelId=1 (diagram=1) i.e. channelIdC=0 --> iconfig=None
1, // channelId=2 (diagram=2) i.e. channelIdC=1 --> iconfig=1
2, // channelId=3 (diagram=3) i.e. channelIdC=2 --> iconfig=2
2, // channelId=4 (diagram=4) i.e. channelIdC=3 --> iconfig=3
3, // channelId=5 (diagram=5) i.e. channelIdC=4 --> iconfig=4
4 // channelId=6 (diagram=6) i.e. channelIdC=5 --> iconfig=5
};

// 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][2] = {
{ true, true },
{ true, true },
{ true, false },
{ true, false },
{ false, true }
{ true, true }, // iconfig=1 i.e. iconfigC=0
{ true, true }, // iconfig=2 i.e. iconfigC=1
{ true, false }, // iconfig=3 i.e. iconfigC=2
{ true, false }, // iconfig=4 i.e. iconfigC=3
{ false, true } // iconfig=5 i.e. iconfigC=4
};

}
} /* clang-format off */
#endif // COLORAMPS_H
Loading