Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' (including june24 madg…
Browse files Browse the repository at this point in the history
…raph5#822 and madgraph5#985) into goodhel

Fix conflicts:
- MG5aMC/mg5amcnlo (keep current version)
- epochX/cudacpp/CODEGEN/PLUGIN/CUDACPP_SA_OUTPUT/MG5aMC_patches/PROD/patch.P1 (use upstream/master, will rebuild anyway)
- epochX/cudacpp/gg_tt.mad/SubProcesses/P1_gg_ttx/auto_dsig1.f (keep goodhel comment style)
- epochX/cudacpp/gg_tt.mad/SubProcesses/P1_gg_ttx/matrix1.f (keep goodhel comment style)
- epochX/cudacpp/gg_tt.mad/bin/internal/file_writers.py (keep goodhel version)
  • Loading branch information
valassi committed Sep 3, 2024
2 parents f2f3fc2 + 6dd4ca8 commit b2b268a
Show file tree
Hide file tree
Showing 1,742 changed files with 804,182 additions and 87,327 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/c-cpp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name: C/C++ CI

on:
push:
branches: [ master ]
branches: [ master, master_june24 ]
pull_request:
branches: [ master ]
branches: [ master, master_june24 ]

jobs:
debug_builds:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/testsuite_allprocesses.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ on:

# Trigger the all-processes workflow for pull requests to master
pull_request:
branches: [ master ]
branches: [ master, master_june24 ]

# Trigger the all-processes workflow when new changes to the workflow are pushed
# (NB: this is now disabled to avoid triggering two jobs when pushing to a branch for which a PR is opened)
Expand Down
8 changes: 5 additions & 3 deletions .github/workflows/testsuite_oneprocess.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,11 @@ function ECHO() { echo " "; }
echo "Executing $0 $*"; ECHO
topdir=$(cd $(dirname $0)/../..; pwd)

# Disable OpenMP in the CI tests
# To do this, set OMPFLAGS externally to an empty string (#758)
export OMPFLAGS=
# Enable OpenMP in the CI tests? (#758)
###export USEOPENMP=1

# Debug channelid in MatrixElementKernelBase?
export MG5AMC_CHANNELID_DEBUG=1

# Bypass known issues?
BYPASS_KNOWN_ISSUES=0 # do not bypass known issues (fail)
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/testsuite_oneprocess.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,7 @@ on:
required: true
type: choice
# FIXME? Can the list of supported processes be specified only once in oneprocess.yml or allprocesses.yml?
options: [gg_tt.mad, gg_ttg.mad, gg_ttgg.mad, gg_ttggg.mad, ee_mumu.mad, nobm_pp_ttW.mad]
###options: [ee_mumu.mad, gg_tt.mad, gg_ttg.mad, gg_ttgg.mad, gg_ttggg.mad, gg_tt01g.mad, gq_ttq.mad, pp_tt012j.mad]
options: [gg_tt.mad, gg_ttg.mad, gg_ttgg.mad, gg_ttggg.mad, ee_mumu.mad, nobm_pp_ttW.mad, susy_gg_tt.mad]

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

Expand Down
Original file line number Diff line number Diff line change
@@ -1,163 +1,3 @@
diff --git b/epochX/cudacpp/gg_tt.mad/SubProcesses/P1_gg_ttx/auto_dsig1.f a/epochX/cudacpp/gg_tt.mad/SubProcesses/P1_gg_ttx/auto_dsig1.f
index 6ced79c09..b77a98309 100644
--- b/epochX/cudacpp/gg_tt.mad/SubProcesses/P1_gg_ttx/auto_dsig1.f
+++ a/epochX/cudacpp/gg_tt.mad/SubProcesses/P1_gg_ttx/auto_dsig1.f
@@ -484,23 +484,142 @@ C
INTEGER VECSIZE_USED

INTEGER IVEC
-
-
+ INTEGER IEXT
+
+ INTEGER ISUM_HEL
+ LOGICAL MULTI_CHANNEL
+ COMMON/TO_MATRIX/ISUM_HEL, MULTI_CHANNEL
+
+ LOGICAL FIRST_CHID
+ SAVE FIRST_CHID
+ DATA FIRST_CHID/.TRUE./
+
+#ifdef MG5AMC_MEEXPORTER_CUDACPP
+ INCLUDE 'coupl.inc' ! for ALL_G
+ INCLUDE 'fbridge.inc'
+ INCLUDE 'fbridge_common.inc'
+ INCLUDE 'genps.inc'
+ INCLUDE 'run.inc'
+ DOUBLE PRECISION OUT2(VECSIZE_MEMMAX)
+ INTEGER SELECTED_HEL2(VECSIZE_MEMMAX)
+ INTEGER SELECTED_COL2(VECSIZE_MEMMAX)
+ DOUBLE PRECISION CBYF1
+ INTEGER*4 NGOODHEL, NTOTHEL
+
+ INTEGER*4 NWARNINGS
+ SAVE NWARNINGS
+ DATA NWARNINGS/0/
+
+ LOGICAL FIRST
+ SAVE FIRST
+ DATA FIRST/.TRUE./
+
+ IF( FBRIDGE_MODE .LE. 0 ) THEN ! (FortranOnly=0 or BothQuiet=-1 or BothDebug=-2)
+#endif
+ call counters_smatrix1multi_start( -1, VECSIZE_USED ) ! fortranMEs=-1
!$OMP PARALLEL
!$OMP DO
- DO IVEC=1, VECSIZE_USED
- CALL SMATRIX1(P_MULTI(0,1,IVEC),
- & hel_rand(IVEC),
- & col_rand(IVEC),
- & channel,
- & IVEC,
- & out(IVEC),
- & selected_hel(IVEC),
- & selected_col(IVEC)
- & )
- ENDDO
+ DO IVEC=1, VECSIZE_USED
+ CALL SMATRIX1(P_MULTI(0,1,IVEC),
+ & hel_rand(IVEC),
+ & col_rand(IVEC),
+ & channel,
+ & IVEC,
+ & out(IVEC),
+ & selected_hel(IVEC),
+ & selected_col(IVEC)
+ & )
+ ENDDO
!$OMP END DO
!$OMP END PARALLEL
+ call counters_smatrix1multi_stop( -1 ) ! fortranMEs=-1
+#ifdef MG5AMC_MEEXPORTER_CUDACPP
+ ENDIF
+
+ IF( FBRIDGE_MODE .EQ. 1 .OR. FBRIDGE_MODE .LT. 0 ) THEN ! (CppOnly=1 or BothQuiet=-1 or BothDebug=-2)
+ IF( LIMHEL.NE.0 ) THEN
+ WRITE(6,*) 'ERROR! The cudacpp bridge only supports LIMHEL=0'
+ STOP
+ ENDIF
+ IF ( FIRST ) THEN ! exclude first pass (helicity filtering) from timers (#461)
+ call counters_smatrix1multi_start( 1, VECSIZE_USED ) ! cudacppHEL=1
+ CALL FBRIDGESEQUENCE_NOMULTICHANNEL( FBRIDGE_PBRIDGE, ! multi channel disabled for helicity filtering
+ & P_MULTI, ALL_G, HEL_RAND, COL_RAND, OUT2,
+ & SELECTED_HEL2, SELECTED_COL2, .TRUE.) ! quit after computing helicities
+ FIRST = .FALSE.
+c ! This is a workaround for https://github.com/oliviermattelaer/mg5amc_test/issues/22 (see PR #486)
+c IF( FBRIDGE_MODE .EQ. 1 ) THEN ! (CppOnly=1 : SMATRIX1 is not called at all)
+c CALL RESET_CUMULATIVE_VARIABLE() ! mimic 'avoid bias of the initialization' within SMATRIX1
+c ENDIF
+ CALL FBRIDGEGETNGOODHEL(FBRIDGE_PBRIDGE,NGOODHEL,NTOTHEL)
+ IF( NTOTHEL .NE. NCOMB ) THEN
+ WRITE(6,*) 'ERROR! Cudacpp/Fortran mismatch',
+ & ' in total number of helicities', NTOTHEL, NCOMB
+ STOP
+ ENDIF
+ WRITE (6,*) 'NGOODHEL =', NGOODHEL
+ WRITE (6,*) 'NCOMB =', NCOMB
+ call counters_smatrix1multi_stop( 1 ) ! cudacppHEL=1
+ ENDIF
+ call counters_smatrix1multi_start( 0, VECSIZE_USED ) ! cudacppMEs=0
+ IF ( .NOT. MULTI_CHANNEL ) THEN
+ CALL FBRIDGESEQUENCE_NOMULTICHANNEL( FBRIDGE_PBRIDGE, ! multi channel disabled
+ & P_MULTI, ALL_G, HEL_RAND, COL_RAND, OUT2,
+ & SELECTED_HEL2, SELECTED_COL2, .FALSE.) ! do not quit after computing helicities
+ ELSE
+ IF( SDE_STRAT.NE.1 ) THEN
+ WRITE(6,*) 'ERROR! The cudacpp bridge requires SDE=1' ! multi channel single-diagram enhancement strategy
+ STOP
+ ENDIF
+ CALL FBRIDGESEQUENCE(FBRIDGE_PBRIDGE, P_MULTI, ALL_G, ! multi channel enabled
+ & HEL_RAND, COL_RAND, CHANNEL, OUT2,
+ & SELECTED_HEL2, SELECTED_COL2, .FALSE.) ! do not quit after computing helicities
+ ENDIF
+ call counters_smatrix1multi_stop( 0 ) ! cudacppMEs=0
+ ENDIF
+
+ IF( FBRIDGE_MODE .LT. 0 ) THEN ! (BothQuiet=-1 or BothDebug=-2)
+ DO IVEC=1, VECSIZE_USED
+ CBYF1 = OUT2(IVEC)/OUT(IVEC) - 1
+ FBRIDGE_NCBYF1 = FBRIDGE_NCBYF1 + 1
+ FBRIDGE_CBYF1SUM = FBRIDGE_CBYF1SUM + CBYF1
+ FBRIDGE_CBYF1SUM2 = FBRIDGE_CBYF1SUM2 + CBYF1 * CBYF1
+ IF( CBYF1 .GT. FBRIDGE_CBYF1MAX ) FBRIDGE_CBYF1MAX = CBYF1
+ IF( CBYF1 .LT. FBRIDGE_CBYF1MIN ) FBRIDGE_CBYF1MIN = CBYF1
+ IF( FBRIDGE_MODE .EQ. -2 ) THEN ! (BothDebug=-2)
+ WRITE (*,'(I4,2E16.8,F23.11,I3,I3,I4,I4)')
+ & IVEC, OUT(IVEC), OUT2(IVEC), 1+CBYF1,
+ & SELECTED_HEL(IVEC), SELECTED_HEL2(IVEC),
+ & SELECTED_COL(IVEC), SELECTED_COL2(IVEC)
+ ENDIF
+ IF( ABS(CBYF1).GT.5E-5 .AND. NWARNINGS.LT.20 ) THEN
+ NWARNINGS = NWARNINGS + 1
+ WRITE (*,'(A,I4,A,I4,2E16.8,F23.11)')
+ & 'WARNING! (', NWARNINGS, '/20) Deviation more than 5E-5',
+ & IVEC, OUT(IVEC), OUT2(IVEC), 1+CBYF1
+ ENDIF
+ END DO
+ ENDIF
+
+ IF( FBRIDGE_MODE .EQ. 1 .OR. FBRIDGE_MODE .LT. 0 ) THEN ! (CppOnly=1 or BothQuiet=-1 or BothDebug=-2)
+ DO IVEC=1, VECSIZE_USED
+ OUT(IVEC) = OUT2(IVEC) ! use the cudacpp ME instead of the fortran ME!
+ SELECTED_HEL(IVEC) = SELECTED_HEL2(IVEC) ! use the cudacpp helicity instead of the fortran helicity!
+ SELECTED_COL(IVEC) = SELECTED_COL2(IVEC) ! use the cudacpp color instead of the fortran color!
+ END DO
+ ENDIF
+#endif
+
+ IF ( FIRST_CHID ) THEN
+ IF ( MULTI_CHANNEL ) THEN
+ WRITE (*,*) 'MULTI_CHANNEL = TRUE'
+ ELSE
+ WRITE (*,*) 'MULTI_CHANNEL = FALSE'
+ ENDIF
+ WRITE (*,*) 'CHANNEL_ID =', CHANNEL
+ FIRST_CHID = .FALSE.
+ ENDIF
+
RETURN
END

diff --git b/epochX/cudacpp/gg_tt.mad/SubProcesses/P1_gg_ttx/driver.f a/epochX/cudacpp/gg_tt.mad/SubProcesses/P1_gg_ttx/driver.f
index 1124a9164..27a6e4674 100644
--- b/epochX/cudacpp/gg_tt.mad/SubProcesses/P1_gg_ttx/driver.f
Expand Down Expand Up @@ -286,34 +126,34 @@ index 1124a9164..27a6e4674 100644
open(unit=lun,file=tempname,status='old',ERR=20)
fopened=.true.
diff --git b/epochX/cudacpp/gg_tt.mad/SubProcesses/P1_gg_ttx/matrix1.f a/epochX/cudacpp/gg_tt.mad/SubProcesses/P1_gg_ttx/matrix1.f
index 1acba8200..069c74ef4 100644
index 8b73188ef..710fd1297 100644
--- b/epochX/cudacpp/gg_tt.mad/SubProcesses/P1_gg_ttx/matrix1.f
+++ a/epochX/cudacpp/gg_tt.mad/SubProcesses/P1_gg_ttx/matrix1.f
@@ -71,7 +71,10 @@ C
@@ -72,7 +72,10 @@ C
DATA NB_FAIL /0/
DOUBLE PRECISION GET_CHANNEL_CUT
EXTERNAL GET_CHANNEL_CUT
-
+C
+ INTEGER NGOODHEL ! -1 if not yet retrieved and printed
+ INTEGER NGOODHEL(2) ! -1 if not yet retrieved and printed
+ SAVE NGOODHEL
+ DATA NGOODHEL/-1/
+ DATA NGOODHEL/-1,-1/
C
C This is just to temporarily store the reference grid for
C helicity of the DiscreteSampler so as to obtain its number of
@@ -211,6 +214,17 @@ C ----------
@@ -230,6 +233,17 @@ C update.
ENDIF
IF(NTRY(1).EQ.MAXTRIES)THEN
ISHEL=MIN(ISUM_HEL,NGOOD)
IF(NTRY(IMIRROR).EQ.MAXTRIES)THEN
ISHEL(IMIRROR)=MIN(ISUM_HEL,NGOOD(IMIRROR))
+C Print the number of good helicities
+ IF (NGOODHEL.EQ.-1) THEN
+ NGOODHEL=0
+ IF (NGOODHEL(IMIRROR).EQ.-1) THEN
+ NGOODHEL(IMIRROR)=0
+ DO I=1,NCOMB
+ IF (GOODHEL(I,1)) THEN
+ NGOODHEL=NGOODHEL+1
+ IF (GOODHEL(I,IMIRROR)) THEN
+ NGOODHEL(IMIRROR)=NGOODHEL(IMIRROR)+1
+ ENDIF
+ END DO
+ WRITE (6,*) 'NGOODHEL =', NGOODHEL
+ WRITE (6,*) 'NGOODHEL =', NGOODHEL(IMIRROR) ! no need to print imirror?
+ WRITE (6,*) 'NCOMB =', NCOMB
+ ENDIF
ENDIF
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
diff --git b/epochX/cudacpp/gg_tt.mad/SubProcesses/makefile a/epochX/cudacpp/gg_tt.mad/SubProcesses/makefile
index 348c283be..64b33c4f1 100644
index 348c283be..49e6800ff 100644
--- b/epochX/cudacpp/gg_tt.mad/SubProcesses/makefile
+++ a/epochX/cudacpp/gg_tt.mad/SubProcesses/makefile
@@ -1,6 +1,37 @@
Expand Down Expand Up @@ -62,7 +62,7 @@ index 348c283be..64b33c4f1 100644

LIBS = $(LIBDIR)libbias.$(libext) $(LIBDIR)libdhelas.$(libext) $(LIBDIR)libdsample.$(libext) $(LIBDIR)libgeneric.$(libext) $(LIBDIR)libpdf.$(libext) $(LIBDIR)libgammaUPC.$(libext) $(LIBDIR)libmodel.$(libext) $(LIBDIR)libcernlib.$(libext) $(MADLOOP_LIB) $(LOOP_LIBS)

@@ -43,41 +87,145 @@ ifeq ($(strip $(MATRIX_HEL)),)
@@ -43,41 +87,148 @@ ifeq ($(strip $(MATRIX_HEL)),)
endif


Expand Down Expand Up @@ -103,7 +103,11 @@ index 348c283be..64b33c4f1 100644
+else
+all: $(PROG)_fortran $(CUDACPP_BUILDDIR)/$(PROG)_cpp
+endif
+

-$(LIBDIR)libmodel.$(libext): ../../Cards/param_card.dat
- cd ../../Source/MODEL; make
+# Disable OpenMP by default: enable OpenMP only if USEOPENMP=1 (#758)
+ifeq ($(USEOPENMP),1)
+ifneq ($(shell $(CXX) --version | egrep '^Intel'),)
+override OMPFLAGS = -fopenmp
+LINKLIBS += -liomp5 # see #578
Expand All @@ -116,9 +120,8 @@ index 348c283be..64b33c4f1 100644
+else
+override OMPFLAGS = -fopenmp
+endif

-$(LIBDIR)libmodel.$(libext): ../../Cards/param_card.dat
- cd ../../Source/MODEL; make
+endif
+
+$(PROG)_fortran: $(PROCESS) $(DSIG) auto_dsig.o $(LIBS) $(MATRIX) counters.o ompnumthreads.o
+ $(FC) -o $(PROG)_fortran $(PROCESS) $(DSIG) auto_dsig.o $(MATRIX) $(LINKLIBS) $(BIASDEPENDENCIES) $(OMPFLAGS) counters.o ompnumthreads.o $(LDFLAGS)

Expand Down Expand Up @@ -224,7 +227,7 @@ index 348c283be..64b33c4f1 100644

# Dependencies

@@ -97,5 +245,80 @@ unwgt.o: genps.inc nexternal.inc symswap.inc cluster.inc run.inc message.inc \
@@ -97,5 +248,80 @@ unwgt.o: genps.inc nexternal.inc symswap.inc cluster.inc run.inc message.inc \
run_config.inc
initcluster.o: message.inc

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ def reset_simd(self, old_value, new_value, name):
if name == "vector_size" and new_value <= int(old_value):
# code can handle the new size -> do not recompile
return

# ok need to force recompilation of the cpp part
Sourcedir = pjoin(os.path.dirname(os.path.dirname(self.path)), 'Source')
subprocess.call(['make', 'cleanall'], cwd=Sourcedir, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)

Expand Down Expand Up @@ -104,7 +106,7 @@ def default_setup(self):
def write_one_include_file(self, output_dir, incname, output_file=None):
"""write one include file at the time"""
if incname == "vector.inc":
if 'vector_size' not in self.user_set: return
if 'vector_size' not in self.user_set and 'wrap_size' not in self.user_set: return
if output_file is None: vectorinc=pjoin(output_dir,incname)
else: vectorinc=output_file
with open(vectorinc+'.new','w') as fileout:
Expand Down
Loading

0 comments on commit b2b268a

Please sign in to comment.