diff --git a/tests/test_openclSolver.cpp b/tests/test_openclSolver.cpp index fd2c7fdb4..94bb0b88d 100644 --- a/tests/test_openclSolver.cpp +++ b/tests/test_openclSolver.cpp @@ -39,6 +39,11 @@ #include #include +class PlatformInitException : public std::logic_error +{ +public: + PlatformInitException(std::string msg) : logic_error(msg){}; +}; template Dune::BlockVector> @@ -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 > bridge; try { - Opm::BdaBridge 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 >(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"); + } }