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

Update to SUNDIALS v7 #3835

Merged
merged 8 commits into from Mar 27, 2024

Conversation

WeiqunZhang
Copy link
Member

This is the rebirth of #3756. But it's compatible with SUNDIALS 6.

@WeiqunZhang
Copy link
Member Author

@balos1 I am able to compile and run with both sundials 6 and 7 using gnu make. But there are still some issues with cmake. SUNDIALS::core is only available in v7. So I made it an optional component and check if it's found after find_package is called. But I got the following error,

CMake Error at Tools/CMake/AMReXThirdPartyLibraries.cmake:148 (find_package):
  Could not find a configuration file for package "SUNDIALS" that is
  compatible with requested version "6.0.0".

  The following configuration files were considered but not accepted:

    /home/wqzhang/mygitrepo/spack/opt/spack/linux-ubuntu20.04-skylake/gcc-9.4.0/sundials-develop-5wskgac5smdxvywok7yuojfsk6jfzr6a/lib/cmake/sundials/SUNDIALSConfig.cmake, version: 7.0.0

Is version 7.0.0 considered incompatible with 6.0.0 in the sundials' cmake config file? If we want to support both v7 and v6, how should we handle this?

@ax3l

@WeiqunZhang
Copy link
Member Author

Note that if I simply set the minimum version to 7.0.0 with core as optional, it works.

@balos1
Copy link
Contributor

balos1 commented Mar 22, 2024

@WeiqunZhang Unfortunately it looks like we setup the CMake version file for SUNDIALS with the SameMajorVersion compatibility mode. Im going to change it to AnyNewerVersion, but that doesn't fix the problem for 7.0.0. The workaround is to either do find_package twice (once with minimum 6.0.0 and once with minimum 7.0.0, check if NOT SUNDIALS_FOUND after the first one), or check the version manually like this:

find_package(SUNDIALS CONFIG REQUIRED
                      COMPONENTS ${SUNDIALS_COMPONENTS}
                      OPTIONAL_COMPONENTS core)
set(SUNDIALS_MINIMUM_VERSION 6.0.0)
if (SUNDIALS_VERSION VERSION_LESS ${SUNDIALS_MINIMUM_VERSION})
   message(FATAL_ERROR "SUNDIALS ${SUNDIALS_MINIMUM_VERSION} or newer is required. Found version ${SUNDIALS_VERSION}.")
endif()

Src/Extern/SUNDIALS/AMReX_SUNMemory.cpp Outdated Show resolved Hide resolved
Tools/CMake/AMReXThirdPartyLibraries.cmake Outdated Show resolved Hide resolved
WeiqunZhang and others added 2 commits March 25, 2024 17:58
Co-authored-by: Axel Huebl <axel.huebl@plasma.ninja>
Co-authored-by: Axel Huebl <axel.huebl@plasma.ninja>
Copy link
Member

@ax3l ax3l left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, looks good!

@ax3l ax3l merged commit 82008f8 into AMReX-Codes:development Mar 27, 2024
69 checks passed
@WeiqunZhang WeiqunZhang deleted the sundials-codes/development branch March 27, 2024 23:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants