Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
a63d327
[hel] empty commit with some timing logs for reference in gg_ttggg
valassi Aug 8, 2024
017b2e1
[hel] in gg_ttggg.mad (and CODEGEN manually changing patch.P1) matrix…
valassi Aug 8, 2024
3bc7e26
[hel] regenerate gg_ttggg.mad - ok, only some empty lines change (wil…
valassi Aug 8, 2024
c6d71c3
[hel] in gg_ttggg.mad auto_dsig1.f and counters.cc, add counters for …
valassi Aug 8, 2024
07759dc
Merge remote-tracking branch 'upstream/master' (including clang-forma…
valassi Aug 8, 2024
ca79a65
[hel] in gg_ttggg.mad and CODEGEN counters.cc, improve counters for C…
valassi Aug 8, 2024
ba8c928
[hel] in gg_ttggg.mad (and CODEGEN manually changing patch.P1) fbridg…
valassi Aug 8, 2024
3a48da8
[hel] regenerate gg_ttggg.mad, check all is ok (matrix1.pdf changed, …
valassi Aug 8, 2024
4431f70
[hel] regenerate gg_tt.mad with the patches from gg_ttggg.mad
valassi Aug 8, 2024
dc5551d
[hel] regenerate CODEGEN patch from gg_tt.mad to reduce the risk of m…
valassi Aug 8, 2024
2070ad5
[hel] in CODEGEN/generateAndCompare.sh, improve handling of matrix1.p…
valassi Aug 8, 2024
6e42038
[hel] manually fix matrix1.pdf in ggttggg.mad using the awk command I…
valassi Aug 8, 2024
94db0f9
[hel] regenerate gg_tt.mad, check that all is ok
valassi Aug 8, 2024
9fb9d98
[hel] in CODEGEN fcheck_sa.f bg fix, reaplce hardcoded value for ggtt…
valassi Aug 8, 2024
8c10ea7
[hel] regenerate all processes
valassi Aug 8, 2024
19af635
[hel] rerun ggtt tmad test just to check that all is ok - will launch…
valassi Aug 8, 2024
c6956e5
[hel] rerun 102 tput tests on itscrd90 - all ok
valassi Aug 9, 2024
f56964c
[hel] rerun 30 tmad tests on itscrd90 - all as expected (failures in …
valassi Aug 9, 2024
926958a
[hel] minor fixes in tput/gitdifftput.sh
valassi Aug 9, 2024
c2d3116
[mac] in .github/workflows/c-cpp.yml, move from gfortran-11 to gfortr…
valassi Aug 21, 2024
92abe01
[hel] move to CODEGEN logs from the latest upstream/master for easier…
valassi Aug 21, 2024
ca2eac5
Merge remote-tracking branch 'upstream/master' (including fixes for C…
valassi Aug 21, 2024
f05273d
Merge branch 'mac' (with CI fixes moving to gfortran-14 on mac PR #97…
valassi Aug 21, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion .github/workflows/c-cpp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
CPU_MAC:
runs-on: macos-latest
env:
FC: gfortran-11
FC: gfortran-14 # see #971
strategy:
matrix:
folder: [ epochX/cudacpp/ee_mumu.mad/SubProcesses/P1_epem_mupmum, epochX/cudacpp/gg_ttgg.mad/SubProcesses/P1_gg_ttxgg ]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
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 4fbb8e6ba..f9e2335de 100644
index 4fbb8e6ba..d5accb9fb 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,140 @@ C
@@ -484,23 +484,142 @@ C
INTEGER VECSIZE_USED

INTEGER IVEC
Expand Down Expand Up @@ -40,7 +40,7 @@ index 4fbb8e6ba..f9e2335de 100644
+
+ IF( FBRIDGE_MODE .LE. 0 ) THEN ! (FortranOnly=0 or BothQuiet=-1 or BothDebug=-2)
+#endif
+ call counters_smatrix1multi_start( -1, VECSIZE_USED ) ! fortran=-1
+ call counters_smatrix1multi_start( -1, VECSIZE_USED ) ! fortranMEs=-1
!$OMP PARALLEL
!$OMP DO
- DO IVEC=1, VECSIZE_USED
Expand All @@ -67,7 +67,7 @@ index 4fbb8e6ba..f9e2335de 100644
+ ENDDO
!$OMP END DO
!$OMP END PARALLEL
+ call counters_smatrix1multi_stop( -1 ) ! fortran=-1
+ call counters_smatrix1multi_stop( -1 ) ! fortranMEs=-1
+#ifdef MG5AMC_MEEXPORTER_CUDACPP
+ ENDIF
+
Expand All @@ -77,9 +77,10 @@ index 4fbb8e6ba..f9e2335de 100644
+ 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 )
+ & 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)
+ IF( FBRIDGE_MODE .EQ. 1 ) THEN ! (CppOnly=1 : SMATRIX1 is not called at all)
Expand All @@ -93,22 +94,23 @@ index 4fbb8e6ba..f9e2335de 100644
+ ENDIF
+ WRITE (6,*) 'NGOODHEL =', NGOODHEL
+ WRITE (6,*) 'NCOMB =', NCOMB
+ call counters_smatrix1multi_stop( 1 ) ! cudacppHEL=1
+ ENDIF
+ call counters_smatrix1multi_start( 0, VECSIZE_USED ) ! cudacpp=0
+ 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 )
+ & 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,
+ CALL FBRIDGESEQUENCE(FBRIDGE_PBRIDGE, P_MULTI, ALL_G, ! multi channel enabled
+ & HEL_RAND, COL_RAND, CHANNEL, OUT2,
+ & SELECTED_HEL2, SELECTED_COL2 ) ! 1-N: multi channel enabled
+ & SELECTED_HEL2, SELECTED_COL2, .FALSE.) ! do not quit after computing helicities
+ ENDIF
+ call counters_smatrix1multi_stop( 0 ) ! cudacpp=0
+ call counters_smatrix1multi_stop( 0 ) ! cudacppMEs=0
+ ENDIF
+
+ IF( FBRIDGE_MODE .LT. 0 ) THEN ! (BothQuiet=-1 or BothDebug=-2)
Expand Down Expand Up @@ -284,7 +286,7 @@ 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 e73e654d4..27fbe7302 100644
index e73e654d4..3072054f2 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
@@ -72,7 +72,10 @@ C
Expand All @@ -299,15 +301,7 @@ index e73e654d4..27fbe7302 100644
C
C This is just to temporarily store the reference grid for
C helicity of the DiscreteSampler so as to obtain its number of
@@ -140,6 +143,7 @@ C ----------
C BEGIN CODE
C ----------

+ call counters_smatrix1_start()
NTRY(IMIRROR)=NTRY(IMIRROR)+1
THIS_NTRY(IMIRROR) = THIS_NTRY(IMIRROR)+1
DO I=1,NEXTERNAL
@@ -217,6 +221,17 @@ C ----------
@@ -217,6 +220,17 @@ C ----------
ENDIF
IF(NTRY(IMIRROR).EQ.MAXTRIES)THEN
ISHEL(IMIRROR)=MIN(ISUM_HEL,NGOOD(IMIRROR))
Expand All @@ -325,22 +319,3 @@ index e73e654d4..27fbe7302 100644
ENDIF
ENDIF
ELSE IF (.NOT.INIT_MODE) THEN ! random helicity
@@ -234,6 +249,7 @@ C Include the Jacobian from helicity sampling
IHEL = HEL_PICKED
ELSE
ANS = 1D0
+ call counters_smatrix1_stop()
RETURN
ENDIF
IF (ANS.NE.0D0.AND.(ISUM_HEL .NE. 1.OR.HEL_PICKED.EQ.-1)) THEN
@@ -278,9 +294,8 @@ C Set right sign for ANS, based on sign of chosen helicity
ENDIF
ENDIF
ANS=ANS/DBLE(IDEN)
-
CALL SELECT_COLOR(RCOL, JAMP2, ICONFIG,1, ICOL)
-
+ call counters_smatrix1_stop()
END


Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,9 @@ namespace mg5amcCpu
* @param rndcol the pointer to the input random numbers for color selection
* @param channelId the Feynman diagram to enhance in multi-channel mode if 1 to n (disable multi-channel if 0)
* @param mes the pointer to the output matrix elements
* @param goodHelOnly quit after computing good helicities?
* @param selhel the pointer to the output selected helicities
* @param selcol the pointer to the output selected colors
* @param goodHelOnly quit after computing good helicities?
*/
void gpu_sequence( const FORTRANFPTYPE* momenta,
const FORTRANFPTYPE* gs,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,26 +21,24 @@ extern "C"
{
// Now: fortran=-1, cudacpp=0
// Eventually: fortran=-1, cuda=0, cpp/none=1, cpp/sse4=2, etc...
constexpr unsigned int nimplC = 2;
constexpr unsigned int nimplC = 3;
constexpr unsigned int iimplF2C( int iimplF ) { return iimplF + 1; }
const char* iimplC2TXT( int iimplC )
{
const int iimplF = iimplC - 1;
switch( iimplF )
{
case -1: return "Fortran"; break;
case +0: return "CudaCpp"; break;
case -1: return "Fortran MEs"; break;
case +0: return "CudaCpp MEs"; break;
case +1: return "CudaCpp HEL"; break;
default: assert( false ); break;
}
}

static mgOnGpu::Timer<TIMERTYPE> program_timer;
static float program_totaltime = 0;
static mgOnGpu::Timer<TIMERTYPE> smatrix1_timer;
static float smatrix1_totaltime = 0;
static mgOnGpu::Timer<TIMERTYPE> smatrix1multi_timer[nimplC];
static float smatrix1multi_totaltime[nimplC] = { 0 };
static int smatrix1_counter = 0;
static int smatrix1multi_counter[nimplC] = { 0 };

void counters_initialise_()
Expand All @@ -49,19 +47,6 @@ extern "C"
return;
}

void counters_smatrix1_start_()
{
smatrix1_counter++;
smatrix1_timer.Start();
return;
}

void counters_smatrix1_stop_()
{
smatrix1_totaltime += smatrix1_timer.GetDuration();
return;
}

void counters_smatrix1multi_start_( const int* iimplF, const int* pnevt )
{
const unsigned int iimplC = iimplF2C( *iimplF );
Expand All @@ -86,13 +71,23 @@ extern "C"
printf( " [COUNTERS] PROGRAM TOTAL : %9.4fs\n", program_totaltime );
printf( " [COUNTERS] Fortran Overhead ( 0 ) : %9.4fs\n", overhead_totaltime );
for( unsigned int iimplC = 0; iimplC < nimplC; iimplC++ )
{
if( smatrix1multi_counter[iimplC] > 0 )
printf( " [COUNTERS] %7s MEs ( %1d ) : %9.4fs for %8d events => throughput is %8.2E events/s\n",
iimplC2TXT( iimplC ),
iimplC + 1,
smatrix1multi_totaltime[iimplC],
smatrix1multi_counter[iimplC],
smatrix1multi_counter[iimplC] / smatrix1multi_totaltime[iimplC] );
{
if( iimplC < nimplC - 1 ) // MEs
printf( " [COUNTERS] %11s ( %1d ) : %9.4fs for %8d events => throughput is %8.2E events/s\n",
iimplC2TXT( iimplC ),
iimplC + 1,
smatrix1multi_totaltime[iimplC],
smatrix1multi_counter[iimplC],
smatrix1multi_counter[iimplC] / smatrix1multi_totaltime[iimplC] );
else
printf( " [COUNTERS] %11s ( %1d ) : %9.4fs\n",
iimplC2TXT( iimplC ),
iimplC + 1,
smatrix1multi_totaltime[iimplC] );
}
}
return;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ extern "C"
* @param mes the pointer to the output matrix elements
* @param selhel the pointer to the output selected helicities
* @param selcol the pointer to the output selected colors
* @param goodHelOnly quit after computing good helicities?
*/
void fbridgesequence_( CppObjectInFortran** ppbridge,
const FORTRANFPTYPE* momenta,
Expand All @@ -92,18 +93,20 @@ extern "C"
const unsigned int* pchannelId,
FORTRANFPTYPE* mes,
int* selhel,
int* selcol )
int* selcol,
const bool* pgoodHelOnly )
{
Bridge<FORTRANFPTYPE>* pbridge = dynamic_cast<Bridge<FORTRANFPTYPE>*>( *ppbridge );
//printf("fbridgesequence_ goodHelOnly=%d\n", ( *pgoodHelOnly ? 1 : 0 ) );
if( pbridge == 0 ) throw std::runtime_error( "fbridgesequence_: invalid Bridge address" );
#ifdef MGONGPUCPP_GPUIMPL
// Use the device/GPU implementation in the CUDA library
// (there is also a host implementation in this library)
pbridge->gpu_sequence( momenta, gs, rndhel, rndcol, ( pchannelId ? *pchannelId : 0 ), mes, selhel, selcol );
pbridge->gpu_sequence( momenta, gs, rndhel, rndcol, ( pchannelId ? *pchannelId : 0 ), mes, selhel, selcol, *pgoodHelOnly );
#else
// Use the host/CPU implementation in the C++ library
// (there is no device implementation in this library)
pbridge->cpu_sequence( momenta, gs, rndhel, rndcol, ( pchannelId ? *pchannelId : 0 ), mes, selhel, selcol );
pbridge->cpu_sequence( momenta, gs, rndhel, rndcol, ( pchannelId ? *pchannelId : 0 ), mes, selhel, selcol, *pgoodHelOnly );
#endif
}

Expand All @@ -119,6 +122,7 @@ extern "C"
* @param mes the pointer to the output matrix elements
* @param selhel the pointer to the output selected helicities
* @param selcol the pointer to the output selected colors
* @param goodHelOnly quit after computing good helicities?
*/
void fbridgesequence_nomultichannel_( CppObjectInFortran** ppbridge,
const FORTRANFPTYPE* momenta,
Expand All @@ -127,9 +131,11 @@ extern "C"
const FORTRANFPTYPE* rndcol,
FORTRANFPTYPE* mes,
int* selhel,
int* selcol )
int* selcol,
const bool* pgoodHelOnly )
{
fbridgesequence_( ppbridge, momenta, gs, rndhel, rndcol, nullptr, mes, selhel, selcol );
//printf("fbridgesequence_nomultichannel_ goodHelOnly=%d\n", ( *pgoodHelOnly ? 1 : 0 ) );
fbridgesequence_( ppbridge, momenta, gs, rndhel, rndcol, nullptr, mes, selhel, selcol, pgoodHelOnly );
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,11 @@ C - CHANID: the input Feynman diagram to enhance in multi-channel mode if 1 to
C - MES: the output matrix element Fortran array
C - SELHEL: the output selected helicity Fortran array
C - SELCOL: the output selected color Fortran array
C - HELONLY: input flag, quit after computing good helicities?
C
INTERFACE
SUBROUTINE FBRIDGESEQUENCE(PBRIDGE, MOMENTA, GS,
& RNDHEL, RNDCOL, CHANID, MES, SELHEL, SELCOL)
& RNDHEL, RNDCOL, CHANID, MES, SELHEL, SELCOL, HELONLY)
INTEGER*8 PBRIDGE
DOUBLE PRECISION MOMENTA(*)
DOUBLE PRECISION GS(*)
Expand All @@ -53,6 +54,7 @@ C
DOUBLE PRECISION MES(*)
INTEGER*4 SELHEL(*)
INTEGER*4 SELCOL(*)
LOGICAL HELONLY
END SUBROUTINE FBRIDGESEQUENCE
END INTERFACE

Expand All @@ -66,10 +68,11 @@ C - RNDCOL: the input random number Fortran array for color selection
C - MES: the output matrix element Fortran array
C - SELHEL: the output selected helicity Fortran array
C - SELCOL: the output selected color Fortran array
C - HELONLY: input flag, quit after computing good helicities?
C
INTERFACE
SUBROUTINE FBRIDGESEQUENCE_NOMULTICHANNEL(PBRIDGE, MOMENTA, GS,
& RNDHEL, RNDCOL, MES, SELHEL, SELCOL)
& RNDHEL, RNDCOL, MES, SELHEL, SELCOL, HELONLY)
INTEGER*8 PBRIDGE
DOUBLE PRECISION MOMENTA(*)
DOUBLE PRECISION GS(*)
Expand All @@ -78,6 +81,7 @@ C
DOUBLE PRECISION MES(*)
INTEGER*4 SELHEL(*)
INTEGER*4 SELCOL(*)
LOGICAL HELONLY
END SUBROUTINE FBRIDGESEQUENCE_NOMULTICHANNEL
END INTERFACE

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ PROGRAM FCHECK_SA
GS(IEVT) = 1.2177157847767195 ! fixed G for aS=0.118 (hardcoded for now in check_sa.cc, fcheck_sa.f, runTest.cc)
END DO
CALL FBRIDGESEQUENCE_NOMULTICHANNEL(BRIDGE, MOMENTA, GS, ! TEMPORARY? disable multi-channel in fcheck.exe and fgcheck.exe #466
& RNDHEL, RNDCOL, MES, SELHEL, SELCOL)
& RNDHEL, RNDCOL, MES, SELHEL, SELCOL, .FALSE.) ! do not quit after computing helicities
DO IEVT = 1, NEVT
c DO IEXTERNAL = 1, NEXTERNAL
c WRITE(6,*) 'MOMENTA', IEVT, IEXTERNAL,
Expand Down
1 change: 1 addition & 0 deletions epochX/cudacpp/CODEGEN/generateAndCompare.sh
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,7 @@ function codeGenAndDiff()
| awk -vdate="D:20240301000000+01'00'" '{print gensub("(^/ModDate\\().*(\\)>>endobj$)","\\1"date"\\2","g")}' \
| awk -vdate="D:20240301000000+01'00'" '{print gensub("(^/CreationDate\\().*(\\)$)","\\1"date"\\2","g")}' \
| awk -vid="0123456789abcdef0123456789abcdef" '{print gensub("(^/ID \\[<).*><.*(>\\]$)","\\1"id"><"id"\\2","g")}' \
| awk -vid="0123456789abcdef0123456789abcdef" '{print gensub("(^/ID \\[\\().*\\)\\(.*(\\)\\]$)","\\1"id")("id"\\2","g")}' \
| awk -vdate="2024-03-01T00:00:00+01:00" '{print gensub("(<xmp:ModifyDate>).*(</xmp:ModifyDate>)","\\1"date"\\2","g")}' \
| awk -vdate="2024-03-01T00:00:00+01:00" '{print gensub("(<xmp:CreateDate>).*(</xmp:CreateDate>)","\\1"date"\\2","g")}' \
| awk -vuuid="'uuid=01234567-89ab-cdef-0123-456789abcdef'" '{print gensub("(xapMM:DocumentID=).*(/>$)","\\1"uuid"\\2","g")}' \
Expand Down
2 changes: 1 addition & 1 deletion epochX/cudacpp/ee_mumu.mad/SubProcesses/Bridge.h
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,9 @@ namespace mg5amcCpu
* @param rndcol the pointer to the input random numbers for color selection
* @param channelId the Feynman diagram to enhance in multi-channel mode if 1 to n (disable multi-channel if 0)
* @param mes the pointer to the output matrix elements
* @param goodHelOnly quit after computing good helicities?
* @param selhel the pointer to the output selected helicities
* @param selcol the pointer to the output selected colors
* @param goodHelOnly quit after computing good helicities?
*/
void gpu_sequence( const FORTRANFPTYPE* momenta,
const FORTRANFPTYPE* gs,
Expand Down
Loading