Skip to content

Commit

Permalink
[fpe] cherry-pick the last commit from the namespace branch and fix a…
Browse files Browse the repository at this point in the history
… conflict:

"[namespace] in ggtt.sa, fix testmisc.cc and testxxx.cc to use different namespaces
This CONCLUDES the cleanup of namespaces in ggtt.sa: everything builds and runs ok
NB: in debug mode, now runTest succeeds! As intended, this fixes the segfault in #725"

Note: runTest.exe now succeeds in all AVX modes, both in debug and no-debug mode
  • Loading branch information
valassi committed Jul 19, 2023
1 parent 97a28da commit a219873
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 22 deletions.
48 changes: 33 additions & 15 deletions epochX/cudacpp/gg_tt.sa/SubProcesses/testmisc.cc
Original file line number Diff line number Diff line change
Expand Up @@ -25,32 +25,50 @@

#define XTESTID( s ) TESTID( s )

// NB: namespaces mg5amcGpu and mg5amcCpu includes types which are defined in different ways for CPU and GPU builds (see #318 and #725)
#ifdef __CUDACC__
namespace mg5amcGpu
#else
namespace mg5amcCpu
#endif
{

#ifdef MGONGPU_CPPSIMD /* clang-format off */
#define EXPECT_TRUE_sv( cond ) { bool_v mask( cond ); EXPECT_TRUE( maskand( mask ) ); }
#else
#define EXPECT_TRUE_sv( cond ) { EXPECT_TRUE( cond ); }
#endif /* clang-format on */

inline const std::string
boolTF( const bool& b )
{
return ( b ? "T" : "F" );
}
inline const std::string
boolTF( const bool& b )
{
return ( b ? "T" : "F" );
}

#ifdef MGONGPU_CPPSIMD
inline const std::string
boolTF( const bool_v& v )
{
std::stringstream out;
out << "{ " << ( v[0] ? "T" : "F" );
for( int i = 1; i < neppV; i++ ) out << ", " << ( v[i] ? "T" : "F" );
out << " }";
return out.str();
}
inline const std::string
boolTF( const bool_v& v )
{
std::stringstream out;
out << "{ " << ( v[0] ? "T" : "F" );
for( int i = 1; i < neppV; i++ ) out << ", " << ( v[i] ? "T" : "F" );
out << " }";
return out.str();
}
#endif

}

TEST( XTESTID( MG_EPOCH_PROCESS_ID ), testmisc )
{
{
#ifdef __CUDACC__
using namespace mg5amcGpu;
#else
using namespace mg5amcCpu;
#endif

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

EXPECT_TRUE( true );

//--------------------------------------------------------------------------
Expand Down
9 changes: 2 additions & 7 deletions epochX/cudacpp/gg_tt.sa/SubProcesses/testxxx.cc
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,9 @@ namespace mg5amcCpu
TEST( XTESTID( MG_EPOCH_PROCESS_ID ), testxxx )
{
#ifdef __CUDACC__
auto FPEhandler = mg5amcGpu::FPEhandler;
std::string& FPEhandlerMessage = mg5amcGpu::FPEhandlerMessage;
int& FPEhandlerIevt = mg5amcGpu::FPEhandlerIevt;
using namespace mg5amcGpu;
#else
auto FPEhandler = mg5amcCpu::FPEhandler;
std::string& FPEhandlerMessage = mg5amcCpu::FPEhandlerMessage;
int& FPEhandlerIevt = mg5amcCpu::FPEhandlerIevt;
using namespace mg5amcCpu;
#endif
const bool enableFPE = !getenv( "CUDACPP_RUNTIME_DISABLEFPE" );
if ( enableFPE )
Expand All @@ -72,7 +68,6 @@ TEST( XTESTID( MG_EPOCH_PROCESS_ID ), testxxx )
constexpr fptype toleranceXXXs = std::is_same<fptype, double>::value ? 1.E-15 : 1.E-5;
// Constant parameters
constexpr int neppM = MemoryAccessMomenta::neppM; // AOSOA layout
using mgOnGpu::neppV;
constexpr int np4 = CPPProcess::np4;
const int nevt = 32; // 12 independent tests plus 20 duplicates (need a multiple of 16 for floats '512z')
assert( nevt % neppM == 0 ); // nevt must be a multiple of neppM
Expand Down

0 comments on commit a219873

Please sign in to comment.