-
Notifications
You must be signed in to change notification settings - Fork 114
Add CUDA 13 support #2011
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
Add CUDA 13 support #2011
Changes from 19 commits
7844b53
923dbc1
d1b8a89
e4e7db8
2522afe
9a7821b
dc6d9f4
2cebf15
f02c310
7490bf4
7c5465c
a1bf791
0396164
ab46365
8ab7ebe
fc0bee7
647c701
87d308a
6cce1f6
6740342
e8674eb
618c1e2
52b97b6
65ae965
e036025
a30c0fa
3d99495
43a6fa6
2277bb9
dcd35a3
951e058
bb9b6b8
3f39c6b
bb6ff01
e56d07b
590be37
7e76aaf
f6f8fa8
5edf7e6
81cb1b3
abcc770
6d96633
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| diff -ruN spack-src/include/camp/resource/hip.hpp spack-src-patched/include/camp/resource/hip.hpp | ||
| --- spack-src/include/camp/resource/hip.hpp 2021-08-20 23:38:39.000000000 +0000 | ||
| +++ spack-src-patched/include/camp/resource/hip.hpp 2024-06-06 21:34:25.174477941 +0000 | ||
| @@ -111,7 +111,11 @@ | ||
| hipPointerAttribute_t a; | ||
| hipError_t status = hipPointerGetAttributes(&a, p); | ||
| if (status == hipSuccess) { | ||
| +#if (HIP_VERSION_MAJOR >= 6) | ||
| + switch (a.type) { | ||
| +#else | ||
| switch (a.memoryType) { | ||
| +#endif | ||
| case hipMemoryTypeHost: | ||
| return MemoryAccess::Pinned; | ||
| case hipMemoryTypeDevice: |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| diff --git a/include/camp/resource.hpp b/include/camp/resource.hpp | ||
| index 58df206..763aa20 100644 | ||
| --- a/include/camp/resource.hpp | ||
| +++ b/include/camp/resource.hpp | ||
| @@ -12,6 +12,7 @@ http://github.com/llnl/camp | ||
| #define __CAMP_RESOURCE_HPP | ||
|
|
||
| #include <cstring> | ||
| +#include <stdexcept> | ||
| #include <memory> | ||
| #include <mutex> | ||
| #include <type_traits> | ||
| diff --git a/include/camp/resource/host.hpp b/include/camp/resource/host.hpp | ||
| index c765175..4428c57 100644 | ||
| --- a/include/camp/resource/host.hpp | ||
| +++ b/include/camp/resource/host.hpp | ||
| @@ -13,6 +13,7 @@ http://github.com/llnl/camp | ||
|
|
||
| #include "camp/resource/event.hpp" | ||
| #include "camp/resource/platform.hpp" | ||
| +#include <cstdlib> | ||
|
|
||
| namespace camp | ||
| { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for looking in to this, Steve! Should we just directly update Camp and release it, rather than patching it? Same question for BLT.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That camp patch is in the upstream spack-packages repo, it is there to support building older versions of camp (pre camp 2022.10). Local copy was done to get CI build system working until camp can be updated for CUDA. |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,161 @@ | ||
| # Copyright Spack Project Developers. See COPYRIGHT file for details. | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do you plan to have the camp package changes pushed up to the spack package repo?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, once CI tests are working PR for spack-packages / camp / BLT will be done. |
||
| # | ||
| # SPDX-License-Identifier: (Apache-2.0 OR MIT) | ||
|
|
||
| from spack_repo.builtin.build_systems.cached_cmake import cmake_cache_string | ||
| from spack_repo.builtin.build_systems.cmake import CMakePackage | ||
| from spack_repo.builtin.build_systems.cuda import CudaPackage | ||
| from spack_repo.builtin.build_systems.rocm import ROCmPackage | ||
|
|
||
| from spack.package import * | ||
|
|
||
|
|
||
| class Camp(CMakePackage, CudaPackage, ROCmPackage): | ||
| """ | ||
| Compiler agnostic metaprogramming library providing concepts, | ||
| type operations and tuples for C++ and cuda | ||
| """ | ||
|
|
||
| homepage = "https://github.com/LLNL/camp" | ||
| git = "https://github.com/LLNL/camp.git" | ||
| url = "https://github.com/LLNL/camp/archive/v0.1.0.tar.gz" | ||
|
|
||
| maintainers("adrienbernede", "kab163", "trws") | ||
|
|
||
| license("BSD-3-Clause") | ||
|
|
||
| version("main", branch="main", submodules=False) | ||
| version( | ||
| "2025.12.0", | ||
| # SGS Hacking for CUDA 13 testing; redirect CAMP to temporary version with | ||
| # CUDA 13 modifications. | ||
| branch="feature/smith84/cuda-13-support", | ||
| git = "https://github.com/smithsg84/camp.git", | ||
| submodules=False, | ||
| #tag="v2025.12.0", | ||
| #commit="a8caefa9f4c811b1a114b4ed2c9b681d40f12325", | ||
| #submodules=False, | ||
| ) | ||
| version( | ||
| "2025.09.2", | ||
| tag="v2025.09.2", | ||
| commit="4070ce93a802849d61037310a87c50cc24c9e498", | ||
| submodules=False, | ||
| ) | ||
| version( | ||
| "2025.09.0", | ||
| tag="v2025.09.0", | ||
| commit="b642f29b9d0eee9113bea2791958c29243063e5c", | ||
| submodules=False, | ||
| ) | ||
| version( | ||
| "2025.03.0", | ||
| tag="v2025.03.0", | ||
| commit="ee0a3069a7ae72da8bcea63c06260fad34901d43", | ||
| submodules=False, | ||
| ) | ||
| version( | ||
| "2024.07.0", | ||
| tag="v2024.07.0", | ||
| commit="0f07de4240c42e0b38a8d872a20440cb4b33d9f5", | ||
| submodules=False, | ||
| ) | ||
| version( | ||
| "2024.02.1", | ||
| tag="v2024.02.1", | ||
| commit="79c320fa09db987923b56884afdc9f82f4b70fc4", | ||
| submodules=False, | ||
| ) | ||
| version( | ||
| "2024.02.0", | ||
| tag="v2024.02.0", | ||
| commit="03c80a6c6ab4f97e76a52639563daec71435a277", | ||
| submodules=False, | ||
| ) | ||
| version( | ||
| "2023.06.0", | ||
| tag="v2023.06.0", | ||
| commit="ac34c25b722a06b138bc045d38bfa5e8fa3ec9c5", | ||
| submodules=False, | ||
| ) | ||
| version("2022.10.1", sha256="2d12f1a46f5a6d01880fc075cfbd332e2cf296816a7c1aa12d4ee5644d386f02") | ||
| version("2022.10.0", sha256="3561c3ef00bbcb61fe3183c53d49b110e54910f47e7fc689ad9ccce57e55d6b8") | ||
| version("2022.03.2", sha256="bc4aaeacfe8f2912e28f7a36fc731ab9e481bee15f2c6daf0cb208eed3f201eb") | ||
| version("2022.03.0", sha256="e9090d5ee191ea3a8e36b47a8fe78f3ac95d51804f1d986d931e85b8f8dad721") | ||
| version("0.3.0", sha256="129431a049ca5825443038ad5a37a86ba6d09b2618d5fe65d35f83136575afdb") | ||
| version("0.2.3", sha256="58a0f3bd5eadb588d7dc83f3d050aff8c8db639fc89e8d6553f9ce34fc2421a7") | ||
| version("0.2.2", sha256="194d38b57e50e3494482a7f94940b27f37a2bee8291f2574d64db342b981d819") | ||
| version("0.1.0", sha256="fd4f0f2a60b82a12a1d9f943f8893dc6fe770db493f8fae5ef6f7d0c439bebcc") | ||
|
|
||
| # TODO: figure out gtest dependency and then set this default True. | ||
| variant("tests", default=False, description="Build tests") | ||
| variant("openmp", default=False, description="Build with OpenMP support") | ||
| variant("omptarget", default=False, description="Build with OpenMP Target support") | ||
| variant("sycl", default=False, description="Build with Sycl support") | ||
|
|
||
| depends_on("c", type="build") | ||
| depends_on("cxx", type="build") | ||
|
|
||
| with when("+cuda"): | ||
| depends_on("cub", when="^cuda@:10") | ||
|
|
||
| depends_on("blt", type="build") | ||
| depends_on("blt@0.7.1:", type="build", when="@2025.09.0:") | ||
| depends_on("blt@0.7.0:", type="build", when="@2025.03.0:") | ||
| depends_on("blt@0.6.2:", type="build", when="@2024.02.1:") | ||
| depends_on("blt@0.6.1", type="build", when="@2024.02.0") | ||
| depends_on("blt@0.5.0:0.5.3", type="build", when="@2022.03.0:2023.06.0") | ||
|
|
||
| patch("libstdc++-13-missing-header.patch", when="@:2022.10") | ||
|
|
||
| patch("camp-rocm6.patch", when="@0.2.3 +rocm ^hip@6:") | ||
|
|
||
| conflicts("^blt@:0.3.6", when="+rocm") | ||
|
|
||
| conflicts("+omptarget +rocm") | ||
| conflicts("+sycl +omptarget") | ||
| conflicts("+sycl +rocm") | ||
| conflicts( | ||
| "+sycl", | ||
| when="@:2024.02.99", | ||
| msg="Support for SYCL was introduced in RAJA after 2024.02 release, " | ||
| "please use a newer release.", | ||
| ) | ||
|
|
||
| def cmake_args(self): | ||
| spec = self.spec | ||
|
|
||
| options = [] | ||
|
|
||
| options.append("-DBLT_SOURCE_DIR={0}".format(spec["blt"].prefix)) | ||
|
|
||
| options.append(self.define_from_variant("ENABLE_CUDA", "cuda")) | ||
| if spec.satisfies("+cuda"): | ||
| options.append("-DCUDA_TOOLKIT_ROOT_DIR={0}".format(spec["cuda"].prefix)) | ||
|
|
||
| if not spec.satisfies("cuda_arch=none"): | ||
| cuda_arch = spec.variants["cuda_arch"].value | ||
| options.append("-DCMAKE_CUDA_ARCHITECTURES={0}".format(cuda_arch[0])) | ||
| options.append("-DCUDA_ARCH=sm_{0}".format(cuda_arch[0])) | ||
| flag = "-arch sm_{0}".format(cuda_arch[0]) | ||
| options.append("-DCMAKE_CUDA_FLAGS:STRING={0}".format(flag)) | ||
|
|
||
| options.append(self.define_from_variant("ENABLE_HIP", "rocm")) | ||
| if spec.satisfies("+rocm"): | ||
| rocm_root = spec["llvm-amdgpu"].prefix | ||
| options.append(self.define("ROCM_PATH", rocm_root)) | ||
|
|
||
| archs = ";".join(self.spec.variants["amdgpu_target"].value) | ||
| options.append("-DCMAKE_HIP_ARCHITECTURES={0}".format(archs)) | ||
| options.append("-DGPU_TARGETS={0}".format(archs)) | ||
| options.append("-DAMDGPU_TARGETS={0}".format(archs)) | ||
|
|
||
| if spec.satisfies("+omptarget"): | ||
| options.append(cmake_cache_string("RAJA_DATA_ALIGN", 64)) | ||
|
|
||
| options.append(self.define_from_variant("ENABLE_TESTS", "tests")) | ||
| options.append(self.define_from_variant("ENABLE_OPENMP", "openmp")) | ||
| options.append(self.define_from_variant("CAMP_ENABLE_TARGET_OPENMP", "omptarget")) | ||
| options.append(self.define_from_variant("ENABLE_SYCL", "sycl")) | ||
|
|
||
| return options | ||
Uh oh!
There was an error while loading. Please reload this page.