From 4f4ede3094edc2e0e58ff52a0261bddc660defe5 Mon Sep 17 00:00:00 2001 From: Jakub Domagala Date: Thu, 27 May 2021 20:49:38 +0200 Subject: [PATCH 1/9] #1456: config: Add runtime config for throwing an exception on vtAbort(..) --- src/vt/configs/arguments/app_config.h | 1 + src/vt/configs/arguments/args.cc | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/src/vt/configs/arguments/app_config.h b/src/vt/configs/arguments/app_config.h index 5703ff9dc5..7913cc0da3 100644 --- a/src/vt/configs/arguments/app_config.h +++ b/src/vt/configs/arguments/app_config.h @@ -165,6 +165,7 @@ struct AppConfig { bool vt_pause = false; bool vt_no_assert_fail = false; + bool vt_throw_on_abort = false; std::size_t vt_max_mpi_send_size = 1ull << 30; #if (vt_feature_fcontext != 0) diff --git a/src/vt/configs/arguments/args.cc b/src/vt/configs/arguments/args.cc index d317b7394d..cb5f8acfc0 100644 --- a/src/vt/configs/arguments/args.cc +++ b/src/vt/configs/arguments/args.cc @@ -501,6 +501,7 @@ void ArgConfig::addRuntimeArgs(CLI::App& app) { auto max_size = "Maximum MPI send size (causes larger messages to be split " "into multiple MPI sends)"; auto assert = "Do not abort the program when vtAssert(..) is invoked"; + auto throw_on_abort = "Throw an exception when vtAbort(..) is called"; auto a1 = app.add_option( @@ -509,11 +510,15 @@ void ArgConfig::addRuntimeArgs(CLI::App& app) { auto a2 = app.add_flag( "--vt_no_assert_fail", config_.vt_no_assert_fail, assert ); + auto a3 = app.add_flag( + "--vt_throw_on_abort", config_.vt_throw_on_abort, throw_on_abort + ); auto configRuntime = "Runtime"; a1->group(configRuntime); a2->group(configRuntime); + a3->group(configRuntime); } void ArgConfig::addThreadingArgs(CLI::App& app) { From 817fd16f17a1e13fabb392bd50be65257d1ccdd0 Mon Sep 17 00:00:00 2001 From: Jakub Domagala Date: Thu, 27 May 2021 21:10:41 +0200 Subject: [PATCH 2/9] #1456: config: Add non-const version of preConfig(), which allows TestHarness to set app options without using vt::runtime --- src/vt/configs/debug/debug_colorize.h | 2 ++ src/vt/runtime/runtime_get.cc | 14 ++++++++++++++ 2 files changed, 16 insertions(+) diff --git a/src/vt/configs/debug/debug_colorize.h b/src/vt/configs/debug/debug_colorize.h index bce25ab4d5..402e3188e2 100644 --- a/src/vt/configs/debug/debug_colorize.h +++ b/src/vt/configs/debug/debug_colorize.h @@ -46,10 +46,12 @@ #define INCLUDED_VT_CONFIGS_DEBUG_DEBUG_COLORIZE_H #include "vt/configs/arguments/app_config.h" +#include "vt/configs/types/types_type.h" #include namespace vt { namespace debug { +arguments::AppConfig * preConfigRef(); arguments::AppConfig const* preConfig(); }} /* end namespace vt::debug */ diff --git a/src/vt/runtime/runtime_get.cc b/src/vt/runtime/runtime_get.cc index 353ea42cd7..c82bfde43f 100644 --- a/src/vt/runtime/runtime_get.cc +++ b/src/vt/runtime/runtime_get.cc @@ -157,6 +157,20 @@ namespace vt { namespace debug { // Dummy config that applies outside of RT initialization, much like preNode. static arguments::AppConfig preInitAppConfig{}; + +/** + * \internal + * \brief Returns the preConfig, accessible OUTSIDE of VT initialization. + * + * This non-const version is used by 'nompi' tests, in order to customize + * the app config (mostly vt_throw_on_abort) + * + * \return A modifiable configuration + */ +arguments::AppConfig* preConfigRef(){ + return &preInitAppConfig; +} + /** * \internal * \brief Returns the config, accessible OUTSIDE of VT initialization. From 5f8ad5346331b62d4b2d651a701b61d48d633f96 Mon Sep 17 00:00:00 2001 From: Jakub Domagala Date: Thu, 27 May 2021 21:11:39 +0200 Subject: [PATCH 3/9] #1456: runtime: Switch to runtime check for throwing an exception on vtAbort(..) --- src/vt/collective/collective_ops.cc | 5 ++++- src/vt/runtime/runtime.cc | 32 +++++++++++++---------------- 2 files changed, 18 insertions(+), 19 deletions(-) diff --git a/src/vt/collective/collective_ops.cc b/src/vt/collective/collective_ops.cc index 626c9754b9..06884cdedb 100644 --- a/src/vt/collective/collective_ops.cc +++ b/src/vt/collective/collective_ops.cc @@ -146,10 +146,13 @@ void CollectiveAnyOps::abort( myrt->theTrace->cleanupTracesFile(); #endif myrt->abort(str, code); + } else if (vt::debug::preConfig()->vt_throw_on_abort) { + // Special case when preConfig has 'vt_throw_on_abort' option set + // This is meant to be used by nompi unit tests + throw std::runtime_error(str); } else { std::_Exit(code); } - } template diff --git a/src/vt/runtime/runtime.cc b/src/vt/runtime/runtime.cc index 4494a2aabd..18d610db41 100644 --- a/src/vt/runtime/runtime.cc +++ b/src/vt/runtime/runtime.cc @@ -78,9 +78,7 @@ #include -#if vt_check_enabled(throw_on_abort) #include -#endif #include #include #include @@ -518,24 +516,22 @@ void Runtime::reset() { } void Runtime::abort(std::string const abort_str, ErrorCodeType const code) { -#if !vt_check_enabled(throw_on_abort) - aborted_ = true; -#endif - output(abort_str,code,true,true,false); - -#if vt_check_enabled(throw_on_abort) - throw std::runtime_error(abort_str); -#else - std::raise( SIGTRAP ); - if (theContext) { - auto const comm = theContext->getComm(); - MPI_Abort(comm, 129); + output(abort_str, code, true, true, false); + + if (theConfig()->vt_throw_on_abort) { + throw std::runtime_error(abort_str); } else { - std::_Exit(code); - // @todo: why will this not compile with clang!!? - //quick_exit(code); + aborted_ = true; + std::raise(SIGTRAP); + if (theContext) { + auto const comm = theContext->getComm(); + MPI_Abort(comm, 129); + } else { + std::_Exit(code); + // @todo: why will this not compile with clang!!? + //quick_exit(code); + } } -#endif } void Runtime::output( From b9acebfac3b5cb31db5b10aeb039597960b720b7 Mon Sep 17 00:00:00 2001 From: Jakub Domagala Date: Thu, 27 May 2021 21:12:29 +0200 Subject: [PATCH 4/9] #1456: test: Set vt_throw_on_abort runtime flag for both nompi and standard/extended tests --- tests/unit/test_harness.h | 3 +++ tests/unit/test_parallel_harness.h | 3 +++ 2 files changed, 6 insertions(+) diff --git a/tests/unit/test_harness.h b/tests/unit/test_harness.h index fc9466468f..870b13a90c 100644 --- a/tests/unit/test_harness.h +++ b/tests/unit/test_harness.h @@ -44,6 +44,7 @@ #if ! defined __VIRTUAL_TRANSPORT_TEST_HARNESS__ #define __VIRTUAL_TRANSPORT_TEST_HARNESS__ +#include #include #include @@ -58,6 +59,8 @@ template struct TestHarnessAny : TestBase { static void store_cmdline_args(int argc, char **argv) { orig_args_ = std::vector(argv, argv + argc); + + vt::debug::preConfigRef()->vt_throw_on_abort = true; } static std::vector orig_args_; diff --git a/tests/unit/test_parallel_harness.h b/tests/unit/test_parallel_harness.h index b44e5662f8..21e9affff3 100644 --- a/tests/unit/test_parallel_harness.h +++ b/tests/unit/test_parallel_harness.h @@ -71,6 +71,9 @@ struct TestParallelHarnessAny : TestHarnessAny { addArgs(traceon); #endif + static char throw_on_abort[]{"--vt_throw_on_abort=1"}; + addArgs(throw_on_abort); + // communicator is duplicated. MPI_Comm comm = MPISingletonMultiTest::Get()->getComm(); auto const new_args = injectAdditionalArgs(test_argc, test_argv); From b54bfcca25bb2efafae2e77a3812eb52f8eaf84e Mon Sep 17 00:00:00 2001 From: Jakub Domagala Date: Thu, 27 May 2021 21:15:35 +0200 Subject: [PATCH 5/9] #1456: test: Adapt tests to use ASSERT_THROW by default, as it's enforced for unit tests --- tests/unit/runtime/test_cli_arguments.extended.cc | 7 ------- tests/unit/runtime/test_mpi_access_guards.cc | 13 ++----------- 2 files changed, 2 insertions(+), 18 deletions(-) diff --git a/tests/unit/runtime/test_cli_arguments.extended.cc b/tests/unit/runtime/test_cli_arguments.extended.cc index f8b2b92c41..23d0e54552 100644 --- a/tests/unit/runtime/test_cli_arguments.extended.cc +++ b/tests/unit/runtime/test_cli_arguments.extended.cc @@ -56,17 +56,10 @@ struct TestCliArguments : TestParallelHarness { }; TEST_F(TestCliArguments, test_vt_assert) { EXPECT_EQ(theConfig()->vt_no_assert_fail, false); -#if vt_check_enabled(throw_on_abort) ASSERT_THROW( vtAssert(false, "Should throw."), std::runtime_error ); -#else - ASSERT_DEATH( - vtAssert(false, "Should abort."), - "Should abort." - ); -#endif } #endif diff --git a/tests/unit/runtime/test_mpi_access_guards.cc b/tests/unit/runtime/test_mpi_access_guards.cc index 85424409a0..f09b8ebb89 100644 --- a/tests/unit/runtime/test_mpi_access_guards.cc +++ b/tests/unit/runtime/test_mpi_access_guards.cc @@ -75,17 +75,8 @@ static void attempt_mpi_access() { static void message_handler(DummyMsg* msg) { if (expected_to_fail_on_mpi_access) { -#if vt_check_enabled(throw_on_abort) - ASSERT_THROW( - attempt_mpi_access(), - std::runtime_error - ); -#else - ASSERT_DEATH( - attempt_mpi_access(), - "MPI functions should not used inside user code invoked from VT handlers" - ); -#endif + ASSERT_THROW(attempt_mpi_access(), std::runtime_error) << + "MPI functions should not used inside user code invoked from VT handlers"; } else { attempt_mpi_access(); SUCCEED(); From 78c26260736ba9c51fc5ed0c8a15d81a45c2ea0b Mon Sep 17 00:00:00 2001 From: Jakub Domagala Date: Thu, 27 May 2021 21:22:45 +0200 Subject: [PATCH 6/9] #1456: config: Serialize 'vt_throw_on_abort' --- src/vt/configs/arguments/app_config.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/vt/configs/arguments/app_config.h b/src/vt/configs/arguments/app_config.h index 7913cc0da3..fac93e2211 100644 --- a/src/vt/configs/arguments/app_config.h +++ b/src/vt/configs/arguments/app_config.h @@ -319,6 +319,7 @@ struct AppConfig { | vt_pause | vt_no_assert_fail + | vt_throw_on_abort | vt_max_mpi_send_size | vt_debug_level From 1a965d558ce666a38bc38d7dcda9821a6b00f764 Mon Sep 17 00:00:00 2001 From: Jakub Domagala Date: Thu, 27 May 2021 21:23:27 +0200 Subject: [PATCH 7/9] #1456: ci: Remove the old usage of compile time 'vt_throw_on_abort' flag --- ci/azure/azure-clang-10-alpine-mpich.yml | 1 - ci/azure/azure-clang-10-ubuntu-mpich.yml | 1 - ci/azure/azure-clang-3.9-ubuntu-mpich.yml | 1 - ci/azure/azure-clang-5.0-ubuntu-mpich.yml | 1 - ci/azure/azure-clang-9-ubuntu-mpich.yml | 1 - ci/azure/azure-gcc-10-ubuntu-openmpi.yml | 1 - ci/azure/azure-gcc-5-ubuntu-mpich.yml | 1 - ci/azure/azure-gcc-6-ubuntu-mpich.yml | 1 - ci/azure/azure-gcc-7-ubuntu-mpich.yml | 1 - ci/azure/azure-gcc-8-ubuntu-mpich.yml | 1 - ci/azure/azure-gcc-9-ubuntu-mpich.yml | 1 - ci/azure/azure-intel-18-ubuntu-mpich-extended.yml | 1 - ci/azure/azure-intel-18-ubuntu-mpich.yml | 1 - ci/azure/azure-intel-19-ubuntu-mpich.yml | 1 - ci/azure/azure-nvidia-10-ubuntu-mpich-extended.yml | 1 - ci/azure/azure-nvidia-10-ubuntu-mpich.yml | 1 - ci/azure/azure-nvidia-11-ubuntu-mpich-extended.yml | 1 - ci/azure/azure-nvidia-11-ubuntu-mpich.yml | 1 - ci/build_cpp.sh | 1 - cmake/configure_options.cmake | 9 --------- docker-compose.yml | 1 - docs/md/building.md | 2 -- scripts/azure-workflow-template.yml | 1 - scripts/workflows-azure.ini | 2 -- tests/unit/test_parallel_harness.h | 4 ---- 25 files changed, 38 deletions(-) diff --git a/ci/azure/azure-clang-10-alpine-mpich.yml b/ci/azure/azure-clang-10-alpine-mpich.yml index 1d0567c68c..3bb03fb381 100644 --- a/ci/azure/azure-clang-10-alpine-mpich.yml +++ b/ci/azure/azure-clang-10-alpine-mpich.yml @@ -47,7 +47,6 @@ variables: VT_USE_STD_THREAD: 0 VT_ZOLTAN: 0 VT_CI_BUILD: 1 - VT_THROW_ON_ABORT: 0 VT_DIAGNOSTICS: 1 CACHE: "$(Agent.TempDirectory)/cache/" cache_name: alpine-clang-10-cache diff --git a/ci/azure/azure-clang-10-ubuntu-mpich.yml b/ci/azure/azure-clang-10-ubuntu-mpich.yml index 6f278ad1b6..265a5f673d 100644 --- a/ci/azure/azure-clang-10-ubuntu-mpich.yml +++ b/ci/azure/azure-clang-10-ubuntu-mpich.yml @@ -47,7 +47,6 @@ variables: VT_USE_STD_THREAD: 0 VT_ZOLTAN: 0 VT_CI_BUILD: 1 - VT_THROW_ON_ABORT: 1 VT_DIAGNOSTICS: 1 CACHE: "$(Agent.TempDirectory)/cache/" cache_name: ubuntu-clang-10-cache diff --git a/ci/azure/azure-clang-3.9-ubuntu-mpich.yml b/ci/azure/azure-clang-3.9-ubuntu-mpich.yml index 0661357bcc..42f108a952 100644 --- a/ci/azure/azure-clang-3.9-ubuntu-mpich.yml +++ b/ci/azure/azure-clang-3.9-ubuntu-mpich.yml @@ -47,7 +47,6 @@ variables: VT_USE_STD_THREAD: 0 VT_ZOLTAN: 0 VT_CI_BUILD: 1 - VT_THROW_ON_ABORT: 1 VT_DIAGNOSTICS: 1 CACHE: "$(Agent.TempDirectory)/cache/" cache_name: ubuntu-clang-3.9-cache diff --git a/ci/azure/azure-clang-5.0-ubuntu-mpich.yml b/ci/azure/azure-clang-5.0-ubuntu-mpich.yml index 78059c52db..03272b68e8 100644 --- a/ci/azure/azure-clang-5.0-ubuntu-mpich.yml +++ b/ci/azure/azure-clang-5.0-ubuntu-mpich.yml @@ -47,7 +47,6 @@ variables: VT_USE_STD_THREAD: 0 VT_ZOLTAN: 0 VT_CI_BUILD: 1 - VT_THROW_ON_ABORT: 1 VT_DIAGNOSTICS: 1 CACHE: "$(Agent.TempDirectory)/cache/" cache_name: ubuntu-clang-5.0-cache diff --git a/ci/azure/azure-clang-9-ubuntu-mpich.yml b/ci/azure/azure-clang-9-ubuntu-mpich.yml index 92b406c3b2..0d31b6d80b 100644 --- a/ci/azure/azure-clang-9-ubuntu-mpich.yml +++ b/ci/azure/azure-clang-9-ubuntu-mpich.yml @@ -47,7 +47,6 @@ variables: VT_USE_STD_THREAD: 0 VT_ZOLTAN: 0 VT_CI_BUILD: 1 - VT_THROW_ON_ABORT: 1 VT_DIAGNOSTICS: 1 CACHE: "$(Agent.TempDirectory)/cache/" cache_name: ubuntu-clang-9-cache diff --git a/ci/azure/azure-gcc-10-ubuntu-openmpi.yml b/ci/azure/azure-gcc-10-ubuntu-openmpi.yml index d41973588f..13ce1930b3 100644 --- a/ci/azure/azure-gcc-10-ubuntu-openmpi.yml +++ b/ci/azure/azure-gcc-10-ubuntu-openmpi.yml @@ -47,7 +47,6 @@ variables: VT_USE_STD_THREAD: 0 VT_ZOLTAN: 0 VT_CI_BUILD: 1 - VT_THROW_ON_ABORT: 1 VT_DIAGNOSTICS: 1 CACHE: "$(Agent.TempDirectory)/cache/" cache_name: ubuntu-gcc-10-cache diff --git a/ci/azure/azure-gcc-5-ubuntu-mpich.yml b/ci/azure/azure-gcc-5-ubuntu-mpich.yml index 67a4affb19..0af570c323 100644 --- a/ci/azure/azure-gcc-5-ubuntu-mpich.yml +++ b/ci/azure/azure-gcc-5-ubuntu-mpich.yml @@ -47,7 +47,6 @@ variables: VT_USE_STD_THREAD: 0 VT_ZOLTAN: 0 VT_CI_BUILD: 1 - VT_THROW_ON_ABORT: 1 VT_DIAGNOSTICS: 1 CACHE: "$(Agent.TempDirectory)/cache/" cache_name: ubuntu-gcc-5-cache diff --git a/ci/azure/azure-gcc-6-ubuntu-mpich.yml b/ci/azure/azure-gcc-6-ubuntu-mpich.yml index e8cf943397..efc389b3da 100644 --- a/ci/azure/azure-gcc-6-ubuntu-mpich.yml +++ b/ci/azure/azure-gcc-6-ubuntu-mpich.yml @@ -47,7 +47,6 @@ variables: VT_USE_STD_THREAD: 0 VT_ZOLTAN: 0 VT_CI_BUILD: 1 - VT_THROW_ON_ABORT: 1 VT_DIAGNOSTICS: 1 CACHE: "$(Agent.TempDirectory)/cache/" cache_name: ubuntu-gcc-6-cache diff --git a/ci/azure/azure-gcc-7-ubuntu-mpich.yml b/ci/azure/azure-gcc-7-ubuntu-mpich.yml index 1a09662e3b..ab61d30323 100644 --- a/ci/azure/azure-gcc-7-ubuntu-mpich.yml +++ b/ci/azure/azure-gcc-7-ubuntu-mpich.yml @@ -47,7 +47,6 @@ variables: VT_USE_STD_THREAD: 0 VT_ZOLTAN: 0 VT_CI_BUILD: 1 - VT_THROW_ON_ABORT: 1 VT_DIAGNOSTICS: 1 CACHE: "$(Agent.TempDirectory)/cache/" cache_name: ubuntu-gcc-7-cache diff --git a/ci/azure/azure-gcc-8-ubuntu-mpich.yml b/ci/azure/azure-gcc-8-ubuntu-mpich.yml index 0b847ad29a..8f15cd61d5 100644 --- a/ci/azure/azure-gcc-8-ubuntu-mpich.yml +++ b/ci/azure/azure-gcc-8-ubuntu-mpich.yml @@ -47,7 +47,6 @@ variables: VT_USE_STD_THREAD: 1 VT_ZOLTAN: 0 VT_CI_BUILD: 1 - VT_THROW_ON_ABORT: 1 VT_DIAGNOSTICS: 1 CACHE: "$(Agent.TempDirectory)/cache/" cache_name: ubuntu-gcc-8-cache diff --git a/ci/azure/azure-gcc-9-ubuntu-mpich.yml b/ci/azure/azure-gcc-9-ubuntu-mpich.yml index 190761f84b..05d1d7be5e 100644 --- a/ci/azure/azure-gcc-9-ubuntu-mpich.yml +++ b/ci/azure/azure-gcc-9-ubuntu-mpich.yml @@ -47,7 +47,6 @@ variables: VT_USE_STD_THREAD: 0 VT_ZOLTAN: 1 VT_CI_BUILD: 1 - VT_THROW_ON_ABORT: 1 VT_DIAGNOSTICS: 1 CACHE: "$(Agent.TempDirectory)/cache/" cache_name: ubuntu-gcc-9-cache diff --git a/ci/azure/azure-intel-18-ubuntu-mpich-extended.yml b/ci/azure/azure-intel-18-ubuntu-mpich-extended.yml index 4f8806fbdc..47ca030179 100644 --- a/ci/azure/azure-intel-18-ubuntu-mpich-extended.yml +++ b/ci/azure/azure-intel-18-ubuntu-mpich-extended.yml @@ -41,7 +41,6 @@ variables: VT_USE_STD_THREAD: 0 VT_ZOLTAN: 0 VT_CI_BUILD: 1 - VT_THROW_ON_ABORT: 1 VT_DIAGNOSTICS: 1 CACHE: "$(Agent.TempDirectory)/cache/" cache_name: ubuntu-intel-18-cache diff --git a/ci/azure/azure-intel-18-ubuntu-mpich.yml b/ci/azure/azure-intel-18-ubuntu-mpich.yml index c1c091f069..00c0e54aea 100644 --- a/ci/azure/azure-intel-18-ubuntu-mpich.yml +++ b/ci/azure/azure-intel-18-ubuntu-mpich.yml @@ -47,7 +47,6 @@ variables: VT_USE_STD_THREAD: 0 VT_ZOLTAN: 0 VT_CI_BUILD: 1 - VT_THROW_ON_ABORT: 1 VT_DIAGNOSTICS: 1 CACHE: "$(Agent.TempDirectory)/cache/" cache_name: ubuntu-intel-18-cache diff --git a/ci/azure/azure-intel-19-ubuntu-mpich.yml b/ci/azure/azure-intel-19-ubuntu-mpich.yml index a17de24b45..67b80d2a82 100644 --- a/ci/azure/azure-intel-19-ubuntu-mpich.yml +++ b/ci/azure/azure-intel-19-ubuntu-mpich.yml @@ -47,7 +47,6 @@ variables: VT_USE_STD_THREAD: 0 VT_ZOLTAN: 0 VT_CI_BUILD: 1 - VT_THROW_ON_ABORT: 1 VT_DIAGNOSTICS: 1 CACHE: "$(Agent.TempDirectory)/cache/" cache_name: ubuntu-intel-19-cache diff --git a/ci/azure/azure-nvidia-10-ubuntu-mpich-extended.yml b/ci/azure/azure-nvidia-10-ubuntu-mpich-extended.yml index 546fd5670f..49ae12bb98 100644 --- a/ci/azure/azure-nvidia-10-ubuntu-mpich-extended.yml +++ b/ci/azure/azure-nvidia-10-ubuntu-mpich-extended.yml @@ -41,7 +41,6 @@ variables: VT_USE_STD_THREAD: 0 VT_ZOLTAN: 0 VT_CI_BUILD: 1 - VT_THROW_ON_ABORT: 1 VT_DIAGNOSTICS: 1 CACHE: "$(Agent.TempDirectory)/cache/" cache_name: ubuntu-nvidia-10-cache diff --git a/ci/azure/azure-nvidia-10-ubuntu-mpich.yml b/ci/azure/azure-nvidia-10-ubuntu-mpich.yml index 78468c2202..9681b70cb7 100644 --- a/ci/azure/azure-nvidia-10-ubuntu-mpich.yml +++ b/ci/azure/azure-nvidia-10-ubuntu-mpich.yml @@ -47,7 +47,6 @@ variables: VT_USE_STD_THREAD: 0 VT_ZOLTAN: 0 VT_CI_BUILD: 1 - VT_THROW_ON_ABORT: 1 VT_DIAGNOSTICS: 0 CACHE: "$(Agent.TempDirectory)/cache/" cache_name: ubuntu-nvidia-10-cache diff --git a/ci/azure/azure-nvidia-11-ubuntu-mpich-extended.yml b/ci/azure/azure-nvidia-11-ubuntu-mpich-extended.yml index b95e0c588f..1d71102a5c 100644 --- a/ci/azure/azure-nvidia-11-ubuntu-mpich-extended.yml +++ b/ci/azure/azure-nvidia-11-ubuntu-mpich-extended.yml @@ -41,7 +41,6 @@ variables: VT_USE_STD_THREAD: 0 VT_ZOLTAN: 0 VT_CI_BUILD: 1 - VT_THROW_ON_ABORT: 1 VT_DIAGNOSTICS: 1 CACHE: "$(Agent.TempDirectory)/cache/" cache_name: ubuntu-nvidia-11-cache diff --git a/ci/azure/azure-nvidia-11-ubuntu-mpich.yml b/ci/azure/azure-nvidia-11-ubuntu-mpich.yml index e227068b66..d9668a7e70 100644 --- a/ci/azure/azure-nvidia-11-ubuntu-mpich.yml +++ b/ci/azure/azure-nvidia-11-ubuntu-mpich.yml @@ -47,7 +47,6 @@ variables: VT_USE_STD_THREAD: 0 VT_ZOLTAN: 0 VT_CI_BUILD: 1 - VT_THROW_ON_ABORT: 1 VT_DIAGNOSTICS: 0 CACHE: "$(Agent.TempDirectory)/cache/" cache_name: ubuntu-nvidia-11-cache diff --git a/ci/build_cpp.sh b/ci/build_cpp.sh index 97faf82021..f75e3ddda7 100755 --- a/ci/build_cpp.sh +++ b/ci/build_cpp.sh @@ -140,7 +140,6 @@ cmake -G "${CMAKE_GENERATOR:-Ninja}" \ -Dvt_ci_build="${VT_CI_BUILD:-0}" \ -Dvt_debug_verbose="${VT_DEBUG_VERBOSE:-}" \ -Dvt_tests_num_nodes="${VT_TESTS_NUM_NODES:-}" \ - -Dvt_throw_on_abort="${VT_THROW_ON_ABORT:-0}" \ "$VT" cmake_conf_ret=$? diff --git a/cmake/configure_options.cmake b/cmake/configure_options.cmake index 7e78d00516..a53a68fc02 100644 --- a/cmake/configure_options.cmake +++ b/cmake/configure_options.cmake @@ -134,15 +134,6 @@ else() set(vt_feature_cmake_ci_build "0") endif() -option(vt_throw_on_abort "Build VT with 'throw on vtAbort'" OFF) -if (${vt_throw_on_abort}) - message(STATUS "Building VT with 'throw on vtAbort'") - set (vt_feature_cmake_throw_on_abort "1") -else() - message(STATUS "Building VT with `MPI_Abort on vtAbort`") - set (vt_feature_cmake_throw_on_abort "0") -endif() - if (LOWERCASE_CMAKE_BUILD_TYPE STREQUAL "release") option(vt_debug_verbose "Build VT with verbose debug printing enabled" OFF) else() diff --git a/docker-compose.yml b/docker-compose.yml index 4deff29448..a758b19568 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -148,7 +148,6 @@ x-vtopts: &vtopts http_proxy: ${PROXY-} LSAN_OPTIONS: ${LSAN_OPTIONS-} VT_CI_BUILD: ${VT_CI_BUILD:-0} - VT_THROW_ON_ABORT: ${VT_THROW_ON_ABORT:-0} VT_DEBUG_VERBOSE: ${VT_DEBUG_VERBOSE-} VT_TESTS_NUM_NODES: ${VT_TESTS_NUM_NODES:-} CODECOV_TOKEN: ${CODECOV_TOKEN:-} diff --git a/docs/md/building.md b/docs/md/building.md index 28151cf990..c297db07de 100644 --- a/docs/md/building.md +++ b/docs/md/building.md @@ -69,7 +69,6 @@ build configuration: | `VT_BUILD_TESTS` | 1 | Build all VT tests | | `VT_BUILD_EXAMPLES` | 1 | Build all VT examples | | `vt_debug_verbose` | 1 (not Release) | Enable VT verbose debug prints at compile-time | -| `vt_throw_on_abort` | 0 | Throw an exception instead of calling `MPI_Abort` on `vtAbort` | \subsection using-the-build-script Using the Build Script @@ -104,7 +103,6 @@ parameters. | `VT_DIAGNOSTICS_RUNTIME_ENABLED` | 0 | Enable VT component diagnostics at runtime by default | | `VT_DEBUG_VERBOSE` | | Enable VT verbose debug prints at compile-time | | `VT_TESTS_NUM_NODES` | | Maximum number of nodes used for tests. If empty, then the default value detected by CMake is used | -| `VT_THROW_ON_ABORT` | 0 | Throw an exception instead of calling `MPI_Abort` on `vtAbort` | With these set, invoke the script with two arguments: the path to the *vt* root directory and the build path. Here's an example assuming that *vt* is cloned diff --git a/scripts/azure-workflow-template.yml b/scripts/azure-workflow-template.yml index 96114daa45..07b2d13d8b 100644 --- a/scripts/azure-workflow-template.yml +++ b/scripts/azure-workflow-template.yml @@ -37,7 +37,6 @@ variables: VT_USE_STD_THREAD: [% vt_use_std_thread %] VT_ZOLTAN: [% vt_zoltan %] VT_CI_BUILD: [% vt_ci_build %] - VT_THROW_ON_ABORT: [% vt_throw_on_abort %] VT_DIAGNOSTICS: [% vt_diagnostics %] CACHE: "$(Agent.TempDirectory)/cache/" cache_name: [% cache_name %] diff --git a/scripts/workflows-azure.ini b/scripts/workflows-azure.ini index 0447e39f5f..1a1dcd22a6 100644 --- a/scripts/workflows-azure.ini +++ b/scripts/workflows-azure.ini @@ -17,7 +17,6 @@ vt_use_openmp = 0 vt_use_std_thread = 0 vt_zoltan = 0 vt_ci_build = 1 -vt_throw_on_abort = 1 vt_tests_num_nodes = 2 ulimit_core = 0 code_coverage = 0 @@ -213,7 +212,6 @@ linux_env ="" output_name = ci/azure/azure-clang-10-alpine-mpich.yml build_root = $(ARCH)-[% linux %]-$(COMPILER)-cache vt_production_build = 1 -vt_throw_on_abort = 0 [PR-tests-clang-9] test_configuration = "clang-9, ubuntu, mpich" diff --git a/tests/unit/test_parallel_harness.h b/tests/unit/test_parallel_harness.h index 21e9affff3..38afeab707 100644 --- a/tests/unit/test_parallel_harness.h +++ b/tests/unit/test_parallel_harness.h @@ -95,15 +95,11 @@ struct TestParallelHarnessAny : TestHarnessAny { virtual void TearDown() { using namespace vt; -#if vt_check_enabled(throw_on_abort) try { vt::theSched()->runSchedulerWhile([] { return !rt->isTerminated(); }); } catch (std::exception& e) { ADD_FAILURE() << fmt::format("Caught an exception: {}\n", e.what()); } -#else - vt::theSched()->runSchedulerWhile([] { return !rt->isTerminated(); }); -#endif #if DEBUG_TEST_HARNESS_PRINT auto const& my_node = theContext()->getNode(); From 61e6223f9f83fb60e6238e7b3dd6d71a8b91a745 Mon Sep 17 00:00:00 2001 From: Jakub Domagala Date: Thu, 27 May 2021 23:03:26 +0200 Subject: [PATCH 8/9] #1456: test: Add test for vt_throw_on_abort with nompi --- tests/unit/runtime/test_preconfig.nompi.cc | 77 ++++++++++++++++++++++ tests/unit/test_harness.h | 2 +- 2 files changed, 78 insertions(+), 1 deletion(-) create mode 100644 tests/unit/runtime/test_preconfig.nompi.cc diff --git a/tests/unit/runtime/test_preconfig.nompi.cc b/tests/unit/runtime/test_preconfig.nompi.cc new file mode 100644 index 0000000000..20c640a218 --- /dev/null +++ b/tests/unit/runtime/test_preconfig.nompi.cc @@ -0,0 +1,77 @@ +/* +//@HEADER +// ***************************************************************************** +// +// test_preconfig.nompi.cc +// DARMA Toolkit v. 1.0.0 +// DARMA/vt => Virtual Transport +// +// Copyright 2020 National Technology & Engineering Solutions of Sandia, LLC +// (NTESS). Under the terms of Contract DE-NA0003525 with NTESS, the U.S. +// Government retains certain rights in this software. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// * Redistributions of source code must retain the above copyright notice, +// this list of conditions and the following disclaimer. +// +// * Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// +// * Neither the name of the copyright holder nor the names of its +// contributors may be used to endorse or promote products derived from this +// software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// +// Questions? Contact darma@sandia.gov +// +// ***************************************************************************** +//@HEADER +*/ + +#include + +#include "test_harness.h" + +#include + +namespace vt { namespace tests { namespace unit { + +struct TestPreconfig : TestHarness { }; + +#if not vt_check_enabled(production_build) +TEST_F(TestPreconfig, test_vt_assert) { + EXPECT_EQ(vt::debug::preConfig()->vt_throw_on_abort, true) + << "vt_throw_on_abort should be enabled by default"; + + ASSERT_THROW( + vtAssert(false, "Should throw."), + std::runtime_error + ); +} +#endif + +TEST_F(TestPreconfig, test_vt_abort) { + EXPECT_EQ(vt::debug::preConfig()->vt_throw_on_abort, true) + << "vt_throw_on_abort should be enabled by default"; + + ASSERT_THROW( + vtAbort("Should throw."), + std::runtime_error + ); +} + +}}} // end namespace vt::tests::unit diff --git a/tests/unit/test_harness.h b/tests/unit/test_harness.h index 870b13a90c..71c09e8e7d 100644 --- a/tests/unit/test_harness.h +++ b/tests/unit/test_harness.h @@ -44,7 +44,7 @@ #if ! defined __VIRTUAL_TRANSPORT_TEST_HARNESS__ #define __VIRTUAL_TRANSPORT_TEST_HARNESS__ -#include +#include #include #include From a4402beea973218886100e9890a1f5993e725764 Mon Sep 17 00:00:00 2001 From: Jakub Domagala Date: Fri, 28 May 2021 00:52:47 +0200 Subject: [PATCH 9/9] #1456: config: Remove throw_on_abort flag from cmake_config --- cmake_config.h.in | 1 - 1 file changed, 1 deletion(-) diff --git a/cmake_config.h.in b/cmake_config.h.in index 4e332dfd80..faa7125880 100644 --- a/cmake_config.h.in +++ b/cmake_config.h.in @@ -68,7 +68,6 @@ #define vt_feature_cmake_libfort @vt_feature_cmake_libfort@ #define vt_feature_cmake_production_build @vt_feature_cmake_production_build@ #define vt_feature_cmake_debug_verbose @vt_feature_cmake_debug_verbose@ -#define vt_feature_cmake_throw_on_abort @vt_feature_cmake_throw_on_abort@ #define vt_detected_max_num_nodes @cmake_detected_max_num_nodes@