BlueBrain / nmodl

Code Generation Framework For NEURON MODeling Language
https://bluebrain.github.io/nmodl/
Apache License 2.0
48 stars 15 forks source link

Throw on fatal error. #1257

Closed 1uc closed 1 month ago

1uc commented 1 month ago

If nmodl sends invalid code to SymPy, SymPy we throw an exception. NMODL ignores the issue, prints a warning; and them much later fails. Typical output might be:

[NMODL] [warning] :: SympySolverVisitor :: solve_non_lin_system python exception: Sympify of expression 'could not parse 'is'' failed, because of exception being raised:
SyntaxError: invalid syntax (<string>, line 1)
[NMODL] [warning] :: SympySolverVisitor :: solve_non_lin_system python exception: Sympify of expression 'could not parse 'is'' failed, because of exception being raised:
SyntaxError: invalid syntax (<string>, line 1)
[NMODL] [error] :: NeuronSolveVisitor :: solver method 'sparse' not supported
[NMODL] [error] :: NeuronSolveVisitor :: solver method 'sparse' not supported
[NMODL] [error] :: NeuronSolveVisitor :: solver method 'sparse' not supported
[NMODL] [error] :: NeuronSolveVisitor :: solver method 'sparse' not supported
[NMODL] [error] :: NeuronSolveVisitor :: solver method 'sparse' not supported
[NMODL] [error] :: NeuronSolveVisitor :: solver method 'sparse' not supported
[NMODL] [error] :: NeuronSolveVisitor :: solver method 'sparse' not supported
[NMODL] [error] :: NeuronSolveVisitor :: solver method 'sparse' not supported
[NMODL] [error] :: NeuronSolveVisitor :: solver method 'sparse' not supported
[NMODL] [error] :: NeuronSolveVisitor :: solver method 'sparse' not supported
[NMODL] [error] :: NeuronSolveVisitor :: solver method 'sparse' not supported
[NMODL] [error] :: NeuronSolveVisitor :: solver method 'sparse' not supported
[NMODL] [error] :: NeuronSolveVisitor :: solver method 'sparse' not supported
[NMODL] [error] :: NeuronSolveVisitor :: solver method 'sparse' not supported
[NMODL] [error] :: NeuronSolveVisitor :: solver method 'sparse' not supported
[NMODL] [error] :: NeuronSolveVisitor :: solver method 'sparse' not supported
[NMODL] [error] :: NeuronSolveVisitor :: solver method 'sparse' not supported
[NMODL] [error] :: NeuronSolveVisitor :: solver method 'sparse' not supported
[NMODL] [error] :: NeuronSolveVisitor :: solver method 'sparse' not supported
[NMODL] [error] :: NeuronSolveVisitor :: solver method 'sparse' not supported
[NMODL] [error] :: NeuronSolveVisitor :: solver method 'sparse' not supported
[NMODL] [error] :: NeuronSolveVisitor :: solver method 'sparse' not supported
terminate called after throwing an instance of 'std::runtime_error'
  what():  PRIME encountered during code generation, ODEs not solved?
Aborted

The first two lines are important, the next 20+ lines are spam; and the final error message is outright misleading.

Therefore, this PR proposes to simply throw if SymPy fails.

bbpbuildbot commented 1 month ago

Logfiles from GitLab pipeline #210641 (:no_entry:) have been uploaded here!

Status and direct links: