Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Assertion error in ForwardProblem::getSimulationStateTimepoint #2491

Closed
dweindl opened this issue Sep 17, 2024 · 1 comment
Closed

Assertion error in ForwardProblem::getSimulationStateTimepoint #2491

dweindl opened this issue Sep 17, 2024 · 1 comment

Comments

@dweindl
Copy link
Member

dweindl commented Sep 17, 2024

I got the following assertion error in ForwardProblem::getSimulationStateTimepoint when simulating Weber_BMC2015 with AMICI 0.26.1:

AMICI/include/amici/forwardproblem.h:200: const amici::SimulationState& amici::ForwardProblem::getSimulationStateTimepoint(int) const: Assertion `map_iter != timepoint_states_.end()' failed.

Needs further investigation.

Seems to be non-deterministic, but happens repeatedly.

Might be some memory corruption issue, potentially caused outside amici.

dweindl added a commit to ICB-DCM/parPE that referenced this issue Oct 19, 2024
* Update amici to [8253a97d413cbbcfec335fb50fd1355107804e9e](AMICI-dev/AMICI@8253a97)
* GHA: disable ceres due to #391 
* Address amici deprecations

Mysterious amici errors on GHA, specifically for Weber_BMC2015, not locally reproducible, remain AMICI-dev/AMICI#2491. They already occurred (at least) with amici v0.26.1.

---

git subrepo clone --branch=8253a97d413cbbcfec335fb50fd1355107804e9e --force [email protected]:dweindl/AMICI.git deps/AMICI

subrepo:
  subdir:   "deps/AMICI"
  merged:   "8253a97d"
upstream:
  origin:   "[email protected]:dweindl/AMICI.git"
  branch:   "8253a97d413cbbcfec335fb50fd1355107804e9e"
  commit:   "8253a97d"
git-subrepo:
  version:  "0.4.6"
  origin:   "https://github.com/ingydotnet/git-subrepo"
  commit:   "110b9eb"
@dweindl
Copy link
Member Author

dweindl commented Oct 19, 2024

This happens if the solver fails right at an output timepoint (here: root-after-reinitialization error). In this case, the model state from that timepoint does not get stored in timepoint_states_ (because handleDataPoint doesn't get called anymore), and the reported problem occurs. In non-debug builds, this usually segfaults when the returned invalid SimulationState is used).

int status = solver->run(next_t_stop);
/* sx will be copied from solver on demand if sensitivities
are computed */
solver->writeSolution(&t_, x_, dx_, sx_, dx_);
if (status == AMICI_ILL_INPUT) {
/* clustering of roots => turn off root-finding */
solver->turnOffRootFinding();
} else if (status == AMICI_ROOT_RETURN || t_ == next_t_event) {
// solver-tracked or time-triggered event
solver->getRootInfo(roots_found_.data());
// check if we are at a trigger timepoint.
// if so, set the root-found flag
if (t_ == next_t_event) {
for (auto ie : model->state_independent_events_[t_]) {
// determine direction of root crossing from
// root function value at the previous event
roots_found_[ie] = std::copysign(1, -rootvals_[ie]);
}
++it_trigger_timepoints;
}
handleEvent(&tlastroot_, false, false);
}
}
}
handleDataPoint(next_t_out);

dweindl added a commit to dweindl/AMICI that referenced this issue Oct 19, 2024
Fixes a bug that lead to program termination if a root-after-reinitialization error (potentially also others)
occurred at an output timepoint, because an non-existing/invalid SimulationState for that timepoint was accessed.
See AMICI-dev#2491 for further details.

Fixes AMICI-dev#2491.
dweindl added a commit to ICB-DCM/parPE that referenced this issue Oct 20, 2024
This should fix the random test failures (AMICI-dev/AMICI#2491).

```
git subrepo clone --branch=9f562667ba74d1dfdd86514f89155644daeec4ba --force [email protected]:dweindl/AMICI.git deps/AMICI

subrepo:
  subdir:   "deps/AMICI"
  merged:   "9f562667"
upstream:
  origin:   "[email protected]:dweindl/AMICI.git"
  branch:   "9f562667ba74d1dfdd86514f89155644daeec4ba"
  commit:   "9f562667"
git-subrepo:
  version:  "0.4.8"
  origin:   "https://github.com/ingydotnet/git-subrepo"
  commit:   "3a53c20"
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant