Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
8 changes: 8 additions & 0 deletions .github/workflows/spack_default_build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,17 @@ jobs:
spack_spec:
- gridkit@develop ~asan~enzyme~ipopt~klu~resolve~sundials~ubsan
- gridkit@develop ~asan~enzyme~ipopt~klu~resolve+sundials~ubsan
^sundials@7.8.0
- gridkit@develop +asan+enzyme+ipopt+klu+resolve+sundials~ubsan build_type=RelWithDebInfo
^enzyme@0.0.206
^sundials@7.8.0
- gridkit@develop +asan~enzyme+ipopt+klu+resolve+sundials+ubsan
^sundials@7.8.0
- gridkit@develop +asan+enzyme+ipopt+klu+resolve+sundials~ubsan build_type=RelWithDebInfo
^enzyme@0.0.206
^sundials@partitioned-dae
- gridkit@develop +asan~enzyme+ipopt+klu+resolve+sundials+ubsan
^sundials@partitioned-dae

steps:
- name: Add LLVM
Expand Down
17 changes: 17 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,23 @@ if(GRIDKIT_ENABLE_SUNDIALS)
CACHE INTERNAL BOOL "Sparse solver enabled in SUNDIALS.")
message(STATUS "KLU support enabled in SUNDIALS.")
endif()
# SUNDIALS::arkode is an alias without include directories. Revisit once SUNDIALS reports partitioned DAE
# support itself.
if(TARGET SUNDIALS::arkode_shared)
get_target_property(_sundials_arkode_includes SUNDIALS::arkode_shared
INTERFACE_INCLUDE_DIRECTORIES)
else()
get_target_property(_sundials_arkode_includes SUNDIALS::arkode_static
INTERFACE_INCLUDE_DIRECTORIES)
endif()
find_file(
GRIDKIT_SUNDIALS_PDAESTEP_HEADER arkode/arkode_pdaestep.h
PATHS ${_sundials_arkode_includes}
NO_DEFAULT_PATH)
if(GRIDKIT_SUNDIALS_PDAESTEP_HEADER)
set(GRIDKIT_ENABLE_SUNDIALS_PARTITIONED_DAE ON)
message(STATUS "Partitioned DAE support enabled in SUNDIALS.")
endif()
endif()

if(GRIDKIT_ENABLE_ZMQ)
Expand Down
1 change: 1 addition & 0 deletions GridKit/Definitions.hpp.in
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#cmakedefine GRIDKIT_ENABLE_OPENMP
#cmakedefine GRIDKIT_ENABLE_THREADS
#cmakedefine GRIDKIT_ENABLE_SUNDIALS_SPARSE
#cmakedefine GRIDKIT_ENABLE_SUNDIALS_PARTITIONED_DAE
#cmakedefine GRIDKIT_ENABLE_DEVELOPER_MODE

#define GRIDKIT_VERSION "@GridKit_VERSION@"
Expand Down
8 changes: 6 additions & 2 deletions GridKit/Solver/Dynamic/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,12 @@
# - Cameron Rutherford <cameron.rutherford@pnnl.gov>
#]]

set(_dynamic_solver_sources Ida.cpp Partitioned.cpp)
set(_dynamic_solver_headers Ida.hpp Partitioned.hpp DynamicSolver.hpp)
set(_dynamic_solver_sources Ida.cpp)
set(_dynamic_solver_headers Ida.hpp DynamicSolver.hpp)
if(GRIDKIT_ENABLE_SUNDIALS_PARTITIONED_DAE)
list(APPEND _dynamic_solver_sources Partitioned.cpp)
list(APPEND _dynamic_solver_headers Partitioned.hpp)
endif()
set(_dynamic_solver_libraries
PUBLIC
SUNDIALS::nvecserial
Expand Down
7 changes: 5 additions & 2 deletions buildsystem/spack_repo/gridkit/packages/gridkit/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ class Gridkit(CMakePackage):
maintainers("nkoukpaizan", "pelesh")

version("develop", submodules=True, branch="develop")
version("0.2.0", tag="v0.2.0", commit="d443aeb19748bf17c264d1013c37bb466f6d0136", submodules=True)

variant("asan", default=False, description="Enable/Disable address sanitizer")
variant("enzyme", default=False, description="Enable/Disable Enzyme")
Expand All @@ -33,8 +34,10 @@ class Gridkit(CMakePackage):
depends_on("ipopt", when="+ipopt")
depends_on("resolve@gridkit-pinned+klu", when="+resolve+klu")
depends_on("resolve@gridkit-pinned~klu", when="+resolve~klu")
depends_on("sundials@7.8.0+klu~mpi", when="+sundials+klu")
depends_on("sundials@7.8.0~klu~mpi", when="+sundials~klu")
depends_on("sundials@7.8.0+klu~mpi", when="@0.2.0+sundials+klu")
depends_on("sundials@7.8.0~klu~mpi", when="@0.2.0+sundials~klu")
depends_on("sundials@7.8.0,partitioned-dae+klu~mpi", when="@develop+sundials+klu")
depends_on("sundials@7.8.0,partitioned-dae~klu~mpi", when="@develop+sundials~klu")

def cmake_args(self):
args = []
Expand Down
11 changes: 11 additions & 0 deletions buildsystem/spack_repo/gridkit/packages/sundials/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,14 @@
class Sundials(BuiltinSundials):
version("7.9.0", tag="v7.9.0", commit="312fc0f3684f27209ca9dc9249d194436eb41a7a")
version("7.8.0", tag="v7.8.0", commit="aedc088437064dd55b35c000145f7f5db6ee49e3")
version("partitioned-dae", branch="feature/partitioned-dae-stepper")

# The branch registers ark_partitioned_dae.c without its .out file, which breaks install.
# Remove once the branch includes examples/arkode/C_serial/ark_partitioned_dae.out.
@when("@partitioned-dae")
def patch(self):
filter_file(
r'^\s*"ark_partitioned_dae\.c\\;\\;develop"\s*$',
"",
join_path("examples", "arkode", "C_serial", "CMakeLists.txt"),
)
6 changes: 5 additions & 1 deletion tests/UnitTests/Solver/Dynamic/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,15 @@ if(TARGET SUNDIALS::idas)

add_test(NAME IDATest COMMAND $<TARGET_FILE:test_ida>)

install(TARGETS test_ida RUNTIME DESTINATION bin)
endif()

if(GRIDKIT_ENABLE_SUNDIALS_PARTITIONED_DAE)
add_executable(test_partitioned runPartitionedTests.cpp)
target_link_libraries(test_partitioned GridKit::solvers_dyn GridKit::testing)
add_test(NAME PartitionedTest COMMAND $<TARGET_FILE:test_partitioned>)

install(TARGETS test_ida test_partitioned RUNTIME DESTINATION bin)
install(TARGETS test_partitioned RUNTIME DESTINATION bin)
endif()

if(GRIDKIT_ENABLE_RESOLVE)
Expand Down
Loading