Skip to content

Commit

Permalink
Merge pull request #73 from jrenaud90/dev-11.3
Browse files Browse the repository at this point in the history
Dev 11.3
  • Loading branch information
jrenaud90 authored Nov 19, 2024
2 parents adc42d4 + 136e22c commit cfaeb91
Show file tree
Hide file tree
Showing 38 changed files with 1,486 additions and 1,150 deletions.
333 changes: 206 additions & 127 deletions Benchmarks/CyRK - SciPy Comparison.ipynb

Large diffs are not rendered by default.

Binary file modified Benchmarks/CyRK_CySolver.pdf
Binary file not shown.
Binary file added Benchmarks/CyRK_CySolver_DenseOn.pdf
Binary file not shown.
Binary file modified Benchmarks/CyRK_PySolver (njit).pdf
Binary file not shown.
Binary file modified Benchmarks/CyRK_PySolver.pdf
Binary file not shown.
Binary file removed Benchmarks/CyRK_SciPy_Compare_predprey_v0-11-2.png
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Benchmarks/CyRK_numba.pdf
Binary file not shown.
Binary file modified Benchmarks/SciPy.pdf
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 21 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,27 @@

## 2024

#### v0.11.3 (2024-11-18)

New:
* Added helper function to allow users to include CyRK headers during installation. `CyRK.get_include()` this returns a list which must be appended to your include list in "setup.py".
* Some minor performance improvements when using dense output or t_eval.
* Added new cysolve_ivp C++ function, `baseline_cysolve_ivp_noreturn`, and cython wrapped version, `cysolve_ivp_noreturn`, that require the storage class as input (then modify it) rather than provide it as output.

C++ Changes:
* Major rework of the C++ Solver backend
* The `CySolverResult` storage structure is now the owner of: the solution data, the dense outputs, _and_ the solver itself (before the solver was stand alone). This ensures that the solver is alive for the dense outputs which, depending on settings, may need to make calls to the solver even after the integration is complete.
* Removed many pointers in favor of direct access of variables. This was due to some variables moving and hanging pointers causing crashes.
* Drastically reduced the size of `CySolverDense` and moved its state data to a heap allocated array. This has led to large performance gains when `dense_output=True` for integrations requiring a large number of steps.
* `num_y` and `num_extra` are now size_t type instead of unsigned ints.
* `integration method` is not int instead of unsigned int.

Fixes:
* Fixed issue where if t_eval was less than t_end it could cause an access violation.
* Fixed issue where dense output was sometimes being created twice when t_eval was provided.
* Addressed several compile warnings.
* Fixed issue where when t_eval is provided and dense output = true, cysolver may call a dense solution that has moved (hanging pointer).

#### v0.11.2 (2024-11-12)

New:
Expand Down
2 changes: 1 addition & 1 deletion CyRK/__init__.pxd
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
from CyRK.cy.cysolver_api cimport cysolve_ivp, cysolve_ivp_gil, DiffeqFuncType, PreEvalFunc, CySolverResult, WrapCySolverResult, CySolverBase, CySolveOutput, RK23_METHOD_INT, RK45_METHOD_INT, DOP853_METHOD_INT
from CyRK.cy.cysolver_api cimport cysolve_ivp, cysolve_ivp_gil, cysolve_ivp_noreturn, DiffeqFuncType, PreEvalFunc, CySolverResult, WrapCySolverResult, CySolverBase, CySolveOutput, RK23_METHOD_INT, RK45_METHOD_INT, DOP853_METHOD_INT
from CyRK.cy.helpers cimport interpolate_from_solution_list
18 changes: 17 additions & 1 deletion CyRK/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,20 @@

# Import python solver
from CyRK.cy.cysolver_api import WrapCySolverResult
from CyRK.cy.pysolver import pysolve_ivp
from CyRK.cy.pysolver import pysolve_ivp

# Helper function that provides directories to CyRK c++ headers
def get_include():
import os
import CyRK
cyrk_dir = os.path.dirname(CyRK.__file__)

cyrk_dirs = list()
cyrk_dirs.append(
os.path.join(cyrk_dir, 'cy') # CySolver headers
)
cyrk_dirs.append(
os.path.join(cyrk_dir, 'array') # Array headers
)

return cyrk_dirs
8 changes: 4 additions & 4 deletions CyRK/cy/common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ void round_to_2(size_t &initial_value)
}

MaxNumStepsOutput find_max_num_steps(
const int num_y,
const int num_extra,
const size_t num_y,
const size_t num_extra,
const size_t max_num_steps,
const size_t max_ram_MB)
{
Expand Down Expand Up @@ -57,8 +57,8 @@ MaxNumStepsOutput find_max_num_steps(


size_t find_expected_size(
const int num_y,
const int num_extra,
const size_t num_y,
const size_t num_extra,
const double t_delta_abs,
const double rtol_min)
/* Finds an expected size for storage arrays (length of time domain) that is suitable to the provided problem */
Expand Down
16 changes: 8 additions & 8 deletions CyRK/cy/common.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
#include <limits>

// Pre-processor constants
static const int Y_LIMIT = 32;
static const int DY_LIMIT = 64; // dy limit is defined by Y_LIMIT and number of extra output allowed. Typically we allow 2x the Y_LIMIT.
static const int MESSAGE_SIZE = 128;
static const int BUFFER_SIZE = 16;
static const size_t Y_LIMIT = 32;
static const size_t DY_LIMIT = 64; // dy limit is defined by Y_LIMIT and number of extra output allowed. Typically we allow 2x the Y_LIMIT.
static const int MESSAGE_SIZE = 128;
static const size_t BUFFER_SIZE = 16;

// Integration Constants
// Multiply steps computed from asymptotic behaviour of errors by this.
Expand Down Expand Up @@ -60,14 +60,14 @@ struct MaxNumStepsOutput
void round_to_2(size_t& initial_value);

MaxNumStepsOutput find_max_num_steps(
const int num_y,
const int num_extra,
const size_t num_y,
const size_t num_extra,
const size_t max_num_steps,
const size_t max_ram_MB);


size_t find_expected_size(
int num_y,
int num_extra,
size_t num_y,
size_t num_extra,
double t_delta_abs,
double rtol_min);
Loading

0 comments on commit cfaeb91

Please sign in to comment.