diff --git a/.github/workflows/check-swig.yml b/.github/workflows/check-swig.yml index 2f9fad653d..ba7b97aaf4 100644 --- a/.github/workflows/check-swig.yml +++ b/.github/workflows/check-swig.yml @@ -15,6 +15,10 @@ jobs: if: ${{ github.event_name != 'issue_comment' || (github.event_name == 'issue_comment' && startsWith(github.event.comment.body, '/autofix')) }} runs-on: ubuntu-latest steps: + - name: Install pcre + run: | + sudo apt install libpcre3-dev + - name: Install swig run: | git clone https://github.com/sundials-codes/swig diff --git a/.github/workflows/ubuntu-clang-latest.yml b/.github/workflows/ubuntu-clang-latest.yml index 160ceec7c6..8171847cc2 100644 --- a/.github/workflows/ubuntu-clang-latest.yml +++ b/.github/workflows/ubuntu-clang-latest.yml @@ -26,11 +26,6 @@ jobs: logging_level: [0, 1, 2, 3, 4, 5] steps: - - name: Install LLVM and Clang - uses: KyleMayes/install-llvm-action@v2 - with: - version: "14.0" - - uses: actions/checkout@v4 - name: Configure CMake @@ -70,11 +65,6 @@ jobs: profiling: ['OFF', 'ON'] steps: - - name: Install LLVM and Clang - uses: KyleMayes/install-llvm-action@v2 - with: - version: "14.0" - - uses: actions/checkout@v4 - name: Configure CMake diff --git a/CHANGELOG.md b/CHANGELOG.md index 100ebb54da..ce33fda21b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,13 +8,17 @@ ### Bug Fixes +Fixed bug in the ARKODE SPRKStep `SPRKStepReInit` function and `ARKodeReset` function +with SPRKStep that could cause a segmentation fault when compensated summation is not +used. + ### Deprecation Notices ## Changes to SUNDIALS in release 7.2.1 ### New Features and Enhancements -Unit tests were separated from examples. To that end, the following directories +Unit tests were separated from examples. To that end, the following directories were moved out of the `examples/` directory to the `test/unit_tests` directory: `nvector`, `sunmatrix`, `sunlinsol`, and `sunnonlinsol`. diff --git a/doc/arkode/guide/source/Mathematics.rst b/doc/arkode/guide/source/Mathematics.rst index c6e6f95eff..2e62c18ba7 100644 --- a/doc/arkode/guide/source/Mathematics.rst +++ b/doc/arkode/guide/source/Mathematics.rst @@ -978,7 +978,7 @@ arise from the **separable** Hamiltonian system where .. math:: - f_1(t, q) \equiv \frac{\partial V(t, q)}{\partial q}, \qquad + f_1(t, q) \equiv -\frac{\partial V(t, q)}{\partial q}, \qquad f_2(t, p) \equiv \frac{\partial T(t, p)}{\partial p}. When *H* is autonomous, then *H* is a conserved quantity. Often this corresponds diff --git a/doc/arkode/guide/source/Usage/SPRKStep/User_callable.rst b/doc/arkode/guide/source/Usage/SPRKStep/User_callable.rst index 948da93a99..13db1851e1 100644 --- a/doc/arkode/guide/source/Usage/SPRKStep/User_callable.rst +++ b/doc/arkode/guide/source/Usage/SPRKStep/User_callable.rst @@ -48,7 +48,7 @@ SPRKStep initialization and deallocation functions This function allocates and initializes memory for a problem to be solved using the SPRKStep time-stepping module in ARKODE. - :param f1: the name of the C function (of type :c:func:`ARKRhsFn()`) defining :math:`f_1(t,q) = \frac{\partial V(t,q)}{\partial q}` + :param f1: the name of the C function (of type :c:func:`ARKRhsFn()`) defining :math:`f_1(t,q) = -\frac{\partial V(t,q)}{\partial q}` :param f2: the name of the C function (of type :c:func:`ARKRhsFn()`) defining :math:`f_2(t,p) = \frac{\partial T(t,p)}{\partial p}` :param t0: the initial value of :math:`t` :param y0: the initial condition vector :math:`y(t_0)` diff --git a/doc/shared/RecentChanges.rst b/doc/shared/RecentChanges.rst index 4f1514700e..50278b737b 100644 --- a/doc/shared/RecentChanges.rst +++ b/doc/shared/RecentChanges.rst @@ -4,4 +4,8 @@ **Bug Fixes** +Fixed bug in the ARKODE SPRKStep :c:func:`SPRKStepReInit` function and +:c:func:`ARKodeReset` function with SPRKStep that could cause a segmentation +fault when compensated summation is not used. + **Deprecation Notices** diff --git a/src/arkode/arkode_sprkstep.c b/src/arkode/arkode_sprkstep.c index 6ebc9fa8dc..63c5bf1590 100644 --- a/src/arkode/arkode_sprkstep.c +++ b/src/arkode/arkode_sprkstep.c @@ -232,7 +232,7 @@ int SPRKStepReInit(void* arkode_mem, ARKRhsFn f1, ARKRhsFn f2, sunrealtype t0, step_mem->istage = 0; /* Zero yerr for compensated summation */ - N_VConst(ZERO, step_mem->yerr); + if (ark_mem->use_compensated_sums) { N_VConst(ZERO, step_mem->yerr); } return (ARK_SUCCESS); } @@ -309,7 +309,10 @@ int sprkStep_Reset(ARKodeMem ark_mem, SUNDIALS_MAYBE_UNUSED sunrealtype tR, retval = sprkStep_AccessStepMem(ark_mem, __func__, &step_mem); if (retval != ARK_SUCCESS) { return (retval); } - N_VConst(SUN_RCONST(0.0), step_mem->yerr); + if (ark_mem->use_compensated_sums) + { + N_VConst(SUN_RCONST(0.0), step_mem->yerr); + } return (ARK_SUCCESS); } diff --git a/test/unit_tests/arkode/C_serial/ark_test_forcingstep.c b/test/unit_tests/arkode/C_serial/ark_test_forcingstep.c index 160d6b4f8c..f19be56f51 100644 --- a/test/unit_tests/arkode/C_serial/ark_test_forcingstep.c +++ b/test/unit_tests/arkode/C_serial/ark_test_forcingstep.c @@ -41,9 +41,9 @@ static int f_forward_2(sunrealtype t, N_Vector y, N_Vector ydot, void* user_data } /* Integrates the ODE - * + * * y' = [t / y] + [1 / y] - * + * * with initial condition y(0) = 1 and partitioning specified by the square * brackets. We integrate to t = 1 and check the error against the exact * solution y(t) = |t + 1|. @@ -121,10 +121,10 @@ static int f_mixed_direction_2(sunrealtype t, N_Vector z, N_Vector zdot, } /* Integrates the ODE - * + * * y_1' = y_2 - t * y_2' = t - y_1 - * + * * with initial condition y(0) = [1, 1]^T backward in time to t = -1, then * forward to t = 0.4, and backward to t = 0. We apply a splitting method using * a component partitioning and check that the numerical solution is close to @@ -198,9 +198,9 @@ static int test_mixed_directions(SUNContext ctx) } /* Integrates the ODE - * + * * y' = [t / y] + [1 / y] - * + * * with initial condition y(0) = 1 and partitioning specified by the square * brackets. We integrate to t = 1 then reinitialize the forcing method by * swapping the SUNSteppers and updating the initial condition to y(1) = -1. @@ -269,7 +269,7 @@ static int test_reinit(SUNContext ctx) return fail; } -int main() +int main(void) { SUNContext ctx = NULL; SUNErrCode err = SUNContext_Create(SUN_COMM_NULL, &ctx);