-
Notifications
You must be signed in to change notification settings - Fork 0
Re::Solve SUNMatrix class #3
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
Open
JeffZ594
wants to merge
22
commits into
resolve-develop
Choose a base branch
from
resolve/sunmatrix_resolve
base: resolve-develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
1837683
Add FindReSolve.cmake
pelesh 08a2453
Fix Re::Solve smoke test
pelesh 675fae5
cmake formatting fixes
pelesh 0b67630
Modified the try_compile test to link ReSolve::ReSolve instead of the…
JeffZ594 3078b64
Add Re::Solve build to the CI pipeline
pelesh 0bc7bb0
Create the SUNMatrix_ReSolve class
JeffZ594 cc5a82c
Simple unit tests
JeffZ594 6e2ff03
Add GPU support for the SUNMatrix_ReSolve class and implemented funct…
JeffZ594 d55cf1e
Adds support for csc and coo Re::Solve matrices. (Not fully tested)
JeffZ594 0e048fc
Revert "Adds support for csc and coo Re::Solve matrices. (Not fully t…
JeffZ594 d80de11
Cleaned up some comments
JeffZ594 af8b5e3
Create documentation for the ReSolve interface
JeffZ594 c653dbd
Update SUNMatrix_ReSolve class to remove the NP variable and add abil…
JeffZ594 dd4a531
Updated the SUNMatrix_ReSolve_SyncData() function to check if syncDat…
JeffZ594 09ca11e
update CHANGELOG.md and RecentChanges.rst
JeffZ594 34b4bf6
Remove the debugging print function
JeffZ594 cdc7e96
Update the Install.rst docs to use more modern cuda architecture as a…
JeffZ594 6167e04
Update the sunmatrix CMake file to check for the backend used and rem…
JeffZ594 91c5b8f
Update formatting
JeffZ594 98247e1
Apply swig and litgen patches
JeffZ594 d63c6ef
Test disabling resolve in the sundials-ci spack.yaml files
JeffZ594 7e84d18
Try disabling resolve in ci tests for now
JeffZ594 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
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.