diff --git a/arbor/backends/gpu/shared_state.cpp b/arbor/backends/gpu/shared_state.cpp index b26dbea42288935591b3d345e036933f3671f393..566c282252cb074fea9e864de160e507d351ce88 100644 --- a/arbor/backends/gpu/shared_state.cpp +++ b/arbor/backends/gpu/shared_state.cpp @@ -254,6 +254,7 @@ void shared_state::set_parameter(mechanism& m, const std::string& key, const std break; } } + if (!data) throw arbor_internal_error(util::pprintf("no such mechanism parameter '{}'", key)); if (!m.ppack_.width) return; diff --git a/arbor/backends/multicore/shared_state.cpp b/arbor/backends/multicore/shared_state.cpp index befda35a507eef279683bb4005e4fc81ca908ce6..6936f56dcec078faa1d710da4e708de322dfa7a1 100644 --- a/arbor/backends/multicore/shared_state.cpp +++ b/arbor/backends/multicore/shared_state.cpp @@ -428,7 +428,7 @@ std::size_t extend_width(const arb::mechanism& mech, std::size_t width) { } // anonymous namespace void shared_state::set_parameter(mechanism& m, const std::string& key, const std::vector<arb_value_type>& values) { - if (values.size()!=m.ppack_.width) throw arbor_internal_error("mechanism parameter size mismatch"); + if (values.size()!=m.ppack_.width) throw arbor_internal_error("mechanism field size mismatch"); arb_value_type* data = nullptr; for (arb_size_type i = 0; i<m.mech_.n_parameters; ++i) { @@ -437,7 +437,8 @@ void shared_state::set_parameter(mechanism& m, const std::string& key, const std break; } } - if (!data) throw arbor_internal_error(util::pprintf("no such mechanism parameter '{}'", key)); + + if (!data) throw arbor_internal_error(util::pprintf("no such parameter '{}'", key)); if (!m.ppack_.width) return; auto width_padded = extend_width<arb_value_type>(m, m.ppack_.width); diff --git a/arbor/include/arbor/mechanism.hpp b/arbor/include/arbor/mechanism.hpp index aececa1a720a8965e27565393dbcdc50187c600a..b6aa7919c7ad17af9b05aaaf65abef0f4380d0b5 100644 --- a/arbor/include/arbor/mechanism.hpp +++ b/arbor/include/arbor/mechanism.hpp @@ -53,9 +53,6 @@ public: // the result must be instantiated. mechanism_ptr clone() const { return std::make_unique<mechanism>(mech_, iface_); } - // Non-global parameters can be set post-instantiation: - void set_parameter(const std::string&, const std::vector<arb_value_type>&); - // Forward to interface methods void initialize() { ppack_.vec_t = *time_ptr_ptr; iface_.init_mechanism(&ppack_); } void update_current() { ppack_.vec_t = *time_ptr_ptr; iface_.compute_currents(&ppack_); } diff --git a/modcc/module.hpp b/modcc/module.hpp index f29ddd06d99408d11fcd1b7405d20e394e6fbeee..1854bd55c86e82c98d99df5844638665c9110f39 100644 --- a/modcc/module.hpp +++ b/modcc/module.hpp @@ -54,6 +54,9 @@ public: // Retrieve list of state variable ids. StateBlock const& state_block() const {return state_block_;} + // Retrieve list of assigned variable ids. + AssignedBlock const& assigned_block() const {return assigned_block_;} + // Retrieve list of parameter variable ids. ParameterBlock const& parameter_block() const {return parameter_block_;} diff --git a/modcc/printer/cprinter.cpp b/modcc/printer/cprinter.cpp index 2213776081887a603d963452ee3c3d6a1659b4b2..6dd28c88375854b386e346d6ba0de0991356dadd 100644 --- a/modcc/printer/cprinter.cpp +++ b/modcc/printer/cprinter.cpp @@ -263,6 +263,8 @@ std::string emit_cpp_source(const Module& module_, const printer_options& opt) { } }; + const auto& [state_ids, global_ids, param_ids] = public_variable_ids(module_); + const auto& assigned_ids = module_.assigned_block().parameters; out << fmt::format(FMT_COMPILE("#define PPACK_IFACE_BLOCK \\\n" "[[maybe_unused]] auto {0}width = pp->width;\\\n" "[[maybe_unused]] auto {0}n_detectors = pp->n_detectors;\\\n" @@ -284,22 +286,22 @@ std::string emit_cpp_source(const Module& module_, const printer_options& opt) { "[[maybe_unused]] auto& {0}index_constraints = pp->index_constraints;\\\n"), pp_var_pfx); auto global = 0; - for (const auto& scalar: vars.scalars) { - out << fmt::format("[[maybe_unused]] auto {}{} = pp->globals[{}];\\\n", pp_var_pfx, scalar->name(), global); + for (const auto& scalar: global_ids) { + out << fmt::format("[[maybe_unused]] auto {}{} = pp->globals[{}];\\\n", pp_var_pfx, scalar.name(), global); global++; } auto param = 0, state = 0; - for (const auto& array: vars.arrays) { - if (array->is_state()) { - out << fmt::format("[[maybe_unused]] auto* {}{} = pp->state_vars[{}];\\\n", pp_var_pfx, array->name(), state); - state++; - } + for (const auto& array: state_ids) { + out << fmt::format("[[maybe_unused]] auto* {}{} = pp->state_vars[{}];\\\n", pp_var_pfx, array.name(), state); + state++; } - for (const auto& array: vars.arrays) { - if (!array->is_state()) { - out << fmt::format("[[maybe_unused]] auto* {}{} = pp->parameters[{}];\\\n", pp_var_pfx, array->name(), param); - param++; - } + for (const auto& array: assigned_ids) { + out << fmt::format("[[maybe_unused]] auto* {}{} = pp->state_vars[{}];\\\n", pp_var_pfx, array.name(), state); + state++; + } + for (const auto& array: param_ids) { + out << fmt::format("[[maybe_unused]] auto* {}{} = pp->parameters[{}];\\\n", pp_var_pfx, array.name(), param); + param++; } auto idx = 0; for (const auto& ion: module_.ion_deps()) { diff --git a/modcc/printer/gpuprinter.cpp b/modcc/printer/gpuprinter.cpp index 5343f0232133f44c0c142c0c483fe76213325cad..73fda5a10fd0acd4202bf455bc673c774ca9e2f9 100644 --- a/modcc/printer/gpuprinter.cpp +++ b/modcc/printer/gpuprinter.cpp @@ -144,23 +144,27 @@ std::string emit_gpu_cu_source(const Module& module_, const printer_options& opt "auto& {0}mechanism_id __attribute__((unused)) = params_.mechanism_id;\\\n" "auto& {0}index_constraints __attribute__((unused)) = params_.index_constraints;\\\n"), pp_var_pfx); + + const auto& [state_ids, global_ids, param_ids] = public_variable_ids(module_); + const auto& assigned_ids = module_.assigned_block().parameters; + auto global = 0; - for (const auto& scalar: vars.scalars) { - out << fmt::format("auto {}{} __attribute__((unused)) = params_.globals[{}];\\\n", pp_var_pfx, scalar->name(), global); + for (const auto& scalar: global_ids) { + out << fmt::format("auto {}{} __attribute__((unused)) = params_.globals[{}];\\\n", pp_var_pfx, scalar.name(), global); global++; } auto param = 0, state = 0; - for (const auto& array: vars.arrays) { - if (array->is_state()) { - out << fmt::format("auto* {}{} __attribute__((unused)) = params_.state_vars[{}];\\\n", pp_var_pfx, array->name(), state); - state++; - } + for (const auto& array: state_ids) { + out << fmt::format("auto* {}{} __attribute__((unused)) = params_.state_vars[{}];\\\n", pp_var_pfx, array.name(), state); + state++; } - for (const auto& array: vars.arrays) { - if (!array->is_state()) { - out << fmt::format("auto* {}{} __attribute__((unused)) = params_.parameters[{}];\\\n", pp_var_pfx, array->name(), param); - param++; - } + for (const auto& array: assigned_ids) { + out << fmt::format("auto* {}{} __attribute__((unused)) = params_.state_vars[{}];\\\n", pp_var_pfx, array.name(), state); + state++; + } + for (const auto& array: param_ids) { + out << fmt::format("auto* {}{} __attribute__((unused)) = params_.parameters[{}];\\\n", pp_var_pfx, array.name(), param); + param++; } auto idx = 0; for (const auto& ion: module_.ion_deps()) { diff --git a/modcc/printer/infoprinter.cpp b/modcc/printer/infoprinter.cpp index ce84fa01310f1d26f6fcce802a8b4a348c8a3ae5..421a5b67de00608b4843a882d4a2b4d26da9b4ea 100644 --- a/modcc/printer/infoprinter.cpp +++ b/modcc/printer/infoprinter.cpp @@ -28,107 +28,60 @@ std::string build_info_header(const Module& m, const printer_options& opt, bool std::string fingerprint = "<placeholder>"; + const auto lowest = std::to_string(std::numeric_limits<double>::lowest()); + const auto max = std::to_string(std::numeric_limits<double>::max()); out << fmt::format("#pragma once\n\n" "#include <cmath>\n" "#include <{}mechanism_abi.h>\n\n", arb_header_prefix()); - auto vars = local_module_variables(m); - auto ion_deps = m.ion_deps(); - - - std::unordered_map<std::string, Id> name2id; - for (const auto& id: m.parameter_block().parameters) name2id[id.name()] = id; - for (const auto& id: m.state_block().state_variables) name2id[id.name()] = id; - - auto fmt_var = [&](const auto& v) { - auto kv = name2id.find(v->name()); - auto lo = std::numeric_limits<double>::lowest(); - auto hi = std::numeric_limits<double>::max(); - std::string unit = ""; - if (kv != name2id.end()) { - auto id = kv->second; - unit = id.unit_string(); - if (id.has_range()) { - auto lo = id.range.first; - auto hi = id.range.second; - } - } - return fmt::format("{{ \"{}\", \"{}\", {}, {}, {} }}", - v->name(), - unit, - std::isnan(v->value()) ? "NAN" : std::to_string(v->value()), - lo, hi); - }; - - auto fmt_ion = [](const auto& i) { - return fmt::format(FMT_COMPILE("{{ \"{}\", {}, {}, {}, {}, {}, {}, {} }}"), - i.name, - i.writes_concentration_int(), - i.writes_concentration_ext(), - i.writes_rev_potential(), - i.uses_rev_potential(), - i.uses_valence(), - i.verifies_valence(), - i.expected_valence); + const auto& [state_ids, global_ids, param_ids] = public_variable_ids(m); + const auto& assigned_ids = m.assigned_block().parameters; + auto fmt_var = [&](const auto& id) { + auto lo = id.has_range() ? id.range.first : lowest; + auto hi = id.has_range() ? id.range.second : max; + auto val = id.has_value() ? id.value : "NAN"; + return fmt::format(FMT_COMPILE("{{ \"{}\", \"{}\", {}, {}, {} }}"), id.name(), id.unit_string(), val, lo, hi); }; - out << fmt::format("extern \"C\" {{\n" - " arb_mechanism_type make_{0}_{1}() {{\n", + " arb_mechanism_type make_{0}_{1}() {{\n" + " // Tables\n", std::regex_replace(opt.cpp_namespace, std::regex{"::"}, "_"), name); - - out << " // Tables\n"; { - auto n = 0ul; io::separator sep("", ",\n "); out << " static arb_field_info globals[] = { "; - for (const auto& var: vars.scalars) { - out << sep << fmt_var(var); - ++n; - } - out << " };\n" - << " static arb_size_type n_globals = " << n << ";\n"; + for (const auto& var: global_ids) out << sep << fmt_var(var); + out << fmt::format(" }};\n" + " static arb_size_type n_globals = {};\n", global_ids.size()); } - { - auto n = 0ul; io::separator sep("", ",\n "); out << " static arb_field_info state_vars[] = { "; - for (const auto& var: vars.arrays) { - if(var->is_state()) { - out << sep << fmt_var(var); - ++n; - } - } - out << " };\n" - << " static arb_size_type n_state_vars = " << n << ";\n"; + for (const auto& id: state_ids) out << sep << fmt_var(id); + for (const auto& id: assigned_ids) out << sep << fmt_var(id); + out << fmt::format(" }};\n" + " static arb_size_type n_state_vars = {};\n", assigned_ids.size() + state_ids.size()); } { - auto n = 0ul; io::separator sep("", ",\n "); out << " static arb_field_info parameters[] = { "; - for (const auto& var: vars.arrays) { - if(!var->is_state()) { - out << sep << fmt_var(var); - ++n; - } - } - out << " };\n" - << " static arb_size_type n_parameters = " << n << ";\n"; + for (const auto& id: param_ids) out << sep << fmt_var(id); + out << fmt::format(" }};\n" + " static arb_size_type n_parameters = {};\n", param_ids.size()); } - { io::separator sep("", ",\n"); out << " static arb_ion_info ions[] = { "; - auto n = 0ul; - for (const auto& var: ion_deps) { - out << sep << fmt_ion(var); - ++n; - } - out << " };\n" - << " static arb_size_type n_ions = " << n << ";\n"; + for (const auto& ion: m.ion_deps()) out << sep + << fmt::format(FMT_COMPILE("{{ \"{}\", {}, {}, {}, {}, {}, {}, {} }}"), + ion.name, + ion.writes_concentration_int(), ion.writes_concentration_ext(), + ion.writes_rev_potential(), ion.uses_rev_potential(), + ion.uses_valence(), ion.verifies_valence(), ion.expected_valence); + out << fmt::format(" }};\n" + " static arb_size_type n_ions = {};\n", m.ion_deps().size()); } out << fmt::format(FMT_COMPILE("\n" diff --git a/test/unit/mod/test_linear_init.mod b/test/unit/mod/test_linear_init.mod index 089f0453d0ccec33bde9e104cf8469dee6082a8e..74b7323c30ed3e3ec8139792455ee4de6a5a8d68 100644 --- a/test/unit/mod/test_linear_init.mod +++ b/test/unit/mod/test_linear_init.mod @@ -11,18 +11,17 @@ PARAMETER { a4 = 7.3 } -ASSIGNED { - a0 : = 2.5 - a1 : = 0.5 - a2 : = 3 - a3 : = 2.3 -} +ASSIGNED { a0 a1 a2 a3 } BREAKPOINT { s = a1 } INITIAL { + a0 = 2.5 + a1 = 0.5 + a2 = 3 + a3 = 2.3 SOLVE sinit } diff --git a/test/unit/mod/test_linear_init_shuffle.mod b/test/unit/mod/test_linear_init_shuffle.mod index 07d4ce954b033109359e1d18917ac72b9721b5f8..08c24dae4d87d1d08ee00b4df408c3f61682f5e8 100644 --- a/test/unit/mod/test_linear_init_shuffle.mod +++ b/test/unit/mod/test_linear_init_shuffle.mod @@ -11,18 +11,17 @@ PARAMETER { a4 = 7.3 } -ASSIGNED { - a0 : = 2.5 - a1 : = 0.5 - a2 : = 3 - a3 : = 2.3 -} +ASSIGNED { a0 a1 a2 a3 } BREAKPOINT { s = a1 } INITIAL { + a0 = 2.5 + a1 = 0.5 + a2 = 3 + a3 = 2.3 SOLVE sinit } diff --git a/test/unit/mod/test_linear_state.mod b/test/unit/mod/test_linear_state.mod index 1b0f8235091deb3cc4916624f61f4c2221d959f2..581900f799402f7f2a759b80758cc510e284b1f6 100644 --- a/test/unit/mod/test_linear_state.mod +++ b/test/unit/mod/test_linear_state.mod @@ -11,11 +11,13 @@ PARAMETER { a4 = 7.3 } -ASSIGNED { - a0 : = 2.5 - a1 : = 0.5 - a2 : = 3 - a3 : = 2.3 +ASSIGNED { a0 a1 a2 a3 } + +INITIAL { + a0 = 2.5 + a1 = 0.5 + a2 = 3 + a3 = 2.3 } BREAKPOINT { diff --git a/test/unit/test_kinetic_linear.cpp b/test/unit/test_kinetic_linear.cpp index fc2557dd07e8520d8da017ad75c27fc0c7d87ab3..07b2f1303821dc891665e53f2780778ed323a448 100644 --- a/test/unit/test_kinetic_linear.cpp +++ b/test/unit/test_kinetic_linear.cpp @@ -27,7 +27,6 @@ ACCESS_BIND(std::unique_ptr<shared_state> fvm_cell::*, private_state_ptr, &fvm_c template <typename backend> void run_test(std::string mech_name, std::vector<std::string> state_variables, - std::unordered_map<std::string, fvm_value_type> assigned_variables, std::vector<fvm_value_type> t0_values, std::vector<fvm_value_type> t1_values, fvm_value_type dt) { @@ -59,11 +58,6 @@ void run_test(std::string mech_name, } shared_state->instantiate(*test, 0, overrides, layout); - - for (auto a: assigned_variables) { - shared_state->set_parameter(*test, a.first, std::vector<fvm_value_type>(ncv,a.second)); - } - shared_state->reset(); test->initialize(); @@ -96,8 +90,8 @@ TEST(mech_kinetic, kinetic_linear_scaled) { std::vector<fvm_value_type> t1_0_values = {0.373297, 0.591621, 0.0350817}; std::vector<fvm_value_type> t1_1_values = {0.329897, 0.537371, 0.132732}; - run_test<multicore::backend>("test0_kin_compartment", state_variables, {}, t0_values, t1_0_values, 0.5); - run_test<multicore::backend>("test1_kin_compartment", state_variables, {}, t0_values, t1_1_values, 0.5); + run_test<multicore::backend>("test0_kin_compartment", state_variables, t0_values, t1_0_values, 0.5); + run_test<multicore::backend>("test1_kin_compartment", state_variables, t0_values, t1_1_values, 0.5); } @@ -107,9 +101,9 @@ TEST(mech_kinetic, kinetic_linear_1_conserve) { std::vector<fvm_value_type> t1_0_values = {0.380338, 0.446414, 0.173247}; std::vector<fvm_value_type> t1_1_values = {0.218978, 0.729927, 0.0510949}; - run_test<multicore::backend>("test0_kin_diff", state_variables, {}, t0_values, t1_0_values, 0.5); - run_test<multicore::backend>("test0_kin_conserve", state_variables, {}, t0_values, t1_0_values, 0.5); - run_test<multicore::backend>("test0_kin_steadystate", state_variables, {}, t0_values, t1_1_values, 0.5); + run_test<multicore::backend>("test0_kin_diff", state_variables, t0_values, t1_0_values, 0.5); + run_test<multicore::backend>("test0_kin_conserve", state_variables, t0_values, t1_0_values, 0.5); + run_test<multicore::backend>("test0_kin_steadystate", state_variables, t0_values, t1_1_values, 0.5); } TEST(mech_kinetic, kinetic_linear_2_conserve) { @@ -118,9 +112,9 @@ TEST(mech_kinetic, kinetic_linear_2_conserve) { std::vector<fvm_value_type> t1_0_values = {0.217391304, 0.782608696, 0.33333333, 0.66666666}; std::vector<fvm_value_type> t1_1_values = {0.230769, 0.769231, 0.189189, 0.810811}; - run_test<multicore::backend>("test1_kin_diff", state_variables, {}, t0_values, t1_0_values, 0.5); - run_test<multicore::backend>("test1_kin_conserve", state_variables, {}, t0_values, t1_0_values, 0.5); - run_test<multicore::backend>("test1_kin_steadystate", state_variables, {}, t0_values, t1_1_values, 0.5); + run_test<multicore::backend>("test1_kin_diff", state_variables, t0_values, t1_0_values, 0.5); + run_test<multicore::backend>("test1_kin_conserve", state_variables, t0_values, t1_0_values, 0.5); + run_test<multicore::backend>("test1_kin_steadystate", state_variables, t0_values, t1_1_values, 0.5); } TEST(mech_kinetic, kinetic_nonlinear) { @@ -129,8 +123,8 @@ TEST(mech_kinetic, kinetic_nonlinear) { std::vector<fvm_value_type> t1_0_values = {0.222881, 0.31144, 0.48856}; std::vector<fvm_value_type> t1_1_values = {0.2078873133, 0.34222075, 0.45777925}; - run_test<multicore::backend>("test2_kin_diff", state_variables, {}, t0_values, t1_0_values, 0.025); - run_test<multicore::backend>("test3_kin_diff", state_variables, {}, t0_values, t1_1_values, 0.025); + run_test<multicore::backend>("test2_kin_diff", state_variables, t0_values, t1_0_values, 0.025); + run_test<multicore::backend>("test3_kin_diff", state_variables, t0_values, t1_1_values, 0.025); } @@ -143,17 +137,16 @@ TEST(mech_kinetic, kinetic_nonlinear_scaled) { 1.8315624742412617, 0.16843752575873824}; - run_test<multicore::backend>("test4_kin_compartment", state_variables, {}, t0_values, t1_values, 0.1); + run_test<multicore::backend>("test4_kin_compartment", state_variables, t0_values, t1_values, 0.1); } TEST(mech_linear, linear_system) { std::vector<std::string> state_variables = {"h", "s", "d"}; std::vector<fvm_value_type> values = {0.5, 0.2, 0.3}; - std::unordered_map<std::string, fvm_value_type> assigned_variables = {{"a0", 2.5}, {"a1",0.5}, {"a2",3}, {"a3",2.3}}; - run_test<multicore::backend>("test_linear_state", state_variables, assigned_variables, {}, values, 0.5); - run_test<multicore::backend>("test_linear_init", state_variables, assigned_variables, values, {}, 0.5); - run_test<multicore::backend>("test_linear_init_shuffle", state_variables, assigned_variables, values, {}, 0.5); + run_test<multicore::backend>("test_linear_state", state_variables, {}, values, 0.5); + run_test<multicore::backend>("test_linear_init", state_variables, values, {}, 0.5); + run_test<multicore::backend>("test_linear_init_shuffle", state_variables, values, {}, 0.5); } #ifdef ARB_GPU_ENABLED @@ -163,8 +156,8 @@ TEST(mech_kinetic_gpu, kinetic_linear_scaled) { std::vector<fvm_value_type> t1_0_values = {0.373297, 0.591621, 0.0350817}; std::vector<fvm_value_type> t1_1_values = {0.329897, 0.537371, 0.132732}; - run_test<gpu::backend>("test0_kin_compartment", state_variables, {}, t0_values, t1_0_values, 0.5); - run_test<gpu::backend>("test1_kin_compartment", state_variables, {}, t0_values, t1_1_values, 0.5); + run_test<gpu::backend>("test0_kin_compartment", state_variables, t0_values, t1_0_values, 0.5); + run_test<gpu::backend>("test1_kin_compartment", state_variables, t0_values, t1_1_values, 0.5); } TEST(mech_kinetic_gpu, kinetic_linear_1_conserve) { @@ -173,9 +166,9 @@ TEST(mech_kinetic_gpu, kinetic_linear_1_conserve) { std::vector<fvm_value_type> t1_0_values = {0.380338, 0.446414, 0.173247}; std::vector<fvm_value_type> t1_1_values = {0.218978, 0.729927, 0.0510949}; - run_test<gpu::backend>("test0_kin_diff", state_variables, {}, t0_values, t1_0_values, 0.5); - run_test<gpu::backend>("test0_kin_conserve", state_variables, {}, t0_values, t1_0_values, 0.5); - run_test<gpu::backend>("test0_kin_steadystate", state_variables, {}, t0_values, t1_1_values, 0.5); + run_test<gpu::backend>("test0_kin_diff", state_variables, t0_values, t1_0_values, 0.5); + run_test<gpu::backend>("test0_kin_conserve", state_variables, t0_values, t1_0_values, 0.5); + run_test<gpu::backend>("test0_kin_steadystate", state_variables, t0_values, t1_1_values, 0.5); } TEST(mech_kinetic_gpu, kinetic_linear_2_conserve) { @@ -184,9 +177,9 @@ TEST(mech_kinetic_gpu, kinetic_linear_2_conserve) { std::vector<fvm_value_type> t1_0_values = {0.217391304, 0.782608696, 0.33333333, 0.66666666}; std::vector<fvm_value_type> t1_1_values = {0.230769, 0.769231, 0.189189, 0.810811}; - run_test<gpu::backend>("test1_kin_diff", state_variables, {}, t0_values, t1_0_values, 0.5); - run_test<gpu::backend>("test1_kin_conserve", state_variables, {}, t0_values, t1_0_values, 0.5); - run_test<gpu::backend>("test1_kin_steadystate", state_variables, {}, t0_values, t1_1_values, 0.5); + run_test<gpu::backend>("test1_kin_diff", state_variables, t0_values, t1_0_values, 0.5); + run_test<gpu::backend>("test1_kin_conserve", state_variables, t0_values, t1_0_values, 0.5); + run_test<gpu::backend>("test1_kin_steadystate", state_variables, t0_values, t1_1_values, 0.5); } TEST(mech_kinetic_gpu, kinetic_nonlinear) { @@ -195,8 +188,8 @@ TEST(mech_kinetic_gpu, kinetic_nonlinear) { std::vector<fvm_value_type> t1_0_values = {0.222881, 0.31144, 0.48856}; std::vector<fvm_value_type> t1_1_values = {0.2078873133, 0.34222075, 0.45777925}; - run_test<gpu::backend>("test2_kin_diff", state_variables, {}, t0_values, t1_0_values, 0.025); - run_test<gpu::backend>("test3_kin_diff", state_variables, {}, t0_values, t1_1_values, 0.025); + run_test<gpu::backend>("test2_kin_diff", state_variables, t0_values, t1_0_values, 0.025); + run_test<gpu::backend>("test3_kin_diff", state_variables, t0_values, t1_1_values, 0.025); } TEST(mech_kinetic_gpu, kinetic_nonlinear_scaled) { @@ -208,17 +201,16 @@ TEST(mech_kinetic_gpu, kinetic_nonlinear_scaled) { 1.8315624742412617, 0.16843752575873824}; - run_test<gpu::backend>("test4_kin_compartment", state_variables, {}, t0_values, t1_values, 0.1); + run_test<gpu::backend>("test4_kin_compartment", state_variables, t0_values, t1_values, 0.1); } TEST(mech_linear_gpu, linear_system) { std::vector<std::string> state_variables = {"h", "s", "d"}; std::vector<fvm_value_type> values = {0.5, 0.2, 0.3}; - std::unordered_map<std::string, fvm_value_type> assigned_variables = {{"a0", 2.5},{"a1",0.5},{"a2",3},{"a3",2.3}}; - run_test<gpu::backend>("test_linear_state", state_variables, assigned_variables, {}, values, 0.5); - run_test<gpu::backend>("test_linear_init", state_variables, assigned_variables, values, {}, 0.5); - run_test<gpu::backend>("test_linear_init_shuffle", state_variables, assigned_variables, values, {}, 0.5); + run_test<gpu::backend>("test_linear_state", state_variables, {}, values, 0.5); + run_test<gpu::backend>("test_linear_init", state_variables, {}, values, 0.5); + run_test<gpu::backend>("test_linear_init_shuffle", state_variables, values, {}, 0.5); } #endif