BOUT-dev
BOUT-dev copied to clipboard
Fix SUNDIALS version guard and some deprecated function calls
Fixes an issue with one version guard (caught versions < x.2 instead of < 3.2)
Also fixes some deprecated function calls. Turns out SUNDIALS v4 introduced a bunch of functions we should've been calling, although they were only recently actually deprecated.
There is one remaining call to a deprecated function (deprecated in 5.7):
src/solver/impls/arkode/arkode.cxx:351:33: warning: ‘int ARKStepSetAdaptivityMethod(void*, int, int, int, realtype*)’ is deprecated: use SUNAdaptController instead [-Wdeprecated-declarations]
351 | if (ARKStepSetAdaptivityMethod(arkode_mem, adap_method, 1, 1, nullptr) != ARK_SUCCESS) {
| ~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Unfortunately the fix is not exactly straightforward, and it's not really from the docs how to upgrade.
clang-tidy review says "All clean, LGTM! :+1:"
Good catch with the version guard. Yes, I'm working on a branch which will drop SUNDIALS <v4 support, add v7 support, and fix all the deprecated warnings including ARKStepSetAdaptivityMethod. I think that would supersede this, but here's the current diff (still a work in progress)
Looking at what versions of SUNDIALS are available across OSes, it seems most have >= 5.0, so we could use that as our minimum version?
There's still a couple of OSes (notably Ubuntu 20 LTS) that only have SUNDIALS 3, but we do have the option to download and build SUNDIALS as part of BOUT++, so this is probably not a massive problem. There's also a couple of OSes that have separate packages for SUNDIALS 2, but I doubt this is worth continuing to support.
If we support SUNDIALS 5.0, I don't think there are any extra shims or special cases we need to handle to also support 4.0. Considering that BOUT++ is currently incompatible with SUNDIALS <4.0 and presumably this has not caused issues with users, it seems natural to me to pick 4.0 as the new minimum version to support. Just let me know @bendudson and @ZedThree what you want to go with.
Thanks @Steven-Roberts ! It sounds like >= 4.0 is a good choice for now. I wouldn't spend a lot of time on supporting older versions though: We can recommend users configure BOUT++ to download and compile a compatible SUNDIALS version.
Fixed by #2896