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

Merging main back in #75

Closed
wants to merge 23 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
27dc92e
Added `get_include` function
jrenaud90 Nov 14, 2024
8808c95
Fixed typo
jrenaud90 Nov 14, 2024
df4b7bf
Major rework of C++ backend
jrenaud90 Nov 17, 2024
bc49e76
Trying c++20 on unix
jrenaud90 Nov 17, 2024
c3f58db
Removed unsupported exceptions
jrenaud90 Nov 17, 2024
0622a20
Added new no-return version of cysolver
jrenaud90 Nov 18, 2024
6033503
typos
jrenaud90 Nov 18, 2024
eb06287
Added in dense output to benchmark plot
jrenaud90 Nov 18, 2024
64f9ac3
Dense output no longer takes in solver's shared pointers
jrenaud90 Nov 18, 2024
43ff11c
Merge pull request #71 from jrenaud90/reworking-shared-ptrs
jrenaud90 Nov 18, 2024
bbe27bf
Changed dense output structure; changed several types
jrenaud90 Nov 18, 2024
a16dd3c
Described no return
jrenaud90 Nov 18, 2024
357f438
Removed exception that was no longer relevant
jrenaud90 Nov 18, 2024
8c8f3e3
Fixed issue where dense solution tried to access a deconstructed solv…
jrenaud90 Nov 18, 2024
e8962c0
Fixed issue where storage container was not being reset before solver…
jrenaud90 Nov 18, 2024
183dcaa
Fixed issue where t_eval may call a dense solution that has moved (ha…
jrenaud90 Nov 18, 2024
be92ae0
Fixed issue where cysolver may not be fully initialized before it is …
jrenaud90 Nov 18, 2024
ef9cefb
Fixed issue where solution was not properly resetting solver
jrenaud90 Nov 18, 2024
cf51e31
Fixed cysolver reset problems
jrenaud90 Nov 19, 2024
eb8b318
Merge pull request #72 from jrenaud90/Switch-to-vectors-for-dense
jrenaud90 Nov 19, 2024
136e22c
updated docs and benchmarks
jrenaud90 Nov 19, 2024
cfaeb91
Merge pull request #73 from jrenaud90/dev-11.3
jrenaud90 Nov 19, 2024
5054f6e
CyRK is now on conda forge!
jrenaud90 Nov 19, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading