Skip to content

Commit

Permalink
Update to SUNDIALS 5.8.0 (#1836)
Browse files Browse the repository at this point in the history
See https://github.com/LLNL/sundials/releases/tag/v5.8.0 for changes.

* Update include dirs 
* Set the correct steadystate NlsRhsFn
  • Loading branch information
dweindl authored Jul 25, 2022
1 parent e7b71d4 commit 5d0da76
Show file tree
Hide file tree
Showing 56 changed files with 905 additions and 301 deletions.
64 changes: 32 additions & 32 deletions ThirdParty/sundials/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,31 @@ cmake_minimum_required(VERSION 3.12)
# sets PROJECT_SOURCE_DIR and PROJECT_BINARY_DIR variables.
project(SUNDIALS C)

# Specify the location of additional CMAKE modules
set(CMAKE_MODULE_PATH
${PROJECT_SOURCE_DIR}/cmake
${PROJECT_SOURCE_DIR}/cmake/macros
${PROJECT_SOURCE_DIR}/cmake/tpl
)

# MACRO definitions
include(SundialsCMakeMacros)
include(FindPackageHandleStandardArgs)
include(CMakePrintHelpers)

# Set some variables with info on the SUNDIALS project
set(PACKAGE_BUGREPORT "sundials-users@llnl.gov")
set(PACKAGE_NAME "SUNDIALS")
set(PACKAGE_STRING "SUNDIALS 5.7.0")
set(PACKAGE_STRING "SUNDIALS 5.8.0")
set(PACKAGE_TARNAME "sundials")

# set SUNDIALS version numbers
# Set SUNDIALS version numbers
sundials_git_version() # sets SUNDIALS_GIT_VERSION
message(STATUS "SUNDIALS_GIT_VERSION: ${SUNDIALS_GIT_VERSION}")

# (use "" for the version label if none is needed)
set(PACKAGE_VERSION_MAJOR "5")
set(PACKAGE_VERSION_MINOR "7")
set(PACKAGE_VERSION_MINOR "8")
set(PACKAGE_VERSION_PATCH "0")
set(PACKAGE_VERSION_LABEL "")

Expand All @@ -50,58 +65,44 @@ endif()

# Specify the VERSION and SOVERSION for shared libraries

set(arkodelib_VERSION "4.7.0")
set(arkodelib_VERSION "4.8.0")
set(arkodelib_SOVERSION "4")

set(cvodelib_VERSION "5.7.0")
set(cvodelib_VERSION "5.8.0")
set(cvodelib_SOVERSION "5")

set(cvodeslib_VERSION "5.7.0")
set(cvodeslib_VERSION "5.8.0")
set(cvodeslib_SOVERSION "5")

set(idalib_VERSION "5.7.0")
set(idalib_VERSION "5.8.0")
set(idalib_SOVERSION "5")

set(idaslib_VERSION "4.7.0")
set(idaslib_VERSION "4.8.0")
set(idaslib_SOVERSION "4")

set(kinsollib_VERSION "5.7.0")
set(kinsollib_VERSION "5.8.0")
set(kinsollib_SOVERSION "5")

set(cpodeslib_VERSION "0.0.0")
set(cpodeslib_SOVERSION "0")

set(nveclib_VERSION "5.7.0")
set(nveclib_VERSION "5.8.0")
set(nveclib_SOVERSION "5")

set(sunmatrixlib_VERSION "3.7.0")
set(sunmatrixlib_VERSION "3.8.0")
set(sunmatrixlib_SOVERSION "3")

set(sunlinsollib_VERSION "3.7.0")
set(sunlinsollib_VERSION "3.8.0")
set(sunlinsollib_SOVERSION "3")

set(sunnonlinsollib_VERSION "2.7.0")
set(sunnonlinsollib_VERSION "2.8.0")
set(sunnonlinsollib_SOVERSION "2")

set(sundialslib_VERSION
"${PACKAGE_VERSION_MAJOR}.${PACKAGE_VERSION_MINOR}.${PACKAGE_VERSION_PATCH}"
)
set(sundialslib_SOVERSION "${PACKAGE_VERSION_MAJOR}")

# ===============================================================
# SUNDIALS CMake Macros
# ===============================================================

# Specify the location of additional CMAKE modules
set(CMAKE_MODULE_PATH
${PROJECT_SOURCE_DIR}/cmake
${PROJECT_SOURCE_DIR}/cmake/macros
${PROJECT_SOURCE_DIR}/cmake/tpl
)

# MACRO definitions
include(SundialsCMakeMacros)

# ===============================================================
# Initial Setup
# ===============================================================
Expand Down Expand Up @@ -192,8 +193,6 @@ if(_BUILD_EXAMPLES)
add_subdirectory(examples)
endif()



# ===============================================================
# Install configuration header files and license file.
# ===============================================================
Expand Down Expand Up @@ -254,9 +253,10 @@ install(
)

# install SUNDIALSConfig.cmake
configure_file(
${PROJECT_SOURCE_DIR}/cmake/SUNDIALSConfig.cmake.in SUNDIALSConfig.cmake
@ONLY
configure_package_config_file(
"${PROJECT_SOURCE_DIR}/cmake/SUNDIALSConfig.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/SUNDIALSConfig.cmake"
INSTALL_DESTINATION "${SUNDIALS_INSTALL_CMAKEDIR}"
)
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/SUNDIALSConfig.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/SUNDIALSConfigVersion.cmake"
Expand Down
2 changes: 1 addition & 1 deletion ThirdParty/sundials/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# SUNDIALS: SUite of Nonlinear and DIfferential/ALgebraic equation Solvers #
### Version 5.7.0 (Jan 2021) ###
### Version 5.8.0 (Sep 2021) ###

**Center for Applied Scientific Computing, Lawrence Livermore National Laboratory**

Expand Down
52 changes: 43 additions & 9 deletions ThirdParty/sundials/cmake/SUNDIALSConfig.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -12,31 +12,57 @@
# SUNDIALS Copyright End
# ---------------------------------------------------------------

@PACKAGE_INIT@

include(CMakeFindDependencyMacro)

### ------- Set FOUND status for SUNDIALS components

set(_installed_components "@_SUNDIALS_INSTALLED_COMPONENTS@")

set(_comp_not_found "")
foreach(_comp ${SUNDIALS_FIND_COMPONENTS})
if(_comp IN_LIST _installed_components)
set(SUNDIALS_${_comp}_FOUND TRUE)
else()
set(SUNDIALS_${_comp}_FOUND FALSE)
set(_comp_not_found "${_comp} ${_comp_not_found}")
endif()
endforeach()

if(_comp_not_found)
set(SUNDIALS_NOT_FOUND_MESSAGE "Component(s) not found: ${_comp_not_found}")
endif()

### ------- Import SUNDIALS targets

include("${CMAKE_CURRENT_LIST_DIR}/SUNDIALSTargets.cmake")

### ------- Alias targets

set(_SUNDIALS_ALIAS_TARGETS "@_SUNDIALS_ALIAS_TARGETS@")
foreach(ptr ${_SUNDIALS_ALIAS_TARGETS})
string(REGEX REPLACE "sundials_" "" ptr "${ptr}")
string(REGEX MATCHALL "([A-Za-z_]+)->([A-Za-z_]+)"
_matches "${ptr}")
set(_pointer ${CMAKE_MATCH_1})
set(_pointee ${CMAKE_MATCH_2})
set_target_properties(SUNDIALS::${_pointee} PROPERTIES IMPORTED_GLOBAL TRUE)
add_library(SUNDIALS::${_pointer} ALIAS SUNDIALS::${_pointee})
if(NOT TARGET SUNDIALS::${_pointer})
add_library(SUNDIALS::${_pointer} INTERFACE IMPORTED)
target_link_libraries(SUNDIALS::${_pointer} INTERFACE SUNDIALS::${_pointee})
endif()
endforeach()

### ------- Create TPL imported targets

if(@ENABLE_HYPRE@ AND NOT TARGET SUNDIALS::HYPRE)
add_library(SUNDIALS::HYPRE INTERFACE IMPORTED GLOBAL)
add_library(SUNDIALS::HYPRE INTERFACE IMPORTED)
target_link_libraries(SUNDIALS::HYPRE INTERFACE "@HYPRE_LIBRARIES@")
set_target_properties(SUNDIALS::HYPRE PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "@HYPRE_INCLUDE_DIR@")
endif()

if(@ENABLE_KLU@ AND NOT TARGET SUNDIALS::KLU)
add_library(SUNDIALS::KLU INTERFACE IMPORTED GLOBAL)
add_library(SUNDIALS::KLU INTERFACE IMPORTED)
target_link_libraries(SUNDIALS::KLU INTERFACE "@KLU_LIBRARIES@")
set_target_properties(SUNDIALS::KLU PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "@KLU_INCLUDE_DIR@")
endif()
Expand Down Expand Up @@ -93,19 +119,23 @@ if(@ENABLE_PETSC@)
endif()

if(@ENABLE_MAGMA@ AND NOT TARGET SUNDIALS::MAGMA)
add_library(SUNDIALS::MAGMA INTERFACE IMPORTED GLOBAL)
add_library(SUNDIALS::MAGMA INTERFACE IMPORTED)
target_link_libraries(SUNDIALS::MAGMA INTERFACE "@MAGMA_LIBRARIES@")
set_target_properties(SUNDIALS::MAGMA PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "@MAGMA_INCLUDE_DIR@")
endif()

if(@ENABLE_ONEMKL@ AND NOT TARGET MKL)
find_package(MKL PATHS @ONEMKL_DIR@)
endif()

if(@ENABLE_SUPERLUDIST@ AND NOT TARGET SUNDIALS::SUPERLUDIST)
add_library(SUNDIALS::SUPERLUDIST INTERFACE IMPORTED GLOBAL)
add_library(SUNDIALS::SUPERLUDIST INTERFACE IMPORTED)
target_link_libraries(SUNDIALS::SUPERLUDIST INTERFACE "@SUPERLUDIST_LIBRARIES@")
set_target_properties(SUNDIALS::SUPERLUDIST PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "@SUPERLUDIST_INCLUDE_DIR@")
endif()

if(@ENABLE_SUPERLUMT@ AND NOT TARGET SUNDIALS::SUPERLUMT)
add_library(SUNDIALS::SUPERLUMT INTERFACE IMPORTED GLOBAL)
add_library(SUNDIALS::SUPERLUMT INTERFACE IMPORTED)
target_link_libraries(SUNDIALS::SUPERLUMT INTERFACE "@SUPERLUMT_LIBRARIES@")
set_target_properties(SUNDIALS::SUPERLUMT PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "@SUPERLUMT_INCLUDE_DIR@")
endif()
Expand All @@ -115,13 +145,17 @@ if(@ENABLE_RAJA@ AND NOT TARGET RAJA)
endif()

if(@ENABLE_TRILINOS@ AND NOT TARGET SUNDIALS::TRILINOS)
add_library(SUNDIALS::TRILINOS INTERFACE IMPORTED GLOBAL)
add_library(SUNDIALS::TRILINOS INTERFACE IMPORTED)
target_link_libraries(SUNDIALS::TRILINOS INTERFACE "@Trilinos_LIBRARIES@")
set_target_properties(SUNDIALS::TRILINOS PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "@Trilinos_INCLUDE_DIRS@")
endif()

if(@ENABLE_XBRAID@ AND NOT TARGET SUNDIALS::XBRAID)
add_library(SUNDIALS::XBRAID INTERFACE IMPORTED GLOBAL)
add_library(SUNDIALS::XBRAID INTERFACE IMPORTED)
target_link_libraries(SUNDIALS::XBRAID INTERFACE "@XBRAID_LIBRARIES@")
set_target_properties(SUNDIALS::XBRAID PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "@XBRAID_INCLUDE_DIR@")
endif()

### ------- Check if required components were found

check_required_components(SUNDIALS)
26 changes: 18 additions & 8 deletions ThirdParty/sundials/cmake/SundialsBuildOptionsPost.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@
# Currently only available in CVODE.
# ---------------------------------------------------------------

sundials_option(SUNDIALS_BUILD_PACKAGE_FUSED_KERNELS BOOL "Build specialized fused CUDA kernels" OFF
DEPENDS_ON ENABLE_CUDA CMAKE_CUDA_COMPILER BUILD_CVODE
sundials_option(SUNDIALS_BUILD_PACKAGE_FUSED_KERNELS BOOL "Build specialized fused GPU kernels" OFF
DEPENDS_ON BUILD_CVODE
DEPENDS_ON_THROW_ERROR
SHOW_IF ENABLE_CUDA CMAKE_CUDA_COMPILER BUILD_CVODE)
SHOW_IF BUILD_CVODE)

# ---------------------------------------------------------------
# Options to enable/disable build for NVECTOR modules.
Expand Down Expand Up @@ -124,16 +124,21 @@ sundials_option(BUILD_SUNMATRIX_CUSPARSE BOOL "Build the SUNMATRIX_CUSPARSE modu
ADVANCED)
list(APPEND SUNDIALS_BUILD_LIST "BUILD_SUNMATRIX_CUSPARSE")

sundials_option(BUILD_SUNMATRIX_SLUNRLOC BOOL "Build the SUNMATRIX_SLUNRLOC module (requires SuperLU_DIST)" ON
DEPENDS_ON ENABLE_SUPERLUDIST SUPERLUDIST_WORKS
ADVANCED)
list(APPEND SUNDIALS_BUILD_LIST "BUILD_SUNMATRIX_SLUNRLOC")

sundials_option(BUILD_SUNMATRIX_MAGMADENSE BOOL "Build the SUNMATRIX_MAGMADENSE module (requires MAGMA)" ON
DEPENDS_ON ENABLE_MAGMA MAGMA_WORKS
ADVANCED)
list(APPEND SUNDIALS_BUILD_LIST "BUILD_SUNMATRIX_MAGMADENSE")

sundials_option(BUILD_SUNMATRIX_ONEMKLDENSE BOOL "Build the SUNMATRIX_ONEMKLDENSE module (requires oneMKL)" ON
DEPENDS_ON ENABLE_ONEMKL ONEMKL_WORKS
ADVANCED)
list(APPEND SUNDIALS_BUILD_LIST "BUILD_SUNMATRIX_ONEMKLDENSE")

sundials_option(BUILD_SUNMATRIX_SLUNRLOC BOOL "Build the SUNMATRIX_SLUNRLOC module (requires SuperLU_DIST)" ON
DEPENDS_ON ENABLE_SUPERLUDIST SUPERLUDIST_WORKS
ADVANCED)
list(APPEND SUNDIALS_BUILD_LIST "BUILD_SUNMATRIX_SLUNRLOC")

# ---------------------------------------------------------------
# Options to enable/disable build for SUNLINSOL modules.
# ---------------------------------------------------------------
Expand Down Expand Up @@ -179,6 +184,11 @@ sundials_option(BUILD_SUNLINSOL_MAGMADENSE BOOL "Build the SUNLINSOL_MAGMADENSE
ADVANCED)
list(APPEND SUNDIALS_BUILD_LIST "BUILD_SUNLINSOL_MAGMADENSE")

sundials_option(BUILD_SUNLINSOL_ONEMKLDENSE BOOL "Build the SUNLINSOL_ONEMKLDENSE module (requires oneMKL)" ON
DEPENDS_ON ENABLE_ONEMKL ONEMKL_WORKS
ADVANCED)
list(APPEND SUNDIALS_BUILD_LIST "BUILD_SUNLINSOL_ONEMKLDENSE")

sundials_option(BUILD_SUNLINSOL_SUPERLUDIST BOOL "Build the SUNLINSOL_SUPERLUDIST module (requires SUPERLUDIST)" ON
DEPENDS_ON ENABLE_SUPERLUDIST SUPERLUDIST_WORKS BUILD_SUNMATRIX_SLUNRLOC
ADVANCED)
Expand Down
3 changes: 2 additions & 1 deletion ThirdParty/sundials/cmake/SundialsExampleOptions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ sundials_option(EXAMPLES_ENABLE_C BOOL "Build SUNDIALS C examples" ON)

# Some TPLs only have C++ examples. Default the C++ examples to ON if any of
# these are enabled on the initial configuration pass.
if (ENABLE_TRILINOS OR ENABLE_SUPERLUDIST OR ENABLE_XBRAID OR ENABLE_HIP OR ENABLE_MAGMA)
if (ENABLE_TRILINOS OR ENABLE_SUPERLUDIST OR ENABLE_XBRAID OR ENABLE_HIP OR
ENABLE_MAGMA OR ENABLE_SYCL OR ENABLE_ONEMKL OR ENABLE_RAJA)
sundials_option(EXAMPLES_ENABLE_CXX BOOL "Build SUNDIALS C++ examples" ON)
else()
sundials_option(EXAMPLES_ENABLE_CXX BOOL "Build SUNDIALS C++ examples" OFF)
Expand Down
5 changes: 5 additions & 0 deletions ThirdParty/sundials/cmake/SundialsSetupCXX.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,9 @@ set(DOCSTR "The C++ standard to use if C++ is enabled (98, 11, 14, 17, 20)")
sundials_option(CMAKE_CXX_STANDARD STRING "${DOCSTR}" "11"
OPTIONS "98;11;14;17;20")

# SYCL requries C++17
if(ENABLE_SYCL AND (CMAKE_CXX_STANDARD LESS "17"))
set(CMAKE_CXX_STANDARD "17" CACHE STRING "${DOCSTR}" FORCE)
endif()

message(STATUS "CXX standard set to ${CMAKE_CXX_STANDARD}")
13 changes: 12 additions & 1 deletion ThirdParty/sundials/cmake/SundialsSetupCompilers.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -213,11 +213,22 @@ if(ENABLE_HIP)
list(APPEND SUNDIALS_TPL_LIST "HIP")
endif()

# ===============================================================
# Default flags for build types
# ===============================================================

set(CMAKE_C_FLAGS_DEV "${CMAKE_C_FLAGS_DEV} -g -O0 -Wall -Wpedantic -Wextra -Wno-unused-parameter -Werror")
set(CMAKE_CXX_FLAGS_DEV "${CMAKE_CXX_FLAGS_DEV} -g -O0 -Wall -Wpedantic -Wextra -Wno-unused-parameter -Werror")
set(CMAKE_Fortran_FLAGS_DEV "${CMAKE_Fortran_FLAGS_DEV} -g -O0 -Wall -Wpedantic -ffpe-summary=none")
set(CMAKE_C_FLAGS_DEVSTRICT "-std=c89 ${CMAKE_C_FLAGS_DEV}")
set(CMAKE_CXX_FLAGS_DEVSTRICT "${CMAKE_CXX_FLAGS_DEV}")
set(CMAKE_Fortran_FLAGS_DEVSTRICT "${CMAKE_Fortran_FLAGS_DEV}")

# ===============================================================
# Configure presentation of language options
# ===============================================================

set(build_types DEBUG RELEASE RELWITHDEBINFO MINSIZEREL)
set(build_types DEBUG RELEASE RELWITHDEBINFO MINSIZEREL DEV DEVSTRICT)
set(_SUNDIALS_ENABLED_LANGS "C")

if(CXX_FOUND)
Expand Down
11 changes: 10 additions & 1 deletion ThirdParty/sundials/cmake/SundialsSetupTPLs.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,15 @@ if(ENABLE_MAGMA)
list(APPEND SUNDIALS_TPL_LIST "MAGMA")
endif()

# ---------------------------------------------------------------
# Find (and test) the oneMKL libraries
# ---------------------------------------------------------------

if(ENABLE_ONEMKL)
include(SundialsONEMKL)
list(APPEND SUNDIALS_TPL_LIST "ONEMKL")
endif()

# ---------------------------------------------------------------
# Find (and test) the SuperLUDIST libraries
# ---------------------------------------------------------------
Expand Down Expand Up @@ -144,4 +153,4 @@ endif()
# Check for POSIX timers
# ---------------------------------------------------------------

include(SundialsPOSIXTimers)
include(SundialsPOSIXTimers)
18 changes: 14 additions & 4 deletions ThirdParty/sundials/cmake/SundialsTPLOptions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ sundials_option(ENABLE_MAGMA BOOL "Enable MAGMA support" OFF)
sundials_option(MAGMA_DIR PATH "Path to the root of a MAGMA installation" "${MAGMA_DIR}"
SHOW_IF ENABLE_MAGMA)

sundials_option(SUNDIALS_MAGMA_BACKENDS STRING "Which MAGMA backend under the SUNDIALS MAGMA interfaces (CUDA, HIP)" "CUDA"
sundials_option(SUNDIALS_MAGMA_BACKENDS STRING "Which MAGMA backend to use under the SUNDIALS MAGMA interfaces (CUDA, HIP)" "CUDA"
OPTIONS "CUDA;HIP"
SHOW_IF ENABLE_MAGMA)

Expand Down Expand Up @@ -193,8 +193,8 @@ sundials_option(ENABLE_RAJA BOOL "Enable RAJA support" OFF)
sundials_option(RAJA_DIR PATH "Path to root of RAJA installation" "${RAJA_DIR}"
SHOW_IF ENABLE_RAJA)

sundials_option(SUNDIALS_RAJA_BACKENDS STRING "Which RAJA backend under the SUNDIALS RAJA interfaces (CUDA, HIP)" "CUDA"
OPTIONS "CUDA;HIP"
sundials_option(SUNDIALS_RAJA_BACKENDS STRING "Which RAJA backend under the SUNDIALS RAJA interfaces (CUDA, HIP, SYCL)" "CUDA"
OPTIONS "CUDA;HIP;SYCL"
SHOW_IF ENABLE_RAJA)

# ---------------------------------------------------------------
Expand Down Expand Up @@ -252,5 +252,15 @@ sundials_option(XBRAID_INCLUDES STRING "Semi-colon separated list of XBraid incl
ADVANCED)

sundials_option(XBRAID_WORKS BOOL "Set to ON to force CMake to accept a given XBraid configuration" OFF
DEPENDS_ON ENABLE_XBRAID
SHOW_IF ENABLE_XBRAID
ADVANCED)

# -------------------------------------------------------------
# Enable oneMKL support?
# -------------------------------------------------------------

sundials_option(ENABLE_ONEMKL BOOL "Enable oneMKL support" OFF)

sundials_option(ONEMKL_WORKS BOOL "Set to ON to force CMake to accept a given oneMKL configuration" OFF
SHOW_IF ENABLE_ONEMKL
ADVANCED)
Loading

0 comments on commit 5d0da76

Please sign in to comment.