Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
1837683
Add FindReSolve.cmake
pelesh Jun 2, 2026
08a2453
Fix Re::Solve smoke test
pelesh Jun 2, 2026
675fae5
cmake formatting fixes
pelesh Jun 2, 2026
0b67630
Modified the try_compile test to link ReSolve::ReSolve instead of the…
JeffZ594 Jun 3, 2026
3078b64
Add Re::Solve build to the CI pipeline
pelesh Jun 3, 2026
0bc7bb0
Create the SUNMatrix_ReSolve class
JeffZ594 Jun 10, 2026
cc5a82c
Simple unit tests
JeffZ594 Jun 10, 2026
6e2ff03
Add GPU support for the SUNMatrix_ReSolve class and implemented funct…
JeffZ594 Jun 17, 2026
d55cf1e
Adds support for csc and coo Re::Solve matrices. (Not fully tested)
JeffZ594 Jun 19, 2026
0e048fc
Revert "Adds support for csc and coo Re::Solve matrices. (Not fully t…
JeffZ594 Jun 19, 2026
d80de11
Cleaned up some comments
JeffZ594 Jun 19, 2026
af8b5e3
Create documentation for the ReSolve interface
JeffZ594 Jun 23, 2026
c653dbd
Update SUNMatrix_ReSolve class to remove the NP variable and add abil…
JeffZ594 Jun 23, 2026
dd4a531
Updated the SUNMatrix_ReSolve_SyncData() function to check if syncDat…
JeffZ594 Jun 23, 2026
09ca11e
update CHANGELOG.md and RecentChanges.rst
JeffZ594 Jun 23, 2026
34b4bf6
Remove the debugging print function
JeffZ594 Jun 24, 2026
cdc7e96
Update the Install.rst docs to use more modern cuda architecture as a…
JeffZ594 Jun 24, 2026
6167e04
Update the sunmatrix CMake file to check for the backend used and rem…
JeffZ594 Jun 24, 2026
91c5b8f
Update formatting
JeffZ594 Jun 25, 2026
98247e1
Apply swig and litgen patches
JeffZ594 Jun 26, 2026
d63c6ef
Test disabling resolve in the sundials-ci spack.yaml files
JeffZ594 Jun 26, 2026
7e84d18
Try disabling resolve in ci tests for now
JeffZ594 Jun 26, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 25 additions & 21 deletions .github/hubcast.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,25 @@
Repo:
# Required: organization or user that owns the repo on CZ GitLab
dest_org: sundials

# Required: name of the destination repository on CZ GitLab
dest_name: sundials

# Optional: name of the CI check as reported back to GitHub (default: gitlab-ci)
check_name: llnl-lc-gitlab-ci

# Optional: granularity of CI statuses reported to GitHub (default: [pipeline])
# Set to [pipeline] for overall pipeline status only
# Set to [jobs] for individual job statuses only
# Set to [pipeline, jobs] to report both
check_types: [pipeline, jobs]

# Optional: delete branches from destination when source PR is closed (default: true)
delete_closed: true

# Optional: sync draft PRs/MRs (default: true)
sync_drafts: true
# Hubcast configuration is disabled; CI runs on GitHub-hosted resources only.
# To re-enable mirroring to LLNL CZ GitLab (and the llnl-lc-gitlab-ci checks
# on LLNL clusters), uncomment the block below.
#
# Repo:
# # Required: organization or user that owns the repo on CZ GitLab
# dest_org: sundials
#
# # Required: name of the destination repository on CZ GitLab
# dest_name: sundials
#
# # Optional: name of the CI check as reported back to GitHub (default: gitlab-ci)
# check_name: llnl-lc-gitlab-ci
#
# # Optional: granularity of CI statuses reported to GitHub (default: [pipeline])
# # Set to [pipeline] for overall pipeline status only
# # Set to [jobs] for individual job statuses only
# # Set to [pipeline, jobs] to report both
# check_types: [pipeline, jobs]
#
# # Optional: delete branches from destination when source PR is closed (default: true)
# delete_closed: true
#
# # Optional: sync draft PRs/MRs (default: true)
# sync_drafts: true
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@

### New Features and Enhancements

Added a interface for the Re::Solve library (https://github.com/ORNL/ReSolve) and the
SUNMatrix_ReSolve class to use ReSolve matrices.

Added the function `SUNLogger_SetQueueAndFlushMsgFns` to allow for user-defined
functions to queue and flush log messages.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ auto pyEnumSUNMatrix_ID =
.value("SUNMATRIX_GINKGO", SUNMATRIX_GINKGO, "")
.value("SUNMATRIX_GINKGOBATCH", SUNMATRIX_GINKGOBATCH, "")
.value("SUNMATRIX_KOKKOSDENSE", SUNMATRIX_KOKKOSDENSE, "")
.value("SUNMATRIX_RESOLVE", SUNMATRIX_RESOLVE, "")
.value("SUNMATRIX_CUSTOM", SUNMATRIX_CUSTOM, "")
.export_values();
// #ifndef SWIG
Expand Down
7 changes: 7 additions & 0 deletions cmake/SundialsBuildOptionsPost.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,13 @@ sundials_option(
ADVANCED DEPRECATED_NAMES BUILD_SUNMATRIX_ONEMKLDENSE)
list(APPEND SUNDIALS_BUILD_LIST "SUNDIALS_ENABLE_SUNMATRIX_ONEMKLDENSE")

sundials_option(
SUNDIALS_ENABLE_SUNMATRIX_RESOLVE BOOL
"Enable the SUNMATRIX_RESOLVE module (requires Re::Solve)" ON
DEPENDS_ON SUNDIALS_ENABLE_RESOLVE
Comment on lines +206 to +207

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This should be set to off for now.

@JeffZ594 JeffZ594 Jun 24, 2026

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I believe DEPENDS_ON is a macro from cmake/macros/SundialsOption.cmake that will automatically set this to OFF if SUNDIALS_ENABLE_RESOLVE is not enabled. When I set it to OFF even with SUNDIALS_ENABLE_RESOLVE=ON the ReSolve tests are not created so I think this should be left as ON.

ADVANCED DEPRECATED_NAMES BUILD_SUNMATRIX_RESOLVE)
list(APPEND SUNDIALS_BUILD_LIST "SUNDIALS_ENABLE_SUNMATRIX_RESOLVE")

sundials_option(
SUNDIALS_ENABLE_SUNMATRIX_SLUNRLOC BOOL
"Enable the SUNMATRIX_SLUNRLOC module (requires SuperLU_DIST)" ON
Expand Down
3 changes: 2 additions & 1 deletion cmake/SundialsSetupCompilers.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,8 @@ if(SUNDIALS_ENABLE_BENCHMARKS
OR SUNDIALS_ENABLE_MAGMA
OR SUNDIALS_ENABLE_GINKGO
OR SUNDIALS_ENABLE_KOKKOS
OR SUNDIALS_ENABLE_ADIAK)
OR SUNDIALS_ENABLE_ADIAK
OR SUNDIALS_ENABLE_RESOLVE)
include(SundialsSetupCXX)
endif()

Expand Down
5 changes: 5 additions & 0 deletions cmake/SundialsSetupConfig.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,11 @@ foreach(backend ${SUNDIALS_MAGMA_BACKENDS})
set(SUNDIALS_MAGMA_BACKENDS_${backend} TRUE)
endforeach()

# prepare substitution variable(s) SUNDIALS_RESOLVE_BACKENDS_*
foreach(backend ${SUNDIALS_RESOLVE_BACKENDS})
set(SUNDIALS_RESOLVE_BACKENDS_${backend} TRUE)
endforeach()

# prepare substitution variable SUNDIALS_HAVE_POSIX_TIMERS for sundials_config.h
if(SUNDIALS_POSIX_TIMERS) # set in SundialsPOSIXTimers.cmake
set(SUNDIALS_HAVE_POSIX_TIMERS TRUE)
Expand Down
9 changes: 9 additions & 0 deletions cmake/SundialsSetupTPLs.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,15 @@ if(SUNDIALS_ENABLE_RAJA)
list(APPEND SUNDIALS_TPL_LIST "RAJA")
endif()

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

if(SUNDIALS_ENABLE_RESOLVE)
include(SundialsReSolve)
list(APPEND SUNDIALS_TPL_LIST "RESOLVE")
endif()

# ---------------------------------------------------------------
# Find (and test) the SuperLUDIST libraries
# ---------------------------------------------------------------
Expand Down
26 changes: 26 additions & 0 deletions cmake/SundialsTPLOptions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -560,3 +560,29 @@ sundials_option(
DEPRECATED_NAMES
KOKKOS_KERNELS_WORKS
NEGATE_DEPRECATED)

# ---------------------------------------------------------------
# Enable ReSolve support?
# ---------------------------------------------------------------

sundials_option(SUNDIALS_ENABLE_RESOLVE BOOL "Enable ReSolve support" OFF)

sundials_option(
SUNDIALS_RESOLVE_BACKENDS
STRING
"Which ReSolve backend to use under the SUNDIALS ReSolve interfaces (CPU, CUDA, HIP)"
"CPU"
OPTIONS "CPU;CUDA;HIP"
DEPENDS_ON SUNDIALS_ENABLE_RESOLVE)

sundials_option(ReSolve_DIR PATH "Path to the root of a ReSolve installation"
"${ReSolve_DIR}")

sundials_option(ReSolve_INCLUDE_DIR PATH "ReSolve include directory"
"${ReSolve_INCLUDE_DIR}" ADVANCED)

sundials_option(ReSolve_LIBRARY_DIR PATH "ReSolve library directory"
"${ReSolve_LIBRARY_DIR}" ADVANCED)

sundials_option(SUNDIALS_ENABLE_RESOLVE_CHECKS BOOL
"Enable ReSolve compatibility checks" ON ADVANCED)
127 changes: 127 additions & 0 deletions cmake/tpl/FindReSolve.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
# ------------------------------------------------------------------------------
# Programmer(s): Slaven Peles @ ORNL
# ------------------------------------------------------------------------------
# SUNDIALS Copyright Start
# Copyright (c) 2025-2026, Lawrence Livermore National Security,
# University of Maryland Baltimore County, and the SUNDIALS contributors.
# Copyright (c) 2013-2025, Lawrence Livermore National Security
# and Southern Methodist University.
# Copyright (c) 2002-2013, Lawrence Livermore National Security.
# All rights reserved.
#
# See the top-level LICENSE and NOTICE files for details.
#
# SPDX-License-Identifier: BSD-3-Clause
# SUNDIALS Copyright End
# ------------------------------------------------------------------------------
# ReSolve find module that creates an imported target for ReSolve.
# The target is SUNDIALS::ReSolve.
#
# The variable ReSolve_DIR can be used to control where the module
# looks for the library (path to the root of a ReSolve installation or
# to a directory containing ReSolveConfig.cmake).
#
# The variable ReSolve_INCLUDE_DIR can be used to set the include path.
# The variable ReSolve_LIBRARY_DIR can be used to set the library path.
#
# This module also defines variables, but it is best to use the defined
# target to ensure includes and compile/link options are correctly passed
# to consumers.
#
# ReSolve_FOUND - system has the ReSolve library
# ReSolve_LIBRARY - the ReSolve library
# ReSolve_INCLUDE_DIR - the ReSolve include path
# ReSolve_LIBRARIES - all libraries needed for ReSolve
# ------------------------------------------------------------------------------

# Prefer the upstream CMake config file if the user did not point to a specific
# include/library directory.

if(NOT
(ReSolve_INCLUDE_DIR
OR ReSolve_LIBRARY_DIR
OR ReSolve_LIBRARY))

find_package(
ReSolve
CONFIG
QUIET
PATHS
"${ReSolve_DIR}"
PATH_SUFFIXES
lib/cmake/ReSolve
cmake/ReSolve)

if(ReSolve_FOUND AND TARGET ReSolve::ReSolve)
if(NOT TARGET SUNDIALS::ReSolve)
add_library(SUNDIALS::ReSolve ALIAS ReSolve::ReSolve)
endif()

# Check for CUDA backend
if(TARGET ReSolve::CUDA)
set(RESOLVE_CUDA_FOUND
TRUE
CACHE BOOL "ReSolve CUDA backend found")
if(NOT TARGET SUNDIALS::ReSolve_CUDA)
add_library(SUNDIALS::ReSolve_CUDA ALIAS ReSolve::resolve_backend_cuda)
endif()
endif()

# Check for HIP backend
if(TARGET ReSolve::HIP)
set(RESOLVE_HIP_FOUND
TRUE
CACHE BOOL "ReSolve HIP backend found")
if(NOT TARGET SUNDIALS::ReSolve_HIP)
add_library(SUNDIALS::ReSolve_HIP ALIAS ReSolve::resolve_backend_hip)
endif()
endif()
return()
endif()

endif()

# Fall back to manual detection using ReSolve_DIR, ReSolve_INCLUDE_DIR, and
# ReSolve_LIBRARY_DIR.

# Find the include directory
find_path(
ReSolve_INCLUDE_DIR resolve/SystemSolver.hpp
PATHS "${ReSolve_DIR}"
PATH_SUFFIXES include
DOC "ReSolve include directory")

if(ReSolve_LIBRARY)
get_filename_component(ReSolve_LIBRARY_DIR "${ReSolve_LIBRARY}" PATH)
set(ReSolve_LIBRARY_DIR
"${ReSolve_LIBRARY_DIR}"
CACHE PATH "" FORCE)
else()
find_library(
ReSolve_LIBRARY resolve
PATHS "${ReSolve_DIR}" "${ReSolve_LIBRARY_DIR}"
PATH_SUFFIXES lib lib64
DOC "ReSolve library")
endif()
mark_as_advanced(ReSolve_LIBRARY)

set(ReSolve_LIBRARIES "${ReSolve_LIBRARY}")

# Set package variables including ReSolve_FOUND
find_package_handle_standard_args(
ReSolve REQUIRED_VARS ReSolve_LIBRARY ReSolve_LIBRARIES ReSolve_INCLUDE_DIR)

# Create the SUNDIALS::ReSolve imported target
if(ReSolve_FOUND)

if(NOT TARGET SUNDIALS::ReSolve)
add_library(SUNDIALS::ReSolve UNKNOWN IMPORTED)
endif()

set_target_properties(
SUNDIALS::ReSolve
PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${ReSolve_INCLUDE_DIR}"
INTERFACE_LINK_LIBRARIES "${ReSolve_LIBRARIES}"
IMPORTED_LOCATION "${ReSolve_LIBRARY}")

endif()
90 changes: 90 additions & 0 deletions cmake/tpl/SundialsReSolve.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
# -----------------------------------------------------------------------------
# Programmer(s): Slaven Peles @ ORNL
# -----------------------------------------------------------------------------
# SUNDIALS Copyright Start
# Copyright (c) 2025-2026, Lawrence Livermore National Security,
# University of Maryland Baltimore County, and the SUNDIALS contributors.
# Copyright (c) 2013-2025, Lawrence Livermore National Security
# and Southern Methodist University.
# Copyright (c) 2002-2013, Lawrence Livermore National Security.
# All rights reserved.
#
# See the top-level LICENSE and NOTICE files for details.
#
# SPDX-License-Identifier: BSD-3-Clause
# SUNDIALS Copyright End
# -----------------------------------------------------------------------------
# Module to find and setup ReSolve.
# ReSolve is a GPU-friendly linear solver library developed at ORNL:
# https://github.com/ORNL/ReSolve
# -----------------------------------------------------------------------------

# -----------------------------------------------------------------------------
# Section 1: Include guard
# -----------------------------------------------------------------------------

include_guard(GLOBAL)

# -----------------------------------------------------------------------------
# Section 2: Check to make sure options are compatible
# -----------------------------------------------------------------------------

# ReSolve is a C++ library; CXX must be enabled (SundialsSetupCompilers.cmake
# gates include(SundialsSetupCXX) on SUNDIALS_ENABLE_RESOLVE).
if(NOT CMAKE_CXX_COMPILER_LOADED)
message(FATAL_ERROR "ReSolve requires C++ but no C++ compiler was found. "
"Enable a C++ compiler or set CMAKE_CXX_COMPILER.")
endif()

if(CMAKE_CXX_STANDARD LESS "14")
message(FATAL_ERROR "CMAKE_CXX_STANDARD must be >= 14 when using ReSolve")
endif()

# -----------------------------------------------------------------------------
# Section 3: Find the TPL
# -----------------------------------------------------------------------------

find_package(ReSolve REQUIRED)

message(STATUS "ReSolve_LIBRARIES: ${ReSolve_LIBRARIES}")
message(STATUS "ReSolve_INCLUDE_DIR: ${ReSolve_INCLUDE_DIR}")
message(STATUS "SUNDIALS_RESOLVE_BACKENDS: ${SUNDIALS_RESOLVE_BACKENDS}")

# -----------------------------------------------------------------------------
# Section 4: Test the TPL
# -----------------------------------------------------------------------------

if(SUNDIALS_ENABLE_RESOLVE_CHECKS)

message(CHECK_START "Testing ReSolve")

set(TEST_DIR ${PROJECT_BINARY_DIR}/RESOLVE_TEST)

# Use the self-contained Common.hpp rather than SystemSolver.hpp; the latter
# has missing internal includes in some ReSolve versions.
file(
WRITE ${TEST_DIR}/test.cpp
"\#include <resolve/Common.hpp>\n" "int main(void) {\n"
" ReSolve::real_type x = ReSolve::constants::ONE;\n" " (void)x;\n"
" return 0;\n" "}\n")

try_compile(
COMPILE_OK ${TEST_DIR}
${TEST_DIR}/test.cpp
LINK_LIBRARIES ReSolve::ReSolve
OUTPUT_VARIABLE COMPILE_OUTPUT)

if(COMPILE_OK)
message(CHECK_PASS "success")
else()
message(CHECK_FAIL "failed")
file(WRITE ${TEST_DIR}/compile.out "${COMPILE_OUTPUT}")
message(
FATAL_ERROR
"Could not compile ReSolve test. Check output in ${TEST_DIR}/compile.out"
)
endif()

else()
message(STATUS "Skipped ReSolve checks.")
endif()
3 changes: 3 additions & 0 deletions doc/shared/RecentChanges.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@

**New Features and Enhancements**

Added a interface for the Re::Solve library (https://github.com/ORNL/ReSolve)
and the SUNMatrix_ReSolve class to use ReSolve matrices.

Added the function :c:func:`SUNLogger_SetQueueAndFlushMsgFns` to allow for
user-defined functions to queue and flush log messages.

Expand Down
Loading
Loading