Skip to content

Commit 485b822

Browse files
committed
Removed MPI dependency.
1 parent 148c87f commit 485b822

File tree

6 files changed

+31
-28
lines changed

6 files changed

+31
-28
lines changed

CMakeLists.txt

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ if( NOT is_submodule )
2929
option( ENABLE_CUDA "Build with CUDA" OFF )
3030
option( ENABLE_UMPIRE "Build with UMPIRE" OFF )
3131
option( ENABLE_CHAI "Build with CHAI" OFF )
32-
option( ENABLE_MPI "Build with MPI" OFF )
3332
option( ENABLE_CALIPER "Build with Caliper" OFF )
3433

3534
include( cmake/blt/SetupBLT.cmake )
@@ -48,10 +47,6 @@ if( ENABLE_CHAI )
4847
set( lvarray_dependencies ${lvarray_dependencies} chai umpire )
4948
endif()
5049

51-
if( ENABLE_MPI )
52-
set( lvarray_dependencies ${lvarray_dependencies} mpi )
53-
endif()
54-
5550
if( ENABLE_CUDA )
5651
set( lvarray_dependencies ${lvarray_dependencies} cuda )
5752
endif()

cmake/Config.cmake

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
#
22
set( PREPROCESSOR_DEFINES CHAI
33
CUDA
4-
MPI
54
TOTALVIEW_OUTPUT
65
CALIPER )
76

src/LvArrayConfig.hpp.in

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@
1818

1919
#cmakedefine LVARRAY_USE_CUDA
2020

21-
#cmakedefine LVARRAY_USE_MPI
22-
2321
#cmakedefine LVARRAY_USE_TOTALVIEW_OUTPUT
2422

2523
#cmakedefine LVARRAY_USE_CALIPER

src/Macros.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@
110110
__oss << MSG << "\n"; \
111111
__oss << LvArray::system::stackTrace( true ); \
112112
std::cout << __oss.str() << std::endl; \
113-
LvArray::system::abort(); \
113+
LvArray::system::callErrorHandler(); \
114114
} \
115115
} while( false )
116116
#endif

src/system.cpp

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,6 @@
3030
#include <sys/wait.h>
3131
#endif
3232

33-
#if defined( LVARRAY_USE_MPI )
34-
#include <mpi.h>
35-
#endif
36-
3733
/**
3834
* @struct UnwindState
3935
* @brief Holds info used in unwindCallback.
@@ -429,18 +425,27 @@ std::string calculateSize( size_t const bytes )
429425
return result;
430426
}
431427

428+
#if defined( __ibmxl__ )
429+
// For whatever reason XL emits an error when assigning std::abort to @c s_errorHandler.
430+
static void ibmAbort()
431+
{ std::abort(); }
432+
433+
std::function< void() > s_errorHandler = ibmAbort;
434+
#else
435+
std::function< void() > s_errorHandler = std::abort;
436+
#endif
437+
432438
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
433-
void abort()
439+
void setErrorHandler( std::function< void() > const & handler )
434440
{
435-
#ifdef LVARRAY_USE_MPI
436-
int mpi = 0;
437-
MPI_Initialized( &mpi );
438-
if( mpi )
439-
{
440-
MPI_Abort( MPI_COMM_WORLD, EXIT_FAILURE );
441-
}
442-
#endif
443-
std::abort();
441+
LVARRAY_ERROR_IF( handler == nullptr, "Error handler cannot be null." );
442+
s_errorHandler = handler;
443+
}
444+
445+
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
446+
void callErrorHandler()
447+
{
448+
s_errorHandler();
444449
}
445450

446451
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -467,7 +472,7 @@ void stackTraceHandler( int const sig, bool const exit )
467472
// An infinite loop was encountered when an FPE was received. Resetting the handlers didn't
468473
// fix it because they would just recurse. This does.
469474
setSignalHandling( nullptr );
470-
abort();
475+
callErrorHandler();
471476
}
472477
}
473478

src/system.hpp

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,9 @@
1313
#pragma once
1414

1515
// System includes
16-
#include <vector>
17-
#include <array>
1816
#include <string>
1917
#include <typeinfo>
18+
#include <functional>
2019

2120
namespace LvArray
2221
{
@@ -60,9 +59,16 @@ inline std::string demangleType( T const & )
6059
{ return demangle( typeid( T ).name() ); }
6160

6261
/**
63-
* @brief Abort the program, correctly finalizing MPI.
62+
* @brief Set the error handler called by LVARRAY_ERROR and others.
63+
* @param handler The error handler.
64+
* @note By default the error handler is std::abort.
6465
*/
65-
void abort();
66+
void setErrorHandler( std::function< void() > const & handler );
67+
68+
/**
69+
* @brief Call the error handler, by default this is std::abort.
70+
*/
71+
void callErrorHandler();
6672

6773
/**
6874
* @brief Print signal information and a stack trace to standard out, optionally aborting.

0 commit comments

Comments
 (0)