From 1ebd37d20cc90f8c9ce12049b8c434114c12c06f Mon Sep 17 00:00:00 2001 From: afzpatel <122491982+afzpatel@users.noreply.github.com> Date: Tue, 28 Nov 2023 15:17:10 -0500 Subject: [PATCH] fix hip tests and bump hip-examples to 5.6.1 (#40928) * Initial commit to fix hip tests and bump hip-examples to 5.6.1 * fix styling * add installation of hip samples to share folder --- .../builtin/packages/hip-examples/package.py | 12 ++++++++---- .../repos/builtin/packages/hip/package.py | 18 ++++++++++++++---- 2 files changed, 22 insertions(+), 8 deletions(-) diff --git a/var/spack/repos/builtin/packages/hip-examples/package.py b/var/spack/repos/builtin/packages/hip-examples/package.py index c625d0fe4b76c2..f3d3aed50cd86c 100644 --- a/var/spack/repos/builtin/packages/hip-examples/package.py +++ b/var/spack/repos/builtin/packages/hip-examples/package.py @@ -18,14 +18,18 @@ class HipExamples(Package): maintainers("srekolam", "renjithravindrankannath", "afzpatel") - version("master", branch="master") - + version("5.6.1", sha256="c1b5d30e387f869fae21170790ea3d604f7f0dba7771a9c096d9a5c2351dd001") + version("5.6.0", sha256="b751a0cac938248f7ea0fbeaa9df35688357b54ddd13359e2842a770b7923dfe") + version("5.5.1", sha256="c8522ef3f0804c85eef7e9efe2671f375b0d7f2100de85f55dcc2401efed6389") + version("5.5.0", sha256="bea8a4155bbfbdb3bc1f83c22e4bd1214b1b4e1840b58dc7d37704620de5b103") version("5.4.3", sha256="053b8b7892e2929e3f90bd978d8bb1c9801e4803eadd7d97fc6692ce60af1d47") patch("0001-add-inc-and-lib-paths-to-openmp-helloworld.patch") patch("0002-add-fpic-compile-to-add4.patch") - depends_on("hip") - depends_on("rocm-openmp-extras") + + for ver in ["5.6.1", "5.6.0", "5.5.1", "5.5.0", "5.4.3"]: + depends_on("hip@" + ver, when="@" + ver) + depends_on("rocm-openmp-extras@" + ver, when="@" + ver) def install(self, spec, prefix): stage = os.getcwd() diff --git a/var/spack/repos/builtin/packages/hip/package.py b/var/spack/repos/builtin/packages/hip/package.py index 1200cfdd2cb72d..a34805eb6757ea 100644 --- a/var/spack/repos/builtin/packages/hip/package.py +++ b/var/spack/repos/builtin/packages/hip/package.py @@ -709,6 +709,14 @@ def cmake_args(self): args.append(self.define("CLR_BUILD_OCL", False)), return args + test_src_dir_old = "samples" + test_src_dir = "hip-tests/samples" + + @run_after("install") + def install_samples(self): + if self.spec.satisfies("@5.6.0:"): + install_tree(self.test_src_dir, self.spec.prefix.share.samples) + @run_after("install") def cache_test_sources(self): """Copy the tests source files after the package is installed to an @@ -716,16 +724,18 @@ def cache_test_sources(self): if self.spec.satisfies("@:5.1.0"): return elif self.spec.satisfies("@5.1:5.5"): - self.test_src_dir = "samples" + self.cache_extra_test_sources([self.test_src_dir_old]) elif self.spec.satisfies("@5.6:"): - self.test_src_dir = "hip-tests/samples" - self.cache_extra_test_sources([self.test_src_dir]) + self.cache_extra_test_sources([self.test_src_dir]) def test_samples(self): # configure, build and run all hip samples if self.spec.satisfies("@:5.1.0"): raise SkipTest("Test is only available for specs after version 5.1.0") - test_dir = join_path(self.test_suite.current_test_cache_dir, self.test_src_dir) + elif self.spec.satisfies("@5.1:5.5"): + test_dir = join_path(self.test_suite.current_test_cache_dir, self.test_src_dir_old) + elif self.spec.satisfies("@5.6:"): + test_dir = join_path(self.test_suite.current_test_cache_dir, self.test_src_dir) prefixes = ";".join( [ self.spec["hip"].prefix,