From 183ad26bbaa35accd1bef2e6c5164e5ed0fb45c8 Mon Sep 17 00:00:00 2001 From: "Balos, Cody, J" Date: Thu, 8 Feb 2024 12:08:45 -0800 Subject: [PATCH] build with sundials v7 --- Src/Extern/SUNDIALS/AMReX_SUNMemory.cpp | 3 ++- Src/Extern/SUNDIALS/AMReX_Sundials_Core.H | 2 +- Tools/CMake/AMReXThirdPartyLibraries.cmake | 12 +++++++++--- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/Src/Extern/SUNDIALS/AMReX_SUNMemory.cpp b/Src/Extern/SUNDIALS/AMReX_SUNMemory.cpp index 285cdb2f17b..5651feefc87 100644 --- a/Src/Extern/SUNDIALS/AMReX_SUNMemory.cpp +++ b/Src/Extern/SUNDIALS/AMReX_SUNMemory.cpp @@ -1,3 +1,4 @@ +#include "AMReX_Sundials_Core.H" #include #include #include @@ -35,7 +36,7 @@ namespace { int Alloc(SUNMemoryHelper, SUNMemory* memptr, size_t memsize, SUNMemoryType mem_type, void* /*queue*/) { - SUNMemory mem = SUNMemoryNewEmpty(); + SUNMemory mem = SUNMemoryNewEmpty(*The_Sundials_Context()); if (mem == nullptr) { return -1; } mem->ptr = nullptr; diff --git a/Src/Extern/SUNDIALS/AMReX_Sundials_Core.H b/Src/Extern/SUNDIALS/AMReX_Sundials_Core.H index 090a5f43534..4f352501df9 100644 --- a/Src/Extern/SUNDIALS/AMReX_Sundials_Core.H +++ b/Src/Extern/SUNDIALS/AMReX_Sundials_Core.H @@ -3,7 +3,7 @@ #include #include -#include +#include namespace amrex::sundials { diff --git a/Tools/CMake/AMReXThirdPartyLibraries.cmake b/Tools/CMake/AMReXThirdPartyLibraries.cmake index 09239c75367..f1da1658cdb 100644 --- a/Tools/CMake/AMReXThirdPartyLibraries.cmake +++ b/Tools/CMake/AMReXThirdPartyLibraries.cmake @@ -140,12 +140,18 @@ endif () # if (AMReX_SUNDIALS) if (SUNDIALS_FOUND) - message(STATUS "SUNDIALS_FOUND is true, assuming nvecserial or gpu-specific vector found for version 6.0.0 or higher") + message(STATUS "SUNDIALS_FOUND is true, assuming nvecserial or gpu-specific vector found for version 7.0.0 or higher") else () - set(SUNDIALS_MINIMUM_VERSION 6.0.0 CACHE INTERNAL "Minimum required SUNDIALS version") - find_package(SUNDIALS ${SUNDIALS_MINIMUM_VERSION} CONFIG QUIET ) + set(SUNDIALS_MINIMUM_VERSION 7.0.0 CACHE INTERNAL "Minimum required SUNDIALS version") + set(SUNDIALS_COMPONENTS core arkode cvode sunlinsolspgmr sunlinsolspfgmr + nvecserial nvecmanyvector sunnonlinsolfixedpoint) + find_package(SUNDIALS ${SUNDIALS_MINIMUM_VERSION} CONFIG REQUIRED + COMPONENTS ${SUNDIALS_COMPONENTS}) endif () foreach(D IN LISTS AMReX_SPACEDIM) + foreach(comp IN LISTS SUNDIALS_COMPONENTS) + target_link_libraries(amrex_${D}d PUBLIC SUNDIALS::${comp}) + endforeach() if (AMReX_GPU_BACKEND STREQUAL "CUDA") target_link_libraries(amrex_${D}d PUBLIC SUNDIALS::nveccuda) elseif (AMReX_GPU_BACKEND STREQUAL "HIP")