diff --git a/src/backends/fvm_gpu.hpp b/src/backends/fvm_gpu.hpp index 5e3e7a14f128c4ca272b2aabaa83cb255efcafd6..9933dd77ec1cb9abf2bfc01777413709f67ec60b 100644 --- a/src/backends/fvm_gpu.hpp +++ b/src/backends/fvm_gpu.hpp @@ -118,17 +118,20 @@ struct backend { { auto n = d.size(); host_array invariant_d_tmp(n, 0); + host_array u_tmp(n, 0); // make a copy of the conductance on the host host_array face_conductance_tmp = face_conductance; + auto p_tmp = memory::on_host(p); for(auto i: util::make_span(1u, n)) { auto gij = face_conductance_tmp[i]; - u[i] = -gij; + u_tmp[i] = -gij; invariant_d_tmp[i] += gij; - invariant_d_tmp[p[i]] += gij; + invariant_d_tmp[p_tmp[i]] += gij; } invariant_d = invariant_d_tmp; + memory::copy(u_tmp, u); params = { d.data(), u.data(), rhs.data(), diff --git a/src/cell_group.hpp b/src/cell_group.hpp index 807238a440862c2265cc624f57fad5ebb3e71eeb..ef4c71b2344390b4a705df29969d7dabb600354b 100644 --- a/src/cell_group.hpp +++ b/src/cell_group.hpp @@ -106,7 +106,7 @@ public: time_type tnext = next ? next->time: tstep; cell_.advance(tnext - cell_.time()); - if (!cell_.is_physical_solution()) { + if (util::is_debug_mode() && !cell_.is_physical_solution()) { std::cerr << "warning: solution out of bounds for cell " << gid_base_ << " at t " << cell_.time() << " ms\n"; } diff --git a/src/util/debug.hpp b/src/util/debug.hpp index c2945e29a26eb364c6a90605a5daec664f77dea8..3c3eaa853d70f4f93e0ab71eb3e81efd8424d9c9 100644 --- a/src/util/debug.hpp +++ b/src/util/debug.hpp @@ -11,6 +11,13 @@ namespace nest { namespace mc { namespace util { +constexpr inline bool is_debug_mode() { +#ifndef NDEBUG + return true; +#else + return false; +#endif +} using failed_assertion_handler_t = bool (*)(const char* assertion, const char* file, int line, const char* func);