Unverified Commit 1e7fd8f8 authored by Atkins, Charles Vernon's avatar Atkins, Charles Vernon Committed by GitHub
Browse files

Merge pull request #2013 from NAThompson/prevent_hang

Prevent hang when throwing out of adios constructor in MPI.
parents ec31a361 bcb9cfc8
......@@ -11,11 +11,13 @@
#include "ADIOS.h"
#include <algorithm> // std::transform
#include <ios> //std::ios_base::failure
#include <fstream>
#include <ios> //std::ios_base::failure
#include "adios2/core/IO.h"
#include "adios2/helper/adiosCommDummy.h"
#include "adios2/helper/adiosFunctions.h" //InquireKey, BroadcastFile
#include <adios2sys/SystemTools.hxx>
// OPERATORS
......@@ -64,6 +66,11 @@ ADIOS::ADIOS(const std::string configFile, helper::Comm comm,
{
if (!configFile.empty())
{
if (!adios2sys::SystemTools::FileExists(configFile))
{
throw std::logic_error("Config file " + configFile +
" passed to ADIOS does not exist.");
}
if (helper::EndsWith(configFile, ".xml"))
{
XMLInit(configFile);
......
......@@ -40,9 +40,10 @@ bp3_bp4_gtest_add_tests_helper(ChangingShape)
bp3_bp4_gtest_add_tests_helper(WriteReadBlockInfo)
bp3_bp4_gtest_add_tests_helper(WriteReadVariableSpan)
bp3_bp4_gtest_add_tests_helper(TimeAggregation)
bp3_bp4_gtest_add_tests_helper(NoXMLRecovery)
if(ADIOS2_HAVE_MPI)
bp3_bp4_gtest_add_tests_helper(WriteAggregateRead)
bp3_bp4_gtest_add_tests_helper(WriteAggregateRead)
endif()
# BP3 only for now
......
#include <iostream>
#include <vector>
#include <adios2.h>
#ifdef ADIOS2_HAVE_MPI
#include <mpi.h>
#endif
int main(int argc, char *argv[])
{
int rank = 0;
#ifdef ADIOS2_HAVE_MPI
MPI_Init(&argc, &argv);
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
#endif
adios2::ADIOS ad;
try
{
#ifdef ADIOS2_HAVE_MPI
ad = adios2::ADIOS("does_not_exist.xml", MPI_COMM_WORLD,
adios2::DebugON);
#else
ad = adios2::ADIOS("does_not_exist.xml", adios2::DebugON);
#endif
}
catch (std::exception &e)
{
if (rank == 0)
{
std::cout << e.what() << "\n";
}
#ifdef ADIOS2_HAVE_MPI
ad = adios2::ADIOS(MPI_COMM_WORLD, adios2::DebugON);
#else
ad = adios2::ADIOS(adios2::DebugON);
#endif
}
#ifdef ADIOS2_HAVE_MPI
return MPI_Finalize();
#endif
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment