diff --git a/var/spack/repos/builtin/packages/sundials/package.py b/var/spack/repos/builtin/packages/sundials/package.py index ce4ac7afef..7f7c6c0f1c 100644 --- a/var/spack/repos/builtin/packages/sundials/package.py +++ b/var/spack/repos/builtin/packages/sundials/package.py @@ -284,6 +284,10 @@ class Sundials(CMakePackage, CudaPackage, ROCmPackage): # ========================================================================== # Patches # ========================================================================== + # https://github.com/LLNL/sundials/pull/434 + # https://github.com/LLNL/sundials/pull/437 + patch("sundials-hip-platform.patch", when="@7.0.0 +rocm") + # https://github.com/spack/spack/issues/29526 patch("nvector-pic.patch", when="@6.1.0:6.2.0 +rocm") diff --git a/var/spack/repos/builtin/packages/sundials/sundials-hip-platform.patch b/var/spack/repos/builtin/packages/sundials/sundials-hip-platform.patch new file mode 100644 index 0000000000..c4092c9385 --- /dev/null +++ b/var/spack/repos/builtin/packages/sundials/sundials-hip-platform.patch @@ -0,0 +1,33 @@ +diff -ruN spack-src/cmake/SundialsSetupHIP.cmake spack-src-patched/cmake/SundialsSetupHIP.cmake +--- spack-src/cmake/SundialsSetupHIP.cmake 2024-02-29 22:47:30.000000000 +0000 ++++ spack-src-patched/cmake/SundialsSetupHIP.cmake 2024-06-07 15:22:57.920619263 +0000 +@@ -32,9 +32,9 @@ + + if(NOT DEFINED HIP_PLATFORM) + if(NOT DEFINED ENV{HIP_PLATFORM}) +- set(HIP_PLATFORM "hcc" CACHE STRING "HIP platform (hcc, nvcc)") ++ set(HIP_PLATFORM "amd" CACHE STRING "HIP platform (amd, nvidia)") + else() +- set(HIP_PLATFORM "$ENV{HIP_PLATFORM}" CACHE STRING "HIP platform (hcc, nvcc)") ++ set(HIP_PLATFORM "$ENV{HIP_PLATFORM}" CACHE STRING "HIP platform (amd, nvidia)") + endif() + endif() + +diff -ruN spack-src/include/sundials/sundials_hip_policies.hpp spack-src-patched/include/sundials/sundials_hip_policies.hpp +--- spack-src/include/sundials/sundials_hip_policies.hpp 2024-02-29 22:47:30.000000000 +0000 ++++ spack-src-patched/include/sundials/sundials_hip_policies.hpp 2024-06-07 15:23:15.752724851 +0000 +@@ -27,10 +27,12 @@ + namespace sundials { + namespace hip { + +-#if defined(__HIP_PLATFORM_HCC__) ++#if defined(__HIP_PLATFORM_HCC__) || defined(__HIP_PLATFORM_AMD__) + constexpr const sunindextype WARP_SIZE = 64; +-#elif defined(__HIP_PLATFORM_NVCC__) ++#elif defined(__HIP_PLATFORM_NVCC__) || defined(__HIP_PLATFORM_NVDIA__) + constexpr const sunindextype WARP_SIZE = 32; ++#else ++#error "Unknown HIP_PLATFORM, report to github.com/LLNL/sundials/issues" + #endif + constexpr const sunindextype MAX_BLOCK_SIZE = 1024; + constexpr const sunindextype MAX_WARPS = MAX_BLOCK_SIZE / WARP_SIZE;