Skip to content

Commit bfc1312

Browse files
authored
Update sundials to v7.3.0 (#39)
* Switch version * Fix include path * Update build scripts * Get rid of excess script * Minor patch * Revert change * Apply suggestions from code review * Update .github/workflows/build_wheels.yml * Put script changes back * Re-trigger ci * Update sundials * Type fixes * Revert some type changes
1 parent cba9804 commit bfc1312

23 files changed

+320
-320
lines changed

install_KLU_Sundials.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ def build_solvers():
1919
SUITESPARSE_CHECKSUM = (
2020
"ce39b28d4038a09c14f21e02c664401be73c0cb96a9198418d6a98a7db73a259"
2121
)
22-
SUNDIALS_VERSION = "6.5.0"
22+
SUNDIALS_VERSION = "7.3.0"
2323
SUNDIALS_URL = f"https://github.com/LLNL/sundials/releases/download/v{SUNDIALS_VERSION}/sundials-{SUNDIALS_VERSION}.tar.gz"
2424
SUNDIALS_CHECKSUM = (
25-
"4e0b998dff292a2617e179609b539b511eb80836f5faacf800e688a886288502"
25+
"697b7b0dbc229f149e39b293d1ab03d321d61adb6733ffb78c0ddbffaf73d839"
2626
)
2727
DEFAULT_INSTALL_DIR = str(pathlib.Path(__file__).parent.resolve() / ".idaklu")
2828

install_sundials.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ function extract {
2828
}
2929

3030
SUITESPARSE_VERSION=7.8.3
31-
SUNDIALS_VERSION=6.5.0
31+
SUNDIALS_VERSION=7.3.0
3232

3333
SUITESPARSE_ROOT_ADDR=https://github.com/DrTimothyAldenDavis/SuiteSparse/archive
3434
SUNDIALS_ROOT_ADDR=https://github.com/LLNL/sundials/releases/download/v$SUNDIALS_VERSION

src/pybammsolvers/idaklu_source/Expressions/Base/Expression.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ class Expression {
2121
* @brief Evaluation operator (supplying data references)
2222
*/
2323
virtual void operator()(
24-
const std::vector<realtype*>& inputs,
25-
const std::vector<realtype*>& results) = 0;
24+
const std::vector<sunrealtype*>& inputs,
25+
const std::vector<sunrealtype*>& results) = 0;
2626

2727
/**
2828
* @brief The maximum number of elements returned by the k'th output

src/pybammsolvers/idaklu_source/Expressions/Base/ExpressionSet.hpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -69,16 +69,16 @@ class ExpressionSet
6969

7070
std::vector<int64_t> jac_times_cjmass_rowvals; // cppcheck-suppress unusedStructMember
7171
std::vector<int64_t> jac_times_cjmass_colptrs; // cppcheck-suppress unusedStructMember
72-
std::vector<realtype> inputs; // cppcheck-suppress unusedStructMember
72+
std::vector<sunrealtype> inputs; // cppcheck-suppress unusedStructMember
7373

7474
SetupOptions setup_opts;
7575

76-
virtual realtype *get_tmp_state_vector() = 0;
77-
virtual realtype *get_tmp_sparse_jacobian_data() = 0;
76+
virtual sunrealtype *get_tmp_state_vector() = 0;
77+
virtual sunrealtype *get_tmp_sparse_jacobian_data() = 0;
7878

7979
protected:
80-
std::vector<realtype> tmp_state_vector;
81-
std::vector<realtype> tmp_sparse_jacobian_data;
80+
std::vector<sunrealtype> tmp_state_vector;
81+
std::vector<sunrealtype> tmp_sparse_jacobian_data;
8282
};
8383

8484
#endif // PYBAMM_IDAKLU_EXPRESSION_SET_HPP

src/pybammsolvers/idaklu_source/Expressions/Casadi/CasadiFunctions.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,8 @@ const std::vector<expr_int>& CasadiFunction::get_col() {
6161
return m_cols;
6262
}
6363

64-
void CasadiFunction::operator()(const std::vector<realtype*>& inputs,
65-
const std::vector<realtype*>& results)
64+
void CasadiFunction::operator()(const std::vector<sunrealtype*>& inputs,
65+
const std::vector<sunrealtype*>& results)
6666
{
6767
DEBUG("CasadiFunction operator() with inputs and results: " << m_func.name());
6868

src/pybammsolvers/idaklu_source/Expressions/Casadi/CasadiFunctions.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ class CasadiFunction : public Expression
2222

2323
// Method overrides
2424
void operator()() override;
25-
void operator()(const std::vector<realtype*>& inputs,
26-
const std::vector<realtype*>& results) override;
25+
void operator()(const std::vector<sunrealtype*>& inputs,
26+
const std::vector<sunrealtype*>& results) override;
2727
expr_int out_shape(int k) override;
2828
expr_int nnz() override;
2929
expr_int nnz_out() override;
@@ -144,10 +144,10 @@ class CasadiFunctions : public ExpressionSet<CasadiFunction>
144144
std::vector<CasadiFunction> dvar_dy_fcns_casadi;
145145
std::vector<CasadiFunction> dvar_dp_fcns_casadi;
146146

147-
realtype* get_tmp_state_vector() override {
147+
sunrealtype* get_tmp_state_vector() override {
148148
return tmp_state_vector.data();
149149
}
150-
realtype* get_tmp_sparse_jacobian_data() override {
150+
sunrealtype* get_tmp_sparse_jacobian_data() override {
151151
return tmp_sparse_jacobian_data.data();
152152
}
153153
};

src/pybammsolvers/idaklu_source/Expressions/IREE/IREEFunction.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ class IREEFunction : public Expression
2222

2323
// Method overrides
2424
void operator()() override;
25-
void operator()(const std::vector<realtype*>& inputs,
26-
const std::vector<realtype*>& results) override;
25+
void operator()(const std::vector<sunrealtype*>& inputs,
26+
const std::vector<sunrealtype*>& results) override;
2727
expr_int out_shape(int k) override;
2828
expr_int nnz() override;
2929
expr_int nnz_out() override;

src/pybammsolvers/idaklu_source/Expressions/IREE/IREEFunctions.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ void IREEFunction::evaluate(int n_outputs) {
177177
// Copy results to output array
178178
for(size_t k=0; k<n_outputs; k++) {
179179
for(size_t j=0; j<result[k].size(); j++) {
180-
m_res[k][j] = static_cast<realtype>(result[k][j]);
180+
m_res[k][j] = static_cast<sunrealtype>(result[k][j]);
181181
}
182182
}
183183

@@ -213,8 +213,8 @@ const std::vector<expr_int>& IREEFunction::get_col() {
213213
return m_func.col;
214214
}
215215

216-
void IREEFunction::operator()(const std::vector<realtype*>& inputs,
217-
const std::vector<realtype*>& results)
216+
void IREEFunction::operator()(const std::vector<sunrealtype*>& inputs,
217+
const std::vector<sunrealtype*>& results)
218218
{
219219
DEBUG("IreeFunction operator() with inputs and results");
220220
// Set-up input arguments, provide result vector, then execute function

src/pybammsolvers/idaklu_source/Expressions/IREE/IREEFunctions.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,10 +130,10 @@ class IREEFunctions : public ExpressionSet<IREEFunction>
130130
std::vector<IREEFunction> dvar_dy_fcns_iree;
131131
std::vector<IREEFunction> dvar_dp_fcns_iree;
132132

133-
realtype* get_tmp_state_vector() override {
133+
sunrealtype* get_tmp_state_vector() override {
134134
return tmp_state_vector.data();
135135
}
136-
realtype* get_tmp_sparse_jacobian_data() override {
136+
sunrealtype* get_tmp_sparse_jacobian_data() override {
137137
return tmp_sparse_jacobian_data.data();
138138
}
139139

src/pybammsolvers/idaklu_source/IDAKLUSolver.hpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,11 @@ class IDAKLUSolver
2828
* @brief Abstract solver method that executes the solver
2929
*/
3030
virtual SolutionData solve(
31-
const std::vector<realtype> &t_eval,
32-
const std::vector<realtype> &t_interp,
33-
const realtype *y0,
34-
const realtype *yp0,
35-
const realtype *inputs,
31+
const std::vector<sunrealtype> &t_eval,
32+
const std::vector<sunrealtype> &t_interp,
33+
const sunrealtype *y0,
34+
const sunrealtype *yp0,
35+
const sunrealtype *inputs,
3636
bool save_adaptive_steps,
3737
bool save_interp_steps
3838
) = 0;

0 commit comments

Comments
 (0)