Commit 679798eb authored by Nick's avatar Nick
Browse files

Prevent hang when throwing out of adios constructor in MPI.

parent dab81f1d
......@@ -11,7 +11,8 @@
#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"
......@@ -64,6 +65,12 @@ ADIOS::ADIOS(const std::string configFile, helper::Comm comm,
{
if (!configFile.empty())
{
std::ifstream f(configFile.c_str());
if (!f.good())
{
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>
#include <mpi.h>
int main(int argc, char *argv[])
{
int rank = 0;
int size = 1;
#ifdef ADIOS2_HAVE_MPI
MPI_Init(&argc, &argv);
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
MPI_Comm_size(MPI_COMM_WORLD, &size);
#endif
adios2::ADIOS ad;
try
{
ad = adios2::ADIOS("does_not_exist.xml", MPI_COMM_WORLD, adios2::DebugON);
}
catch (std::exception &e)
{
if (rank == 0)
{
std::cout << e.what() << "\n";
}
ad = adios2::ADIOS(MPI_COMM_WORLD, adios2::DebugON);
}
#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