Skip to content

Commit

Permalink
fix hip tests and bump hip-examples to 5.6.1 (spack#40928)
Browse files Browse the repository at this point in the history
* Initial commit to fix hip tests and bump hip-examples to 5.6.1
* fix styling
* add installation of hip samples to share folder
  • Loading branch information
afzpatel authored Nov 28, 2023
1 parent b719c90 commit 1ebd37d
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 8 deletions.
12 changes: 8 additions & 4 deletions var/spack/repos/builtin/packages/hip-examples/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
18 changes: 14 additions & 4 deletions var/spack/repos/builtin/packages/hip/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -709,23 +709,33 @@ 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
install test subdirectory for use during `spack test run`."""
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,
Expand Down

0 comments on commit 1ebd37d

Please sign in to comment.