Skip to content

Update to SUNDIALS v7#3835

Merged
ax3l merged 8 commits intoAMReX-Codes:developmentfrom
WeiqunZhang:sundials-codes/development
Mar 27, 2024
Merged

Update to SUNDIALS v7#3835
ax3l merged 8 commits intoAMReX-Codes:developmentfrom
WeiqunZhang:sundials-codes/development

Conversation

@WeiqunZhang
Copy link
Copy Markdown
Member

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

@WeiqunZhang
Copy link
Copy Markdown
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
Copy Markdown
Member Author

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

@balos1
Copy link
Copy Markdown
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()

@WeiqunZhang WeiqunZhang requested review from atmyers and ax3l March 23, 2024 18:18
Copy link
Copy Markdown
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
@WeiqunZhang WeiqunZhang deleted the sundials-codes/development branch March 27, 2024 23:01
@balos1 balos1 mentioned this pull request Oct 3, 2024
61 tasks
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.

3 participants