mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
Only initialize VexCL once
This commit is contained in:
parent
b0749ce7d4
commit
0ee6b58fb0
@ -267,8 +267,12 @@ void amgclSolverBackend<block_size>::solve_system(double *b, BdaResult &res) {
|
||||
std::tie(iters, error) = solve(B, X);
|
||||
} else if (backend_type == Amgcl_backend_type::vexcl) {
|
||||
#if HAVE_VEXCL
|
||||
vex::Context ctx(vex::Filter::Env && vex::Filter::Count(1));
|
||||
std::cout << ctx << std::endl;
|
||||
static vex::Context ctx(vex::Filter::Env && vex::Filter::Count(1));
|
||||
std::call_once(vexcl_initialize, [&](){
|
||||
std::ostringstream out;
|
||||
out << "Using VexCL on " << ctx << std::endl;
|
||||
OpmLog::info(out.str());
|
||||
});
|
||||
if constexpr(block_size == 1){
|
||||
auto A = std::tie(N, A_rows, A_cols, A_vals);
|
||||
|
||||
|
@ -90,6 +90,10 @@ private:
|
||||
void solve_cuda(double *b);
|
||||
#endif
|
||||
|
||||
#if HAVE_VEXCL
|
||||
std::once_flag vexcl_initialize;
|
||||
#endif
|
||||
|
||||
/// Initialize GPU and allocate memory
|
||||
/// \param[in] N number of nonzeroes, divide by dim*dim to get number of blocks
|
||||
/// \param[in] nnz number of nonzeroes, divide by dim*dim to get number of blocks
|
||||
|
Loading…
Reference in New Issue
Block a user