Skip to content

Commit

Permalink
[cmsdy] in CODEGEN and gg_tt.mad CPPProcess.cc, allow disabling FPEs …
Browse files Browse the repository at this point in the history
…if CUDACPP_RUNTIME_DISABLEFPE is set madgraph5#942 (temporary?)
  • Loading branch information
valassi committed Aug 7, 2024
1 parent 4b4b338 commit a3b48fb
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,9 @@

#include <algorithm>
#include <array>
#include <cfenv> // for feenableexcept, fegetexcept and FE_XXX
#include <cfloat> // for FLT_MIN
#include <cfenv> // for feenableexcept, fegetexcept and FE_XXX
#include <cfloat> // for FLT_MIN
#include <cstdlib> // for getenv
#include <cstring>
#include <iomanip>
#include <iostream>
Expand Down Expand Up @@ -61,7 +62,8 @@ fpeEnable()
//std::cout << "fpeEnable: FE_INVALID is" << ( ( fpes & FE_INVALID ) ? " " : " NOT " ) << "enabled" << std::endl;
//std::cout << "fpeEnable: FE_OVERFLOW is" << ( ( fpes & FE_OVERFLOW ) ? " " : " NOT " ) << "enabled" << std::endl;
//std::cout << "fpeEnable: FE_UNDERFLOW is" << ( ( fpes & FE_UNDERFLOW ) ? " " : " NOT " ) << "enabled" << std::endl;
constexpr bool enableFPE = true; // this is hardcoded and no longer controlled by getenv( "CUDACPP_RUNTIME_ENABLEFPE" )
//constexpr bool enableFPE = true; // this is hardcoded and no longer controlled by getenv( "CUDACPP_RUNTIME_ENABLEFPE" )
static const bool enableFPE = !getenv( "CUDACPP_RUNTIME_DISABLEFPE" ); // TEMPORARY? allow bypassing FPEs in CMS DY #942
if( enableFPE )
{
std::cout << "INFO: The following Floating Point Exceptions will cause SIGFPE program aborts: FE_DIVBYZERO, FE_INVALID, FE_OVERFLOW" << std::endl;
Expand All @@ -76,7 +78,7 @@ fpeEnable()
}
else
{
//std::cout << "INFO: Do not enable SIGFPE traps for Floating Point Exceptions" << std::endl;
std::cout << "INFO: Do not enable SIGFPE traps for Floating Point Exceptions (CUDACPP_RUNTIME_DISABLEFPE is non-empty)" << std::endl;
}
#else
//std::cout << "INFO: Keep default SIGFPE settings because feenableexcept is not available on MacOS" << std::endl;
Expand Down
10 changes: 6 additions & 4 deletions epochX/cudacpp/gg_tt.mad/SubProcesses/P1_gg_ttx/CPPProcess.cc
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,9 @@

#include <algorithm>
#include <array>
#include <cfenv> // for feenableexcept, fegetexcept and FE_XXX
#include <cfloat> // for FLT_MIN
#include <cfenv> // for feenableexcept, fegetexcept and FE_XXX
#include <cfloat> // for FLT_MIN
#include <cstdlib> // for getenv
#include <cstring>
#include <iomanip>
#include <iostream>
Expand Down Expand Up @@ -63,7 +64,8 @@ fpeEnable()
//std::cout << "fpeEnable: FE_INVALID is" << ( ( fpes & FE_INVALID ) ? " " : " NOT " ) << "enabled" << std::endl;
//std::cout << "fpeEnable: FE_OVERFLOW is" << ( ( fpes & FE_OVERFLOW ) ? " " : " NOT " ) << "enabled" << std::endl;
//std::cout << "fpeEnable: FE_UNDERFLOW is" << ( ( fpes & FE_UNDERFLOW ) ? " " : " NOT " ) << "enabled" << std::endl;
constexpr bool enableFPE = true; // this is hardcoded and no longer controlled by getenv( "CUDACPP_RUNTIME_ENABLEFPE" )
//constexpr bool enableFPE = true; // this is hardcoded and no longer controlled by getenv( "CUDACPP_RUNTIME_ENABLEFPE" )
static const bool enableFPE = !getenv( "CUDACPP_RUNTIME_DISABLEFPE" ); // TEMPORARY? allow bypassing FPEs in CMS DY #942
if( enableFPE )
{
std::cout << "INFO: The following Floating Point Exceptions will cause SIGFPE program aborts: FE_DIVBYZERO, FE_INVALID, FE_OVERFLOW" << std::endl;
Expand All @@ -78,7 +80,7 @@ fpeEnable()
}
else
{
//std::cout << "INFO: Do not enable SIGFPE traps for Floating Point Exceptions" << std::endl;
std::cout << "INFO: Do not enable SIGFPE traps for Floating Point Exceptions (CUDACPP_RUNTIME_DISABLEFPE is non-empty)" << std::endl;
}
#else
//std::cout << "INFO: Keep default SIGFPE settings because feenableexcept is not available on MacOS" << std::endl;
Expand Down

0 comments on commit a3b48fb

Please sign in to comment.