Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
ce57dda
[mch] in gg_tt.mad, remove #ifdef MGONGPU_SUPPORTS_MULTICHANNEL and a…
valassi Nov 23, 2023
71b6a74
[mch] backport to codegen from gg_tt.mad the removal of #ifdef MGONGP…
valassi Nov 23, 2023
23f750f
[mch] regenerate gg_tt.mad, all ok
valassi Nov 23, 2023
f42c4bb
[mch] regenerate gg_tt.sa, "without multichannel" but with the same c…
valassi Nov 23, 2023
18b060b
[mch] revert to upstream/master )revert the last four commits)
valassi Nov 23, 2023
d5c4c1b
[mch] in gg_tt.mad, add fbridgesequence_nomultichannel as discussed w…
valassi Nov 23, 2023
59b4a34
[mch] backport from gg_tt.mad to codegen the addition of fbridgeseque…
valassi Nov 23, 2023
980b321
[mch] regenerate codegen patches from gg_tt.mad
valassi Nov 23, 2023
aabf6c6
[mch] regenerate gg_tt.mad with latest codegen, all ok no changes
valassi Nov 23, 2023
a395efb
[mch] rerun tput and tmad tests for ggtt.mad as a cross check, all ok…
valassi Nov 23, 2023
a5323b2
[mch] revert to upstream/master tput/tmad logs
valassi Nov 23, 2023
26d6f15
[mch] regenerate ggtt.sa and test that builds are ok
valassi Nov 23, 2023
05f9796
[mch] ** COMPLETE MCH (but need to merge in upstream/master including…
valassi Nov 23, 2023
ff7e3c2
Merge remote-tracking branch 'upstream/master' (including merged PR #…
valassi Dec 16, 2023
d2ebfb9
[mch] ** COMPLETE MCH ** regenerate all processes (after merging in u…
valassi Dec 16, 2023
89fce3e
[mch] prepare to merge upstream/master - go back to CODEGEN logs from…
valassi Feb 3, 2024
62744a6
Merge remote-tracking branch 'upstream/master' (including HIP PR #801…
valassi Feb 3, 2024
5676713
[mch] regenerate all processes after merging - no change except for C…
valassi Feb 3, 2024
db75e8a
[mch] rerun 78 tput tests on itscrd90, all ok
valassi Feb 4, 2024
d9951d0
[mch] **COMPLETE MCH (after merging #801 and #811 and maybe more) ** …
valassi Feb 4, 2024
b55b207
[mch] check out tput/tmad and codegen logs from upstream/master to ea…
valassi Feb 6, 2024
1d59c1c
Merge remote-tracking branch 'upstream/master' (including PR #368) in…
valassi Feb 6, 2024
9fab474
[mch] in gg_tt.mad testmisc.cc, add a test to demonstrate multiplicat…
valassi Feb 7, 2024
0d2a508
[mch] in CODEGEN testmisc.cc (backport gg_tt.mad), add a test to demo…
valassi Feb 7, 2024
cc882e4
[mch] in CODEGEN and gg_tt.mad, fix clang formatting of test added to…
valassi Feb 7, 2024
ee3cd7b
[mch] manually copy the updated testmisc.cc to all generated processes
valassi Feb 7, 2024
bd581e7
[mch] **COMPLETE MCH (after merging #368 plus minor changes) ** impro…
valassi Feb 7, 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
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
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 880769442..5a3da931f 100644
index 0a3dfa449..8f4aaecd6 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
Expand Down Expand Up @@ -77,9 +77,9 @@ index 880769442..5a3da931f 100644
+ STOP
+ ENDIF
+ IF ( FIRST ) THEN ! exclude first pass (helicity filtering) from timers (#461)
+ CALL FBRIDGESEQUENCE(FBRIDGE_PBRIDGE, P_MULTI, ALL_G,
+ & HEL_RAND, COL_RAND, 0, OUT2,
+ & SELECTED_HEL2, SELECTED_COL2 ) ! 0: multi channel disabled for helicity filtering
+ CALL FBRIDGESEQUENCE_NOMULTICHANNEL( FBRIDGE_PBRIDGE, ! multi channel disabled for helicity filtering
+ & P_MULTI, ALL_G, HEL_RAND, COL_RAND, OUT2,
+ & SELECTED_HEL2, SELECTED_COL2 )
+ 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 @@ -96,9 +96,9 @@ index 880769442..5a3da931f 100644
+ ENDIF
+ call counters_smatrix1multi_start( 0, VECSIZE_USED ) ! cudacpp=0
+ IF ( .NOT. MULTI_CHANNEL ) THEN
+ CALL FBRIDGESEQUENCE(FBRIDGE_PBRIDGE, P_MULTI, ALL_G,
+ & HEL_RAND, COL_RAND, 0, OUT2,
+ & SELECTED_HEL2, SELECTED_COL2 ) ! 0: multi channel disabled
+ CALL FBRIDGESEQUENCE_NOMULTICHANNEL( FBRIDGE_PBRIDGE, ! multi channel disabled
+ & P_MULTI, ALL_G, HEL_RAND, COL_RAND, OUT2,
+ & SELECTED_HEL2, SELECTED_COL2 )
+ ELSE
+ IF( SDE_STRAT.NE.1 ) THEN
+ WRITE(6,*) 'ERROR! The cudacpp bridge requires SDE=1' ! multi channel single-diagram enhancement strategy
Expand Down Expand Up @@ -284,7 +284,7 @@ index 71fbf2b25..0f1d199fc 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 3ac962688..daea73a6d 100644
index 817af778b..0c2ce6ec4 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 Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ index 617f10b93..00c73099a 100644
+cleanall: cleanSource # THIS IS THE ONE
+ for i in `ls -d ../SubProcesses/P*`; do cd $$i; make cleanavxs; cd -; done;
diff --git b/epochX/cudacpp/gg_tt.mad/SubProcesses/makefile a/epochX/cudacpp/gg_tt.mad/SubProcesses/makefile
index 348c283be..65369d610 100644
index 348c283be..d572486c2 100644
--- b/epochX/cudacpp/gg_tt.mad/SubProcesses/makefile
+++ a/epochX/cudacpp/gg_tt.mad/SubProcesses/makefile
@@ -1,6 +1,28 @@
Expand Down Expand Up @@ -297,10 +297,10 @@ index 348c283be..65369d610 100644
+distclean: cleanall # Clean all fortran and cudacpp builds as well as the googletest installation
+ $(MAKE) -f $(CUDACPP_MAKEFILE) distclean
diff --git b/epochX/cudacpp/gg_tt.mad/bin/internal/gen_ximprove.py a/epochX/cudacpp/gg_tt.mad/bin/internal/gen_ximprove.py
index ebbc1ac1d..a88d60b28 100755
index fb7efa87c..5fd170d18 100755
--- b/epochX/cudacpp/gg_tt.mad/bin/internal/gen_ximprove.py
+++ a/epochX/cudacpp/gg_tt.mad/bin/internal/gen_ximprove.py
@@ -385,8 +385,20 @@ class gensym(object):
@@ -391,8 +391,20 @@ class gensym(object):
done = True
if not done:
raise Exception('Parsing error in gensym: %s' % stdout)
Expand All @@ -324,7 +324,7 @@ index ebbc1ac1d..a88d60b28 100755
self.submit_to_cluster(job_list)
job_list = {}
diff --git b/epochX/cudacpp/gg_tt.mad/bin/internal/madevent_interface.py a/epochX/cudacpp/gg_tt.mad/bin/internal/madevent_interface.py
index 389b93ab8..d72270289 100755
index 8c509e83f..cb6bf4ca5 100755
--- b/epochX/cudacpp/gg_tt.mad/bin/internal/madevent_interface.py
+++ a/epochX/cudacpp/gg_tt.mad/bin/internal/madevent_interface.py
@@ -3614,8 +3614,20 @@ Beware that this can be dangerous for local multicore runs.""")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,14 +99,39 @@ extern "C"
#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, mes, selhel, selcol );
pbridge->gpu_sequence( momenta, gs, rndhel, rndcol, ( pchannelId ? *pchannelId : 0 ), mes, selhel, selcol );
#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, mes, selhel, selcol );
pbridge->cpu_sequence( momenta, gs, rndhel, rndcol, ( pchannelId ? *pchannelId : 0 ), mes, selhel, selcol );
#endif
}

/**
* Execute the matrix-element calculation "sequence" via a Bridge on GPU/CUDA or CUDA/C++, without multi-channel mode.
* This is a C symbol that should be called from the Fortran code (in auto_dsig1.f).
*
* @param ppbridge the pointer to the Bridge pointer (the Bridge pointer is handled in Fortran as an INTEGER*8 variable)
* @param momenta the pointer to the input 4-momenta
* @param gs the pointer to the input Gs (running QCD coupling constant alphas)
* @param rndhel the pointer to the input random numbers for helicity selection
* @param rndcol the pointer to the input random numbers for color selection
* @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
*/
void fbridgesequence_nomultichannel_( CppObjectInFortran** ppbridge,
const FORTRANFPTYPE* momenta,
const FORTRANFPTYPE* gs,
const FORTRANFPTYPE* rndhel,
const FORTRANFPTYPE* rndcol,
FORTRANFPTYPE* mes,
int* selhel,
int* selcol )
{
fbridgesequence_( ppbridge, momenta, gs, rndhel, rndcol, nullptr, mes, selhel, selcol );
}

/**
* Retrieve the number of good helicities for helicity filtering in the Bridge.
* This is a C symbol that should be called from the Fortran code (in auto_dsig1.f).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ C - MOMENTA: the input 4-momenta Fortran array
C - GS: the input Gs (running QCD coupling constant alphas) Fortran array
C - RNDHEL: the input random number Fortran array for helicity selection
C - RNDCOL: the input random number Fortran array for color selection
C - CHANID: the input Feynman diagram to enhance in multi-channel mode if 1 to n (disable multi-channel if 0)
C - CHANID: the input Feynman diagram to enhance in multi-channel mode if 1 to n
C - MES: the output matrix element Fortran array
C - SELHEL: the output selected helicity Fortran array
C - SELCOL: the output selected color Fortran array
Expand All @@ -56,6 +56,31 @@ C
END SUBROUTINE FBRIDGESEQUENCE
END INTERFACE

C
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I cannot leave a comment in code that was not changed, but I would propose in the line 52 above to change to

INTEGER*4 CHANID(*)

I have done this change in the new_interface_wrap branch, see

and this seems to work correctly.

Copy link
Member Author

@valassi valassi Feb 6, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @roiser thanks for having a look.

I think these are two different issues:

  • in my PR here, channelid is still a scalar, and so this must be CHANID and not CHANID(*)
  • in your upcoming PR, you will indeed need to change CHANID to CHANID(*)

Specifically, if I simply change myself CHANID to CHANID(*). then this fails the build

ccache /cvmfs/sft.cern.ch/lcg/releases/gcc/12.1.0-57c96/x86_64-centos9/bin/gfortran -w -fPIC -O3 -ffast-math -fbounds-check -ffixed-line-length-132 -w -cpp -c -DMG5AMC_MEEXPORTER_CUDACPP auto_dsig1.f -I../../Source/ -fopenmp -o auto_dsig1_cudacpp.o
auto_dsig1.f:573:32:

  573 |      &      HEL_RAND, COL_RAND, CHANNEL, OUT2,
      |                                1
Error: Rank mismatch in argument 'chanid' at (1) (rank-1 and scalar)

I would suggest to keep this in two different PRs

  • here I just add the new method and keep CHANID
  • in your PR you will then change CHANID to CHANID(*)

Does this sound ok? Please let me know if you think this can be merged @roiser thanks

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But this PR emerged out of the work for channel id arrays. If I do not remember correctly and it was done for another purpose please merge this here and I would adapt then with the later channel id PR if needed.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No it was indeed done for that purpose. But it does not harm to include it anyway (it does simplify one function call without multichannel support). I would include it anyway now so that there is no need for further conflict fixes etc. It makes completely sense by itself and was fully tested by itself.

C Execute the matrix-element calculation "sequence" via a Bridge on GPU/CUDA or CUDA/C++.
C - PBRIDGE: the memory address of the C++ Bridge
C - MOMENTA: the input 4-momenta Fortran array
C - GS: the input Gs (running QCD coupling constant alphas) Fortran array
C - RNDHEL: the input random number Fortran array for helicity selection
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
INTERFACE
SUBROUTINE FBRIDGESEQUENCE_NOMULTICHANNEL(PBRIDGE, MOMENTA, GS,
& RNDHEL, RNDCOL, MES, SELHEL, SELCOL)
INTEGER*8 PBRIDGE
DOUBLE PRECISION MOMENTA(*)
DOUBLE PRECISION GS(*)
DOUBLE PRECISION RNDHEL(*)
DOUBLE PRECISION RNDCOL(*)
DOUBLE PRECISION MES(*)
INTEGER*4 SELHEL(*)
INTEGER*4 SELCOL(*)
END SUBROUTINE FBRIDGESEQUENCE_NOMULTICHANNEL
END INTERFACE

C
C Retrieve the number of good helicities for helicity filtering in the Bridge.
C - PBRIDGE: the memory address of the C++ Bridge
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ PROGRAM FCHECK_SA
DOUBLE PRECISION GS(NEVTMAX)
DOUBLE PRECISION RNDHEL(NEVTMAX) ! not yet used
DOUBLE PRECISION RNDCOL(NEVTMAX) ! not yet used
INTEGER*4 CHANID
PARAMETER(CHANID=0) ! TEMPORARY? disable multi-channel in fcheck.exe and fgcheck.exe #466
DOUBLE PRECISION MES(NEVTMAX)
INTEGER*4 SELHEL(NEVTMAX) ! not yet used
INTEGER*4 SELCOL(NEVTMAX) ! not yet used
Expand Down Expand Up @@ -64,8 +62,8 @@ PROGRAM FCHECK_SA
DO IEVT = 1, NEVT
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(BRIDGE, MOMENTA, GS,
& RNDHEL, RNDCOL, CHANID, MES, SELHEL, SELCOL)
CALL FBRIDGESEQUENCE_NOMULTICHANNEL(BRIDGE, MOMENTA, GS, ! TEMPORARY? disable multi-channel in fcheck.exe and fgcheck.exe #466
& RNDHEL, RNDCOL, MES, SELHEL, SELCOL)
DO IEVT = 1, NEVT
c DO IEXTERNAL = 1, NEXTERNAL
c WRITE(6,*) 'MOMENTA', IEVT, IEXTERNAL,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -235,4 +235,64 @@ TEST( XTESTID( MG_EPOCH_PROCESS_ID ), testmisc )
}

//--------------------------------------------------------------------------

// Boolean vector (mask) times FP vector
/*
// From https://github.com/madgraph5/madgraph4gpu/issues/765#issuecomment-1853672838
channelids_sv = CHANNEL_ACCESS::kernelAccess( pchannelIds ); // the 4 channels in the SIMD vector
bool_sv mask_sv = ( channelids_sv == 1 );
numerators_sv += mask_sv * cxabs2( amp_sv[0] );
if( pchannelIds != nullptr ) denominators_sv += cxabs2( amp_sv[0] );
*/
{
typedef bool_sv test_int_sv; // defined as scalar_or_vector of long int (FPTYPE=double) or int (FPTYPE=float)
test_int_sv channelids0_sv{}; // mimic CHANNEL_ACCESS::kernelAccess( pchannelIds )
test_int_sv channelids1_sv{}; // mimic CHANNEL_ACCESS::kernelAccess( pchannelIds )
fptype_sv absamp0_sv{}; // mimic cxabs2( amp_sv[0] )
fptype_sv absamp1_sv{}; // mimic cxabs2( amp_sv[0] )
#ifdef MGONGPU_CPPSIMD
for( int i = 0; i < neppV; i++ )
{
channelids0_sv[i] = i; // 0123
channelids1_sv[i] = i; // 1234
absamp0_sv[i] = 10. + i; // 10. 11. 12. 13.
absamp1_sv[i] = 11. + i; // 11. 12. 13. 14.
}
#else
channelids0_sv = 0;
channelids1_sv = 1;
absamp0_sv = 10.;
absamp1_sv = 11.;
#endif
bool_sv mask0_sv = ( channelids0_sv % 2 == 0 ); // even channels 0123 -> TFTF (1010)
bool_sv mask1_sv = ( channelids1_sv % 2 == 0 ); // even channels 1234 -> FTFT (0101)
constexpr fptype_sv fpZERO_sv{}; // 0000
//fptype_sv numerators0_sv = mask0_sv * absamp0_sv; // invalid operands to binary * ('__vector(4) long int' and '__vector(4) double')
fptype_sv numerators0_sv = fpternary( mask0_sv, absamp0_sv, fpZERO_sv ); // equivalent to "mask0_sv * absamp0_sv"
fptype_sv numerators1_sv = fpternary( mask1_sv, absamp1_sv, fpZERO_sv ); // equivalent to "mask1_sv * absamp1_sv"
#ifdef MGONGPU_CPPSIMD
//std::cout << "numerators0_sv: " << numerators0_sv << std::endl;
//std::cout << "numerators1_sv: " << numerators1_sv << std::endl;
for( int i = 0; i < neppV; i++ )
{
// Values of numerators0_sv: 10.*1 11.*0 12.*1 13.*0
if( channelids0_sv[i] % 2 == 0 ) // even channels
EXPECT_TRUE( numerators0_sv[i] == ( 10. + i ) );
else // odd channels
EXPECT_TRUE( numerators0_sv[i] == 0. );
// Values of numerators1_sv: 11.*0 12.*1 13.*0 14.*1
if( channelids1_sv[i] % 2 == 0 ) // even channels
EXPECT_TRUE( numerators1_sv[i] == ( 11. + i ) );
else // odd channels
EXPECT_TRUE( numerators1_sv[i] == 0. );
}
#else
// Values of numerators0_sv: 10.*1
EXPECT_TRUE( numerators0_sv == 10. );
// Values of numerators1_sv: 11.*0
EXPECT_TRUE( numerators1_sv == 0. );
#endif
}

//--------------------------------------------------------------------------
}
Original file line number Diff line number Diff line change
Expand Up @@ -554,9 +554,9 @@ SUBROUTINE SMATRIX1_MULTI(P_MULTI, HEL_RAND, COL_RAND, CHANNEL,
STOP
ENDIF
IF ( FIRST ) THEN ! exclude first pass (helicity filtering) from timers (#461)
CALL FBRIDGESEQUENCE(FBRIDGE_PBRIDGE, P_MULTI, ALL_G,
& HEL_RAND, COL_RAND, 0, OUT2,
& SELECTED_HEL2, SELECTED_COL2 ) ! 0: multi channel disabled for helicity filtering
CALL FBRIDGESEQUENCE_NOMULTICHANNEL( FBRIDGE_PBRIDGE, ! multi channel disabled for helicity filtering
& P_MULTI, ALL_G, HEL_RAND, COL_RAND, OUT2,
& SELECTED_HEL2, SELECTED_COL2 )
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 @@ -573,9 +573,9 @@ SUBROUTINE SMATRIX1_MULTI(P_MULTI, HEL_RAND, COL_RAND, CHANNEL,
ENDIF
call counters_smatrix1multi_start( 0, VECSIZE_USED ) ! cudacpp=0
IF ( .NOT. MULTI_CHANNEL ) THEN
CALL FBRIDGESEQUENCE(FBRIDGE_PBRIDGE, P_MULTI, ALL_G,
& HEL_RAND, COL_RAND, 0, OUT2,
& SELECTED_HEL2, SELECTED_COL2 ) ! 0: multi channel disabled
CALL FBRIDGESEQUENCE_NOMULTICHANNEL( FBRIDGE_PBRIDGE, ! multi channel disabled
& P_MULTI, ALL_G, HEL_RAND, COL_RAND, OUT2,
& SELECTED_HEL2, SELECTED_COL2 )
ELSE
IF( SDE_STRAT.NE.1 ) THEN
WRITE(6,*) 'ERROR! The cudacpp bridge requires SDE=1' ! multi channel single-diagram enhancement strategy
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ PROGRAM FCHECK_SA
DOUBLE PRECISION GS(NEVTMAX)
DOUBLE PRECISION RNDHEL(NEVTMAX) ! not yet used
DOUBLE PRECISION RNDCOL(NEVTMAX) ! not yet used
INTEGER*4 CHANID
PARAMETER(CHANID=0) ! TEMPORARY? disable multi-channel in fcheck.exe and fgcheck.exe #466
DOUBLE PRECISION MES(NEVTMAX)
INTEGER*4 SELHEL(NEVTMAX) ! not yet used
INTEGER*4 SELCOL(NEVTMAX) ! not yet used
Expand Down Expand Up @@ -64,8 +62,8 @@ PROGRAM FCHECK_SA
DO IEVT = 1, NEVT
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(BRIDGE, MOMENTA, GS,
& RNDHEL, RNDCOL, CHANID, MES, SELHEL, SELCOL)
CALL FBRIDGESEQUENCE_NOMULTICHANNEL(BRIDGE, MOMENTA, GS, ! TEMPORARY? disable multi-channel in fcheck.exe and fgcheck.exe #466
& RNDHEL, RNDCOL, MES, SELHEL, SELCOL)
DO IEVT = 1, NEVT
c DO IEXTERNAL = 1, NEXTERNAL
c WRITE(6,*) 'MOMENTA', IEVT, IEXTERNAL,
Expand Down
29 changes: 27 additions & 2 deletions epochX/cudacpp/ee_mumu.mad/SubProcesses/fbridge.cc
Original file line number Diff line number Diff line change
Expand Up @@ -99,14 +99,39 @@ extern "C"
#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, mes, selhel, selcol );
pbridge->gpu_sequence( momenta, gs, rndhel, rndcol, ( pchannelId ? *pchannelId : 0 ), mes, selhel, selcol );
#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, mes, selhel, selcol );
pbridge->cpu_sequence( momenta, gs, rndhel, rndcol, ( pchannelId ? *pchannelId : 0 ), mes, selhel, selcol );
#endif
}

/**
* Execute the matrix-element calculation "sequence" via a Bridge on GPU/CUDA or CUDA/C++, without multi-channel mode.
* This is a C symbol that should be called from the Fortran code (in auto_dsig1.f).
*
* @param ppbridge the pointer to the Bridge pointer (the Bridge pointer is handled in Fortran as an INTEGER*8 variable)
* @param momenta the pointer to the input 4-momenta
* @param gs the pointer to the input Gs (running QCD coupling constant alphas)
* @param rndhel the pointer to the input random numbers for helicity selection
* @param rndcol the pointer to the input random numbers for color selection
* @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
*/
void fbridgesequence_nomultichannel_( CppObjectInFortran** ppbridge,
const FORTRANFPTYPE* momenta,
const FORTRANFPTYPE* gs,
const FORTRANFPTYPE* rndhel,
const FORTRANFPTYPE* rndcol,
FORTRANFPTYPE* mes,
int* selhel,
int* selcol )
{
fbridgesequence_( ppbridge, momenta, gs, rndhel, rndcol, nullptr, mes, selhel, selcol );
}

/**
* Retrieve the number of good helicities for helicity filtering in the Bridge.
* This is a C symbol that should be called from the Fortran code (in auto_dsig1.f).
Expand Down
27 changes: 26 additions & 1 deletion epochX/cudacpp/ee_mumu.mad/SubProcesses/fbridge.inc
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ C - MOMENTA: the input 4-momenta Fortran array
C - GS: the input Gs (running QCD coupling constant alphas) Fortran array
C - RNDHEL: the input random number Fortran array for helicity selection
C - RNDCOL: the input random number Fortran array for color selection
C - CHANID: the input Feynman diagram to enhance in multi-channel mode if 1 to n (disable multi-channel if 0)
C - CHANID: the input Feynman diagram to enhance in multi-channel mode if 1 to n
C - MES: the output matrix element Fortran array
C - SELHEL: the output selected helicity Fortran array
C - SELCOL: the output selected color Fortran array
Expand All @@ -56,6 +56,31 @@ C
END SUBROUTINE FBRIDGESEQUENCE
END INTERFACE

C
C Execute the matrix-element calculation "sequence" via a Bridge on GPU/CUDA or CUDA/C++.
C - PBRIDGE: the memory address of the C++ Bridge
C - MOMENTA: the input 4-momenta Fortran array
C - GS: the input Gs (running QCD coupling constant alphas) Fortran array
C - RNDHEL: the input random number Fortran array for helicity selection
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
INTERFACE
SUBROUTINE FBRIDGESEQUENCE_NOMULTICHANNEL(PBRIDGE, MOMENTA, GS,
& RNDHEL, RNDCOL, MES, SELHEL, SELCOL)
INTEGER*8 PBRIDGE
DOUBLE PRECISION MOMENTA(*)
DOUBLE PRECISION GS(*)
DOUBLE PRECISION RNDHEL(*)
DOUBLE PRECISION RNDCOL(*)
DOUBLE PRECISION MES(*)
INTEGER*4 SELHEL(*)
INTEGER*4 SELCOL(*)
END SUBROUTINE FBRIDGESEQUENCE_NOMULTICHANNEL
END INTERFACE

C
C Retrieve the number of good helicities for helicity filtering in the Bridge.
C - PBRIDGE: the memory address of the C++ Bridge
Expand Down
Loading