Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
Expand Up @@ -68,6 +68,6 @@ int main( int ac, char * av[] )
::testing::InitGoogleTest( &ac, av );
geos::basicSetup( ac, av );
int const result = RUN_ALL_TESTS();
geos::basicCleanup();
geos::basicCleanup( false );
return result;
}
15 changes: 12 additions & 3 deletions src/coreComponents/common/MpiWrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
*/

#include "MpiWrapper.hpp"
#include "LvArray/src/system.hpp"
#include <unistd.h>

#if defined(__clang__)
Expand Down Expand Up @@ -152,11 +153,19 @@ void internal::ManagedResources::finalize()
m_mpiTypes.clear();
}

void MpiWrapper::finalize()
void MpiWrapper::finalize( bool inError )
{
#ifdef GEOS_USE_MPI
internal::getManagedResources().finalize();
MPI_CHECK_ERROR( MPI_Finalize() );
if( !inError )
{
MpiWrapper::commFree( MPI_COMM_GEOS );
internal::getManagedResources().finalize();
MPI_CHECK_ERROR( MPI_Finalize() );
}
else
{
LvArray::system::callErrorHandler();
}
#endif
}

Expand Down
5 changes: 3 additions & 2 deletions src/coreComponents/common/MpiWrapper.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -196,10 +196,11 @@ struct MpiWrapper
static int init( int * argc, char * * * argv );

/**
* @brief Free MPI managed resources, then call MPI_Finalize().
* @brief Free MPI managed resources
* Please note that once called, MPI functions, communicators and resources can no longer be used.
* @param inError indicate if an exception occured
*/
static void finalize();
static void finalize( bool inError );

static MPI_Comm commDup( MPI_Comm const comm );

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class MpiTestScope

~MpiTestScope()
{
geos::cleanupEnvironment();
geos::cleanupEnvironment( false );
}

};
Expand Down
11 changes: 4 additions & 7 deletions src/coreComponents/common/initializeEnvironment.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
#include "Path.hpp"
#include "LvArray/src/system.hpp"
#include "common/LifoStorageCommon.hpp"
#include "common/MemoryInfos.hpp"
#include "logger/ErrorHandling.hpp"
#include "logger/ExternalErrorHandler.hpp"
#include <umpire/TypedAllocator.hpp>
Expand Down Expand Up @@ -192,10 +191,9 @@ void setupMPI( int argc, char * argv[] )
}

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void finalizeMPI()
void finalizeMPI( bool inError )
{
MpiWrapper::commFree( MPI_COMM_GEOS );
MpiWrapper::finalize();
MpiWrapper::finalize( inError );
}

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -330,13 +328,12 @@ void setupEnvironment( int argc, char * argv[] )
}

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void cleanupEnvironment()
void cleanupEnvironment( bool inError )
{
MemoryLogging::getInstance().memoryStatsReport();
LvArray::system::resetSignalHandling();
finalizeLogger();
finalizeCaliper();
finalizeMPI();
finalizeMPI( inError );
}

} // namespace geos
5 changes: 3 additions & 2 deletions src/coreComponents/common/initializeEnvironment.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ void setupMPI( int argc, char * argv[] );
/**
* @brief Finalize MPI.
*/
void finalizeMPI();
void finalizeMPI( bool inError );

/**
* @brief Setup CUDA
Expand All @@ -153,8 +153,9 @@ void setupEnvironment( int argc, char * argv[] );

/**
* @brief Cleanup/finalize the environment.
* @param inError indicate if an exception occured
*/
void cleanupEnvironment();
void cleanupEnvironment( bool inError );

#if defined( GEOS_USE_CALIPER )

Expand Down
2 changes: 1 addition & 1 deletion src/coreComponents/common/unitTests/testMpiWrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class MpiTestScope

~MpiTestScope()
{
geos::cleanupEnvironment();
geos::cleanupEnvironment( false );
}

};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -725,7 +725,7 @@ int main( int argc, char * * argv )

int const result = RUN_ALL_TESTS();

geos::basicCleanup();
geos::basicCleanup( false );

return result;
}
Original file line number Diff line number Diff line change
Expand Up @@ -1105,7 +1105,7 @@ int main( int argc, char * * argv )

int const result = RUN_ALL_TESTS();

geos::basicCleanup();
geos::basicCleanup( false );

return result;
}
Original file line number Diff line number Diff line change
Expand Up @@ -1114,7 +1114,7 @@ int main( int argc, char * * argv )

int const result = RUN_ALL_TESTS();

geos::cleanupEnvironment();
geos::cleanupEnvironment( false );

return result;
}
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ int main( int argc, char * * argv )

int const result = RUN_ALL_TESTS();

geos::cleanupEnvironment();
geos::cleanupEnvironment( false );

return result;
}
Original file line number Diff line number Diff line change
Expand Up @@ -519,7 +519,7 @@ int main( int argc, char * * argv )

int const result = RUN_ALL_TESTS();

geos::cleanupEnvironment();
geos::cleanupEnvironment( false );

return result;
}
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ int main( int argc, char * * argv )

int const result = RUN_ALL_TESTS();

geos::cleanupEnvironment();
geos::cleanupEnvironment( false );

return result;
}
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,7 @@ int main( int argc, char * * argv )

int const result = RUN_ALL_TESTS();

geos::cleanupEnvironment();
geos::cleanupEnvironment( false );

return result;
}
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ int main( int argc, char * * argv )

int const result = RUN_ALL_TESTS();

geos::cleanupEnvironment();
geos::cleanupEnvironment( false );

return result;
}
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ int main( int argc, char * * argv )

int const result = RUN_ALL_TESTS();

geos::cleanupEnvironment();
geos::cleanupEnvironment( false );

return result;
}
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ int main( int argc, char * * argv )

int const result = RUN_ALL_TESTS();

geos::cleanupEnvironment();
geos::cleanupEnvironment( false );

return result;
}
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ int main( int argc, char * * argv )

int const result = RUN_ALL_TESTS();

geos::cleanupEnvironment();
geos::cleanupEnvironment( false );

return result;
}
Original file line number Diff line number Diff line change
Expand Up @@ -457,6 +457,6 @@ int main( int ac, char * av[] )
::testing::InitGoogleTest( &ac, av );
geos::setupEnvironment( ac, av );
int const result = RUN_ALL_TESTS();
geos::cleanupEnvironment( );
geos::cleanupEnvironment( false );
return result;
}
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ int main( int argc, char * * argv )

int const result = RUN_ALL_TESTS();

geos::basicCleanup();
geos::basicCleanup( false );

return result;
}
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ int main( int argc, char * argv[] )

int const result = RUN_ALL_TESTS();

geos::basicCleanup();
geos::basicCleanup( false );

return result;
}
Original file line number Diff line number Diff line change
Expand Up @@ -1319,7 +1319,7 @@ int main( int argc, char * * argv )

int const result = RUN_ALL_TESTS();

geos::cleanupEnvironment();
geos::cleanupEnvironment( false );

return result;
}
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,6 @@ int main( int argc, char * * argv )

int const result = RUN_ALL_TESTS();

basicCleanup();
geos::basicCleanup( false );
return result;
}
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,6 @@ int main( int ac, char * av[] )
::testing::InitGoogleTest( &ac, av );
geos::basicSetup( ac, av );
int const result = RUN_ALL_TESTS();
geos::basicCleanup();
geos::basicCleanup( false );
return result;
}
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,6 @@ int main( int ac, char * av[] )
::testing::InitGoogleTest( &ac, av );
geos::basicSetup( ac, av );
int const result = RUN_ALL_TESTS();
geos::basicCleanup();
geos::basicCleanup( false );
return result;
}
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,6 @@ int main( int argc, char * * argv )
::testing::InitGoogleTest( &argc, argv );
g_commandLineOptions = *geos::basicSetup( argc, argv );
int const result = RUN_ALL_TESTS();
geos::basicCleanup();
geos::basicCleanup( false );
return result;
}
Original file line number Diff line number Diff line change
Expand Up @@ -1785,7 +1785,7 @@ int main( int argc, char * * argv )

int const result = RUN_ALL_TESTS();

geos::basicCleanup();
geos::basicCleanup( false );

return result;
}
2 changes: 1 addition & 1 deletion src/coreComponents/functions/unitTests/testFunctions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -914,7 +914,7 @@ int main( int argc, char * * argv )

int const result = RUN_ALL_TESTS();

// geos::basicCleanup();
// geos::basicCleanup( false );

return result;
}
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ int main( int argc, char * * argv )

int const result = RUN_ALL_TESTS();

geos::basicCleanup();
geos::basicCleanup( false );

return result;
}
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ int main( int argc, char * * argv )

int const result = RUN_ALL_TESTS();

geos::basicCleanup();
geos::basicCleanup( false );

return result;
}
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ int main( int argc, char * * argv )

int const result = RUN_ALL_TESTS();

geos::basicCleanup();
geos::basicCleanup( false );

return result;
}
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ int main( int argc, char * * argv )

int const result = RUN_ALL_TESTS();

geos::basicCleanup();
geos::basicCleanup( false );

return result;
}
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ int main( int argc, char * * argv )

int const result = RUN_ALL_TESTS();

geos::basicCleanup();
geos::basicCleanup( false );

return result;
}
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ int main( int argc, char * argv[] )

int const result = RUN_ALL_TESTS();

geos::basicCleanup();
geos::basicCleanup( false );

return result;
}
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,7 @@ int main( int argc, char * argv[] )

int const result = RUN_ALL_TESTS();

geos::basicCleanup();
geos::basicCleanup( false );

return result;
}
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ int main( int argc, char * * argv )
::testing::InitGoogleTest( &argc, argv );
int const result = RUN_ALL_TESTS();

basicCleanup();
geos::basicCleanup( false );

return result;
}
Original file line number Diff line number Diff line change
Expand Up @@ -445,6 +445,6 @@ int main( int argc, char * * argv )

int const result = RUN_ALL_TESTS();

basicCleanup();
geos::basicCleanup( false );
return result;
}
Loading
Loading