Apply hip workaround for raja-framework (#32469)

* add workaround for broken behavior in HIP

Hip has a longstanding cmake issue where they calculate include paths
incorrectly, this works around it for raja and adds an explicit rocprim
dependency.

* propagate openmp requirement and workaround to camp

* refactor and include umpire

* propagate openmp option to camp in umpire and use main camp for main and develop raja and umpire

* bump camp to new patch release
This commit is contained in:
Tom Scogland 2022-09-02 16:55:06 -07:00 committed by GitHub
parent 69f7a8f4d1
commit c25b7ea898
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 29 additions and 2 deletions

View file

@ -3,9 +3,19 @@
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
import glob
from spack.package import *
def hip_repair_options(options, spec):
# there is only one dir like this, but the version component is unknown
options.append(
"-DHIP_CLANG_INCLUDE_PATH="
+ glob.glob("{}/lib/clang/*/include".format(spec["llvm-amdgpu"].prefix))[0]
)
class Camp(CMakePackage, CudaPackage, ROCmPackage):
"""
Compiler agnostic metaprogramming library providing concepts,
@ -19,6 +29,7 @@ class Camp(CMakePackage, CudaPackage, ROCmPackage):
maintainers = ["trws"]
version("main", branch="main", submodules="True")
version("2022.03.2", sha256="bc4aaeacfe8f2912e28f7a36fc731ab9e481bee15f2c6daf0cb208eed3f201eb")
version("2022.03.0", sha256="e9090d5ee191ea3a8e36b47a8fe78f3ac95d51804f1d986d931e85b8f8dad721")
version("0.3.0", sha256="129431a049ca5825443038ad5a37a86ba6d09b2618d5fe65d35f83136575afdb")
version("0.2.3", sha256="58a0f3bd5eadb588d7dc83f3d050aff8c8db639fc89e8d6553f9ce34fc2421a7")
@ -27,6 +38,7 @@ class Camp(CMakePackage, CudaPackage, ROCmPackage):
# TODO: figure out gtest dependency and then set this default True.
variant("tests", default=False, description="Build tests")
variant("openmp", default=False, description="Build OpenMP support")
depends_on("cub", when="+cuda")
@ -39,6 +51,7 @@ def cmake_args(self):
options.append("-DBLT_SOURCE_DIR={0}".format(spec["blt"].prefix))
options.append("-DENABLE_OPENMP=" + ("On" if "+openmp" in spec else "Off"))
if "+cuda" in spec:
options.extend(
["-DENABLE_CUDA=ON", "-DCUDA_TOOLKIT_ROOT_DIR=%s" % (spec["cuda"].prefix)]
@ -55,6 +68,9 @@ def cmake_args(self):
if "+rocm" in spec:
options.extend(["-DENABLE_HIP=ON", "-DHIP_ROOT_DIR={0}".format(spec["hip"].prefix)])
hip_repair_options(options, spec)
archs = self.spec.variants["amdgpu_target"].value
if archs != "none":
arch_str = ",".join(archs)

View file

@ -6,6 +6,7 @@
import socket
from spack.package import *
from spack.pkg.builtin.camp import hip_repair_options
class Raja(CachedCMakePackage, CudaPackage, ROCmPackage):
@ -61,13 +62,17 @@ class Raja(CachedCMakePackage, CudaPackage, ROCmPackage):
depends_on("camp@0.2.2:0.2.3", when="@0.14.0")
depends_on("camp@0.1.0", when="@0.10.0:0.13.0")
depends_on("camp@2022.03.0:", when="@2022.03.0:")
depends_on("camp@2022.03.2:", when="@2022.03.0:")
depends_on("camp@main", when="@main")
depends_on("camp@main", when="@develop")
depends_on("camp+openmp", when="+openmp")
depends_on("cmake@:3.20", when="+rocm", type="build")
depends_on("cmake@3.14:", when="@2022.03.0:")
depends_on("llvm-openmp", when="+openmp %apple-clang")
depends_on("rocprim", when="+rocm")
with when("+rocm @0.12.0:"):
depends_on("camp+rocm")
for arch in ROCmPackage.amdgpu_targets:
@ -120,6 +125,7 @@ def initconfig_hardware_entries(self):
if "+rocm" in spec:
entries.append(cmake_cache_option("ENABLE_HIP", True))
entries.append(cmake_cache_path("HIP_ROOT_DIR", "{0}".format(spec["hip"].prefix)))
hip_repair_options(entries, spec)
archs = self.spec.variants["amdgpu_target"].value
if archs != "none":
arch_str = ",".join(archs)

View file

@ -9,6 +9,7 @@
import llnl.util.tty as tty
from spack.package import *
from spack.pkg.builtin.camp import hip_repair_options
class Umpire(CachedCMakePackage, CudaPackage, ROCmPackage):
@ -93,7 +94,10 @@ class Umpire(CachedCMakePackage, CudaPackage, ROCmPackage):
depends_on("camp", when="@5.0.0:")
depends_on("camp@0.2.2:0.2.3", when="@6.0.0")
depends_on("camp@0.1.0", when="@5.0.0:5.0.1")
depends_on("camp@2022.03.0:", when="@2022.03.0:")
depends_on("camp@2022.03.2:", when="@2022.03.0:")
depends_on("camp@main", when="@main")
depends_on("camp@main", when="@develop")
depends_on("camp+openmp", when="+openmp")
with when("@5.0.0:"):
with when("+cuda"):
@ -184,6 +188,7 @@ def initconfig_hardware_entries(self):
if "+rocm" in spec:
entries.append(cmake_cache_option("ENABLE_HIP", True))
entries.append(cmake_cache_path("HIP_ROOT_DIR", "{0}".format(spec["hip"].prefix)))
hip_repair_options(entries, spec)
archs = self.spec.variants["amdgpu_target"].value
if archs != "none":
arch_str = ",".join(archs)