Skip to content

Conversation

@jtcooper10
Copy link
Collaborator

@jtcooper10 jtcooper10 commented Feb 25, 2022

Updates C++ solvers to return an enumerated status on error (rather than always returning 0), which then is mapped to an exception Python-side and handled. Raised as a SimulationError, which can then be caught.

In addition, the code contained in the test/profiling directory was updated for use in C++ profiling. While the profiler is not fully feature-complete (that may be addressed in another PR), it was made functional enough to use in comparing error handling implementations in the SSACSolver.

Also fixes failing tests that were silently ignored due to exceptions not being raised properly.

Changes

  • Modified C++ solvers to return a status value, set during solver run
  • Added Logger class to C++ solvers
  • Updated TauHybridCSolver to bubble up exception on "loop over integrate"
  • Updated profiler code in test/profiling

Fixes

  • Fixed bug in arg parser where 0-argument flags (such as --verbose) caused seg fault
  • Fixed bug in Hybrid C++ solver where an invalid state was encountered when species are flagged discrete

jtcooper10 and others added 11 commits February 11, 2022 20:42
- Added overridable `_handle_return_code` method
- Handled loop over integrate return code in hybrid solver
- Added `Logger` with virtual methods, allows overriding (e.g. out to file)
- Initial stderr logger added
- Fixed argparser: `std::stringstream` is only tokenized if flag requires an argument
- Fixed hybrid solver: integrator state was not updated after state flagging
This is so that profilers/debuggers/etc. can use the same Makefile.

- Ability to include definitions with `build_simulation()`
- Updates to profiler code
Use `test/profiling/profiler.py` to run basic performance profiling.

- Removed relative imports in profiler files
- Added CLI args to script
@jtcooper10 jtcooper10 changed the title Improved Error Handling Improved Error Handling, Performance Profiler Mar 19, 2022
@jtcooper10 jtcooper10 marked this pull request as ready for review March 19, 2022 22:02
@briandrawert briandrawert added this to the 1.6.9 milestone Mar 21, 2022
@briandrawert briandrawert added the enhancement New feature or request label Mar 21, 2022
@BryanRumsey BryanRumsey merged commit 585ccdf into develop Apr 11, 2022
@BryanRumsey BryanRumsey deleted the cpp-improved-error-handling branch April 11, 2022 18:55
@BryanRumsey BryanRumsey mentioned this pull request Apr 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants