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

Fix builds of SMEFT gg_tttt #632

Merged
merged 63 commits into from
Apr 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
63 commits
Select commit Hold shift + click to select a range
3cef7bd
[smeft2] in CODEGEN, add a few formatting post-fixes for clang-format…
valassi Apr 6, 2023
44a78a8
[smeft2] add new process smeft_gg_tttt.sa to the repository - codegen…
valassi Apr 6, 2023
3eec0f3
Merge remote-tracking branch 'upstream/master' into smeft2
valassi Feb 29, 2024
83acce6
[smeft] regenerate smeft_gg_tttt.sa - generation is ok, but builds fa…
valassi Feb 29, 2024
fc1ce2b
Merge branch 'susy2' into smeft2
valassi Feb 29, 2024
8a6f50d
[smeft] regenerate smeft_gg_tttt.sa after merging susy2 - generation …
valassi Feb 29, 2024
0de8932
Merge branch 'susy' into smeft2
valassi Mar 8, 2024
34bae25
[smeft2] regenerate smeft_gg_tttt after merging susy - codegen is ok …
valassi Mar 8, 2024
380e95a
Merge branch 'susy' into smeft2
valassi Mar 17, 2024
a6ba77f
[smeft2] regenerate smeft_gg_tttt after merging susy - codegen is ok …
valassi Mar 17, 2024
e8ce1b4
[smeft2] in smeft_gg_tttt, make progress in HRDCOD=0 (#616) build: co…
valassi Mar 19, 2024
c1bee92
[smeft2] in smeft_gg_tttt, complete fixes for HRDCOD=0 (#616) builds:…
valassi Mar 19, 2024
4604b8e
[smeft2] in smeft_gg_tttt, add the reference log file computed from H…
valassi Mar 19, 2024
3ba5c44
[smeft2] in CODEGEN, add smeft_gg_tttt reference log file computed fr…
valassi Mar 19, 2024
30c439e
[smeft2] in CODEGEN, modify model_handling.py to eventually allow a b…
valassi Mar 19, 2024
f0b9df1
[smeft2] in CODEGEN, backport from smeft_gg_tttt a fix for HRDCOD=0 (…
valassi Mar 19, 2024
e1ed815
[smeft2] in CODEGEN, backport and improve smeft_gg_tttt fix for HRDCO…
valassi Mar 20, 2024
60c0325
[smeft2] in CODEGEN, further improve improve handling of aS and G par…
valassi Mar 20, 2024
4557ed8
[smeft2] in CODEGEN, add to generated code a comment "Compute all dep…
valassi Mar 20, 2024
4144a2b
[smeft2] regenerate smeft_gg_tttt.sa with new CODEGEN - HRDCOD=0 buil…
valassi Mar 20, 2024
fb393b9
[smeft2] regenerate gg_ttg.sa - there is a problem because mdl_G__exp…
valassi Mar 20, 2024
49a622c
[smeft2] in CODEGEN, try to remove mdl_G__exp__2 and mdl_G__exp__3 fr…
valassi Mar 20, 2024
53236ad
[smeft2] in CODEGEN, disable clang-formatting post-fixes for SMEFT, w…
valassi Mar 20, 2024
38149db
[smeft2] regenerate gg_ttg.sa - back to normal, fixed both the proble…
valassi Mar 20, 2024
6fc07cc
[smeft2] in CODEGEN, fix the clang formatting post-fix for smeft #633…
valassi Mar 20, 2024
9af3fbf
[smeft2] regenerate smeft_gg_tttt.sa - now exponent literals are fixe…
valassi Mar 20, 2024
d262014
[smeft2] regenerate gg_ttg.sa as a cross check - ok no change
valassi Mar 20, 2024
8e241ba
[smeft2] in smeft_gg_tttt.sa, manually fix mdl_G__exp__3 (need backport)
valassi Mar 20, 2024
66f99c0
[smeft2] in CODEGEN, fix handling of mdl_G__exp__3 (should be treated…
valassi Mar 20, 2024
2bc3602
[smeft2] regenerate smeft_gg_tttt.sa, all ok
valassi Mar 20, 2024
4c2d8c2
[smeft2] in smeft_gg_tttt, start loooking at issues in constexpr_pow
valassi Mar 20, 2024
b4e50ab
[smeft2] in smeft_gg_tttt, handle negative exponents in constexpr_pow
valassi Mar 20, 2024
a9fc578
[smeft2] in smeft_gg_tttt, complete the fix for HRDCOD=1 builds #614:…
valassi Mar 20, 2024
7708800
[smeft2] in smeft_gg_tttt.sa, add some tests for constexpr_pow with n…
valassi Mar 20, 2024
9f7d59c
[smeft2] in CODEGEN, backport from smeft_gg_tttt the final HRDCOD=1 f…
valassi Mar 20, 2024
d62c5bc
[smeft2] regenerate smeft_gg_tttt.sa, all ok
valassi Mar 20, 2024
7cfdf3f
[smeft2] regenerate all processes
valassi Mar 20, 2024
5dcec8d
Merge branch 'susy' into smeft2
valassi Mar 20, 2024
a9d401a
[smeft2] in CODEGEN/allGenerateAndCompare.sh, add also smeft_gg_tttt …
valassi Mar 20, 2024
26ab9d9
[smeft2] regenerate all processes after merging the latest susy into …
valassi Mar 20, 2024
7701758
[smeft2] add smeft_gg_tttt.mad to the repo
valassi Mar 20, 2024
fc17953
[smeft2] in .github/workflows/testsuite_allprocesses.yml add smeft_gg…
valassi Mar 20, 2024
b5d4b10
[smeft2] in CODEGEN, backport from susy_gg_t1t1.sa Param.h, fix mdl_G…
valassi Mar 20, 2024
2493141
[smeft2] regenerate susy_gg_t1t1.sa, now builds ok again
valassi Mar 20, 2024
d9bb164
[smeft2] in CODEGEN, hardcode a custom assignment (valid for both SUS…
valassi Mar 20, 2024
9b70a3a
[smeft2] regenerate smeft_gg_tttt.sa and susy_gg_t1t1.sa, now G^2 and…
valassi Mar 20, 2024
9ee1b6d
[smeft2] add smeft_gg_tttt support to tput/throughputX.sh
valassi Mar 20, 2024
e95d401
[smeft2] regenerate all processes with the latest CODEGEN fixes for G…
valassi Mar 20, 2024
dc2f7c3
[smeft2] add smeft_gg_tttt support to tput/teeThroughputX.sh
valassi Mar 20, 2024
d5cbd31
[smeft2] add smeft_gg_tttt to tput/allTees.sh
valassi Mar 20, 2024
4b5922b
[smeft2] bug fixes for smeft_gg_tttt in tput/throughputX.sh
valassi Mar 20, 2024
0014c74
[smeft2] add four tput logs for smeftggtttt... the tests are a bit lo…
valassi Mar 20, 2024
cc6ca5d
[smeft2] add smeft_gg_tttt support to tmad scripts
valassi Mar 20, 2024
8332bab
[smeft2] make tput testst for smeft_gg_tttt shorter (may be too short?)
valassi Mar 20, 2024
ee2ecda
[smeft2] rerun shorter tput tests for smeftggtttt (indeed too short f…
valassi Mar 20, 2024
5f3628a
[smeft2] add tmad logs for smeftggtttt - all ok! unlike susy, here xs…
valassi Mar 20, 2024
9b99d71
[smeft2] rerun tmad tests for susy - no improvement from SMEFT fixes,…
valassi Mar 20, 2024
1adc2f8
[smeft2] in CODEGEN/generateAndCompare.sh add heft_gg_bb (and heft_gg…
valassi Mar 20, 2024
007dbe4
[smeft2] in CODEGEN, disable warnings about limited support for EFTs …
valassi Mar 20, 2024
f800ecb
[smeft2] rerun all 94 tput tests on itscrd90, all ok
valassi Mar 21, 2024
fe78e46
[smeft2] rerun all 27 tmad tests, all ok
valassi Mar 21, 2024
6a01dd3
[smeft2] ** COMPLETE SMEFT2 ** improve debug printouts in tmad/allTee…
valassi Mar 21, 2024
e44535d
Merge remote-tracking branch 'upstream/master' (with susy PR #824) in…
valassi Apr 9, 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/testsuite_allprocesses.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
fail-fast: false # important to see all results even if one fails (fail-fast is true by default)
matrix:
# FIXME? Can the list of supported processes be specified only once in oneprocess.yml or allprocesses.yml?
process: [ee_mumu, gg_tt, gg_ttg, gg_ttgg, gg_ttggg, gg_tt01g, gq_ttq, pp_tt012j, nobm_pp_ttW, susy_gg_tt, susy_gg_t1t1, heft_gg_h]
process: [ee_mumu, gg_tt, gg_ttg, gg_ttgg, gg_ttggg, gg_tt01g, gq_ttq, pp_tt012j, nobm_pp_ttW, susy_gg_tt, susy_gg_t1t1, smeft_gg_tttt, heft_gg_h]
suffix: [mad, sa]
uses: ./.github/workflows/testsuite_oneprocess.yml
with:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,14 @@ namespace mg5amcCpu
}

// Constexpr implementation of pow
constexpr long double constexpr_pow( const long double base, const long double exp )
constexpr long double constexpr_pow( const long double base, const long double exp, const bool requireExpGe0 = false )
{
// NB(1): this implementation of constexpr_pow requires exponent >= 0
assert( exp >= 0 ); // NB would fail at compile time with "error: call to non-‘constexpr’ function ‘void __assert_fail'"
// NB(2): this implementation of constexpr_pow requires an integer exponent
// NB(1): this iterative integer implementation of constexpr_pow requires exponent >= 0
if( requireExpGe0 ) assert( exp >= 0 ); // NB would fail at compile time with "error: call to non-‘constexpr’ function ‘void __assert_fail'"
if( exp < 0 ) return 1. / constexpr_pow( base, -exp, true );
// NB(2): this iterative integer implementation of constexpr_pow requires an integer exponent, excexpt for special cases (1/2, 1/4)
if( exp == 0.5 ) return constexpr_sqrt( base );
if( exp == 0.25 ) return constexpr_sqrt( constexpr_sqrt( base ) );
const int iexp = constexpr_floor( exp );
assert( static_cast<long double>( iexp ) == exp ); // NB would fail at compile time with "error: call to non-‘constexpr’ function ‘void __assert_fail'"
// Iterative implementation of pow if exp is a non negative integer
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,23 @@ TEST( XTESTID( MG_EPOCH_PROCESS_ID ), testmisc )
EXPECT_TRUE( constexpr_floor( -0.5 ) == -1 );
EXPECT_TRUE( constexpr_floor( -1.5 ) == -2 );

// Test constexpr pow
EXPECT_TRUE( constexpr_pow( 10, 0 ) == 1 );
EXPECT_TRUE( constexpr_pow( 10, 1 ) == 10 );
EXPECT_TRUE( constexpr_pow( 10, 2 ) == 100 );
EXPECT_NEAR( constexpr_pow( 10, -1 ), 0.1, 0.1 * 1E-14 )
<< std::setprecision( 40 ) << "constexpr_pow( 10, -1 ) = " << constexpr_pow( 10, -1 );
EXPECT_NEAR( constexpr_pow( 10, -2 ), 0.01, 0.01 * 1E-14 )
<< std::setprecision( 40 ) << "constexpr_pow( 10, -2 ) = " << constexpr_pow( 10, -2 );
EXPECT_NEAR( constexpr_pow( 100, 0.5 ), 10, 10 * 1E-14 )
<< std::setprecision( 40 ) << "constexpr_pow( 100, 0.5 ) = " << constexpr_pow( 100, 0.5 );
EXPECT_NEAR( constexpr_pow( 100, -0.5 ), 0.1, 0.1 * 1E-14 )
<< std::setprecision( 40 ) << "constexpr_pow( 100, -0.5 ) = " << constexpr_pow( 100, -0.5 );
EXPECT_NEAR( constexpr_pow( 10000, 0.25 ), 10, 10 * 1E-14 )
<< std::setprecision( 40 ) << "constexpr_pow( 10000, 0.25 ) = " << constexpr_pow( 10000, 0.25 );
EXPECT_NEAR( constexpr_pow( 10000, -0.25 ), 0.1, 0.1 * 1E-14 )
<< std::setprecision( 40 ) << "constexpr_pow( 10000, -0.25 ) = " << constexpr_pow( 10000, -0.25 );

// Distance from the horizontal or vertical axis (i.e. from 0, pi/2, pi, or 3pi/2)
auto distance4 = []( const long double xx )
{
Expand Down
63 changes: 47 additions & 16 deletions epochX/cudacpp/CODEGEN/PLUGIN/CUDACPP_SA_OUTPUT/model_handling.py
Original file line number Diff line number Diff line change
Expand Up @@ -781,10 +781,10 @@ def write_hardcoded_parameters(self, params, deviceparams=dict()):
res = res.replace(' ;',';')
res = res.replace('= - ','= -') # post-fix for susy
res = res.replace('( - ','( -') # post-fix for susy
res = res.replace(', - ',', -') # post-fix for SM no_b_mass
res = res.replace('Re+mdl','Re + mdl') # post-fix for smeft
res = res.replace('Re+0','Re + 0') # post-fix for smeft
res = res.replace('He-2','He - 2') # post-fix for smeft
res = res.replace('Re+mdl','Re + mdl') # better post-fix for smeft #633
res = res.replace('Re+0','Re + 0') # better post-fix for smeft #633
res = res.replace('He-2','He - 2') # better post-fix for smeft #633
res = res.replace(', - ',', -') # post-fix for smeft
###print(res); assert(False)
###misc.sprint( "'"+res+"'" )
return res
Expand All @@ -796,7 +796,9 @@ def super_write_set_parameters_donotfixMajorana(self, params):
# For each parameter, write "name = expr;"
for param in params:
res_strings.append( "%s" % param.expr )
return "\n".join(res_strings)
res = "\n".join(res_strings)
res = res.replace('ABS(','std::abs(') # for SMEFT #614 and #616
return res

# AV - replace export_cpp.UFOModelConverterCPP method (eventually split writing of parameters and fixes for Majorana particles #622)
def super_write_set_parameters_onlyfixMajorana(self, hardcoded): # FIXME! split hardcoded (constexpr) and not-hardcoded code
Expand Down Expand Up @@ -911,12 +913,42 @@ def super_generate_parameters_class_files(self):
dcoupdecl = [ ' cxtype_sv %s;' % name for name in self.coups_dep ]
replace_dict['dcoupdecl'] = '\n'.join( dcoupdecl )
dcoupsetdpar = []
# Special handling of G and aS parameters (cudacpp starts from G, while UFO starts from aS)
# For simplicity, compute these parameters directly from G, rather than from another such parameter
# (e.g. do not compute mdl_sqrt__aS as sqrt of aS, which would require defining aS first)
gparameters = { 'aS' : 'G * G / 4. / M_PI',
'mdl_sqrt__aS' : 'G / 2. / constexpr_sqrt( M_PI )' }
gparamcoded = set()
foundG = False
for line in self.write_hardcoded_parameters(self.params_dep).split('\n'):
if line != '':
dcoupsetdpar.append( ' ' + line.replace('constexpr cxsmpl<double> mdl_G__exp__2','const fptype_sv mdl_G__exp__2').replace('constexpr double', 'const fptype_sv' if foundG else '//const fptype_sv' ) )
if 'constexpr double G =' in line: foundG = True
replace_dict['dcoupsetdpar'] = ' ' + '\n'.join( dcoupsetdpar )
for pdep in self.params_dep:
###misc.sprint(pdep.type, pdep.name)
line = ' ' + self.write_hardcoded_parameters([pdep]).rstrip('\n')
###misc.sprint(line)
if not foundG:
# Comment out the default UFO assignment of mdl_sqrt__aS (from aS) and of G (from mdl_sqrt__aS), but keep them for reference
# (WARNING! This Python CODEGEN code essentially assumes that this refers precisely and only to mdl_sqrt__aS and G)
dcoupsetdpar.append( ' ' + line.replace('constexpr double', '//const fptype_sv') )
elif pdep.name == 'mdl_G__exp__2' : # bug fix: fptype, not double nor complex (UFO SUSY and SMEFT even disagree on this?)
# Hardcode a custom assignment (valid for both SUSY and SMEFT) instead of replacing double or complex in 'line'
dcoupsetdpar.append(' const fptype_sv ' + pdep.name + ' = G * G;' )
elif pdep.name == 'mdl_G__exp__3' : # bug fix: fptype, not double nor complex (UFO SUSY and SMEFT even disagree on this?)
# Hardcode a custom assignment (valid for both SUSY and SMEFT) instead of replacing double or complex in 'line'
valassi marked this conversation as resolved.
Show resolved Hide resolved
dcoupsetdpar.append(' const fptype_sv ' + pdep.name + ' = G * G * G;' )
elif pdep.name in gparameters:
# Skip the default UFO assignment from aS (if any?!) of aS and mdl_sqrt__aS, as these are now derived from G
# (WARNING! no path to this statement! aS is not in params_dep, while mdl_sqrt__aS is handled in 'if not foundG' above)
###misc.sprint('Skip gparameter:', pdep.name)
continue
else:
for gpar in gparameters:
if ' ' + gpar + ' ' in line and not gpar in gparamcoded:
gparamcoded.add(gpar)
valassi marked this conversation as resolved.
Show resolved Hide resolved
dcoupsetdpar.append(' const fptype_sv ' + gpar + ' = ' + gparameters[gpar] + ';' )
dcoupsetdpar.append( ' ' + line.replace('constexpr double', 'const fptype_sv') )
if pdep.name == 'G':
foundG = True
dcoupsetdpar.append(' // *** NB Compute all dependent parameters, including aS, in terms of G rather than in terms of aS ***')
replace_dict['dcoupsetdpar'] = '\n'.join( dcoupsetdpar )
dcoupsetdcoup = [ ' ' + line.replace('constexpr cxsmpl<double> ','out.').replace('mdl_complexi', 'cI') for line in self.write_hardcoded_parameters(list(self.coups_dep.values())).split('\n') if line != '' ]
replace_dict['dcoupsetdcoup'] = ' ' + '\n'.join( dcoupsetdcoup )
dcoupaccessbuffer = [ ' fptype* %ss = C_ACCESS::idcoupAccessBuffer( couplings, idcoup_%s );'%( name, name ) for name in self.coups_dep ]
Expand Down Expand Up @@ -956,12 +988,11 @@ def super_generate_parameters_class_files(self):
replace_dict['nbsmip'] = nbsmparam_indep_all_used # NB this is now done also for 'sm' processes (no check on model name, see PR #824)
replace_dict['hasbsmip'] = '' if nbsmparam_indep_all_used > 0 else '//'
replace_dict['bsmip'] = ', '.join( list(bsmparam_indep_real_used) + [ '%s.real(), %s.imag()'%(par,par) for par in bsmparam_indep_complex_used] ) if nbsmparam_indep_all_used > 0 else '(none)'
if 'eft' in self.model_name.lower():
replace_dict['eftwarn0'] = '\n//#warning Support for EFT physics models is still limited for HRDCOD=0 builds (#439 and PR #625)'
replace_dict['eftwarn1'] = '\n//#warning Support for EFT physics models is still limited for HRDCOD=1 builds (#439 and PR #625)'
else:
replace_dict['eftwarn0'] = ''
replace_dict['eftwarn1'] = ''
replace_dict['eftwarn0'] = ''
replace_dict['eftwarn1'] = ''
###if 'eft' in self.model_name.lower():
### replace_dict['eftwarn0'] = '\n//#warning Support for EFT physics models is still limited for HRDCOD=0 builds (#439 and PR #625)'
### replace_dict['eftwarn1'] = '\n//#warning Support for EFT physics models is still limited for HRDCOD=1 builds (#439 and PR #625)'
if len( bsmparam_indep_real_used ) + len( bsmparam_indep_complex_used ) == 0:
replace_dict['eftspecial0'] = '\n // No special handling of non-hardcoded parameters (no additional BSM parameters needed in constant memory)'
else:
Expand Down
Loading
Loading