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
This commit is contained in:
afzpatel 2023-11-28 15:17:10 -05:00 committed by GitHub
parent b719c905f1
commit 1ebd37d20c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 22 additions and 8 deletions

View File

@ -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()

View File

@ -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,