Skip to content

CyRK v0.10.0

Compare
Choose a tag to compare
@jrenaud90 jrenaud90 released this 17 Jul 18:44
· 168 commits to main since this release
8a1a398

Changes

C++ Backend:

  • This version of CyRK introduces a major rework of the backend integrator which is now written in pure C++.
  • CySolver is now a Cython wrapper to this C++ integrator which can be accessed via Python.
    • Access this function by using from CyRK cimport cysolve_ivp (this must be done within Cython).
    • The plan is to replace CyRK's older CySolver with this function.
  • There is now a new PySolver version of this wrapper that allows a user to pass a python function to the C++ backend.
    • Access this function by using from CyRK import pysolve_ivp.
    • This is designed as a drop-in-place replacement for SciPy's solve_ivp.
    • The plan is to replace CyRK's older cyrk_ode with this function.

Implemented Dense Output and Improved t_eval for new C++ backend:

  • Both pysolve_ivp and cysolve_ivp now utilize a much more accurate interpolator when t_eval is provided.
  • Users can now also request the interpolators be saved with the data, enabling Dense Output functional calls.
  • This closes GitHub Issue #45.
    • Note that these improvement were not ported to the numba-based nbsolve_ivp, or the cython-based cyrk_ode & CySolver methods. See below to learn about these methods' deprecation.
  • Added tests, documentation, and demos describing these features.

Deprecating Older CyRK Methods:

  • The new C++ backend is more flexible, faster, and allows for easy additions of new features. It is common across the cython-only, python, and njit-safe numba solvers. Therefore making a change to it propagates to all three solvers - allowing for easier maintenance and new features. For these reasons, the older cyrk_ode, CySolver, and nbrk_ode are now marked as deprecated. No new features will be implemented for those functions and they will be removed in the next major release of CyRK.
  • Deprecated cyrk_ode
  • Deprecated CySolver
  • Warnings will be issued if these functions are used in this release. To suppress these warnings set raise_warnings to False in the respective function calls.

CySolver:

  • Changed error message to use a stack-allocated char-array and associated pointer.
  • Added new argument to constructor raise_warnings (default: True) to allow users to suppress warnings.

cyrk_ode:

  • Added new argument to constructor raise_warnings (default: True) to allow users to suppress warnings.

WrapCySolverResult:

  • cysolve_ivp and pysolve_ivp now return a class structure that stores the result of the integration along with some meta data. The accessible attributes are:
    • cysolve_ivps CySolverResult:
      • success (bool): Flag if the integration was successful.
      • message (str): Message to give a hint on what happened during integration.
      • error_code (int): Additional error/status code that hints on what happened during integration.
      • size (int): Length of time domain.
      • y (float[:, :]): 2D Float Array of y solutions (and any extra output).
      • t (float[:]): 1D Float Array of time domain at which y is defined.

numba based nbsolve_ivp:

  • The older nbrk_ode has been refactored to nbsolve_ivp to match the signature of the new cython-based functions (and scipy's solve_ivp).
  • The output of nbsolve_ivp is now a named tuple that functions similar to the WrapCySolverResult

Memory Management:

  • Changed exit code when memory can not be allocated.
  • Changed some heap allocated arrays in CySolver to be stack allocated
    • This change limits the total number of y-dependent variables and extra output that is tracked to 50. This size is
      easy to change. If your use case requires a larger size then open an issue and an alternative can be discussed.
  • Converted the underlying storage arrays for CySolver to LinkedLists arrays.

Bug Fixes:

  • Fixed issue where the Cython-based solvers might use the incorrect memory freeing function.

Other Changes:

  • Moved from GCC to Clang on MacOS builds. There was a new problem that appeared with GCC's linker and could not find a working solution. The original move away from clang was done to support openMP multiprocessing. CyRK does not currently use that so the switch back should be okay.

Known Issues:

  • There is an occasional bug with backwards integration on pysolve_ivp and cysolve_ivp. See Github Issue #56.

GitHub Tracked Changes

Full Changelog: v0.9.0...v0.10.0