New error handling from Markus

This commit is contained in:
Tong Dong Qiu
2021-06-16 15:54:06 +02:00
parent 31eeb33039
commit f075c236c1

View File

@@ -39,6 +39,11 @@
#include <boost/property_tree/json_parser.hpp>
#include <boost/property_tree/ptree.hpp>
class PlatformInitException : public std::logic_error
{
public:
PlatformInitException(std::string msg) : logic_error(msg){};
};
template <int bz>
Dune::BlockVector<Dune::FieldVector<double, bz>>
@@ -75,14 +80,15 @@ testOpenclSolver(const boost::property_tree::ptree& prm, const std::string& matr
Vector x(rhs.size());
Opm::WellContributions wellContribs("opencl");
std::unique_ptr<Opm::BdaBridge<Matrix, Vector, bz> > bridge;
try {
Opm::BdaBridge<Matrix, Vector, bz> bridge(gpu_mode, fpga_bitstream, linear_solver_verbosity, maxit, tolerance, platformID, deviceID, opencl_ilu_reorder);
bridge.solve_system(&matrix, rhs, wellContribs, result);
bridge.get_result(x);
bridge = std::make_unique<Opm::BdaBridge<Matrix, Vector, bz> >(gpu_mode, fpga_bitstream, linear_solver_verbosity, maxit, tolerance, platformID, deviceID, opencl_ilu_reorder);
} catch (const std::logic_error& error) {
BOOST_WARN_MESSAGE(true, error.what());
throw PlatformInitException(error.what());
}
bridge->solve_system(&matrix, rhs, wellContribs, result);
bridge->get_result(x);
return x;
}
@@ -115,8 +121,12 @@ BOOST_AUTO_TEST_CASE(TestDefaultPreconditionerFactory)
pt::read_json(file, prm);
}
// Test with 3x3 block solvers.
test3(prm);
try {
// Test with 3x3 block solvers.
test3(prm);
} catch(const PlatformInitException& ) {
BOOST_WARN_MESSAGE(true, "Problem with initializing Platform. skipping test");
}
}