enabling test for rccl hsakmt-roct and rocm-opencl (#35465)
* initial commit for enabling test for rccl hsakmt-roct and rocm-opencl * fix styling and cleaning code * adding missing imports and minor fixes * minor style fix * moidfying hsakmt-roct test to run right after installation
This commit is contained in:
parent
bf970ebf9d
commit
134b954c7f
@ -4,6 +4,8 @@
|
|||||||
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
||||||
|
|
||||||
|
|
||||||
|
import os
|
||||||
|
|
||||||
from spack.package import *
|
from spack.package import *
|
||||||
|
|
||||||
|
|
||||||
@ -113,6 +115,7 @@ class HsakmtRoct(CMakePackage):
|
|||||||
depends_on("cmake@3:", type="build")
|
depends_on("cmake@3:", type="build")
|
||||||
depends_on("numactl")
|
depends_on("numactl")
|
||||||
depends_on("libdrm", when="@4.5.0:")
|
depends_on("libdrm", when="@4.5.0:")
|
||||||
|
depends_on("llvm-amdgpu", type="test", when="@5.3.0:")
|
||||||
|
|
||||||
# See https://github.com/RadeonOpenCompute/ROCT-Thunk-Interface/issues/72
|
# See https://github.com/RadeonOpenCompute/ROCT-Thunk-Interface/issues/72
|
||||||
# and https://github.com/spack/spack/issues/28398
|
# and https://github.com/spack/spack/issues/28398
|
||||||
@ -128,3 +131,36 @@ def install_targets(self):
|
|||||||
|
|
||||||
def cmake_args(self):
|
def cmake_args(self):
|
||||||
return [self.define_from_variant("BUILD_SHARED_LIBS", "shared")]
|
return [self.define_from_variant("BUILD_SHARED_LIBS", "shared")]
|
||||||
|
|
||||||
|
@run_after("install")
|
||||||
|
@on_package_attributes(run_tests=True)
|
||||||
|
def check_install(self):
|
||||||
|
if self.spec.satisfies("@:5.3.0"):
|
||||||
|
print("Skipping: stand-alone tests")
|
||||||
|
return
|
||||||
|
test_dir = "tests/kfdtest"
|
||||||
|
with working_dir(test_dir, create=True):
|
||||||
|
cmake_bin = join_path(self.spec["cmake"].prefix.bin, "cmake")
|
||||||
|
prefixes = ";".join(
|
||||||
|
[
|
||||||
|
self.spec["libdrm"].prefix,
|
||||||
|
self.spec["hsakmt-roct"].prefix,
|
||||||
|
self.spec["numactl"].prefix,
|
||||||
|
self.spec["pkgconfig"].prefix,
|
||||||
|
self.spec["llvm-amdgpu"].prefix,
|
||||||
|
self.spec["zlib"].prefix,
|
||||||
|
self.spec["ncurses"].prefix,
|
||||||
|
]
|
||||||
|
)
|
||||||
|
hsakmt_path = ";".join([self.spec["hsakmt-roct"].prefix])
|
||||||
|
cc_options = [
|
||||||
|
"-DCMAKE_PREFIX_PATH=" + prefixes,
|
||||||
|
"-DLIBHSAKMT_PATH=" + hsakmt_path,
|
||||||
|
".",
|
||||||
|
]
|
||||||
|
self.run_test(cmake_bin, cc_options)
|
||||||
|
make()
|
||||||
|
os.environ["LD_LIBRARY_PATH"] = hsakmt_path
|
||||||
|
os.environ["BIN_DIR"] = os.getcwd()
|
||||||
|
self.run_test("scripts/run_kfdtest.sh")
|
||||||
|
make("clean")
|
||||||
|
@ -188,6 +188,7 @@ class Rccl(CMakePackage):
|
|||||||
"5.4.3",
|
"5.4.3",
|
||||||
]:
|
]:
|
||||||
depends_on("rocm-smi-lib@" + ver, when="@" + ver)
|
depends_on("rocm-smi-lib@" + ver, when="@" + ver)
|
||||||
|
depends_on("chrpath", when="@5.3.0:")
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def determine_version(cls, lib):
|
def determine_version(cls, lib):
|
||||||
@ -216,4 +217,14 @@ def cmake_args(self):
|
|||||||
|
|
||||||
if self.spec.satisfies("@4.5.0:"):
|
if self.spec.satisfies("@4.5.0:"):
|
||||||
args.append(self.define("ROCM_SMI_DIR", self.spec["rocm-smi-lib"].prefix))
|
args.append(self.define("ROCM_SMI_DIR", self.spec["rocm-smi-lib"].prefix))
|
||||||
|
if self.spec.satisfies("@5.3.0:"):
|
||||||
|
args.append(self.define("BUILD_TESTS", "ON"))
|
||||||
return args
|
return args
|
||||||
|
|
||||||
|
def test(self):
|
||||||
|
if self.spec.satisfies("@:5.3.0"):
|
||||||
|
print("Skipping: stand-alone tests")
|
||||||
|
return
|
||||||
|
test_dir = join_path(self.spec["rccl"].prefix, "bin")
|
||||||
|
with working_dir(test_dir, create=True):
|
||||||
|
self.run_test("UnitTests")
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
#
|
#
|
||||||
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
||||||
|
|
||||||
|
import os
|
||||||
import re
|
import re
|
||||||
|
|
||||||
from spack.package import *
|
from spack.package import *
|
||||||
@ -229,7 +230,7 @@ def flag_handler(self, name, flags):
|
|||||||
return (flags, None, None)
|
return (flags, None, None)
|
||||||
|
|
||||||
def cmake_args(self):
|
def cmake_args(self):
|
||||||
args = ["-DUSE_COMGR_LIBRARY=yes"]
|
args = ["-DUSE_COMGR_LIBRARY=yes", "-DBUILD_TESTS=ON"]
|
||||||
if self.spec.satisfies("@:4.3.0"):
|
if self.spec.satisfies("@:4.3.0"):
|
||||||
"-DROCclr_DIR={0}".format(self.spec["hip-rocclr"].prefix),
|
"-DROCclr_DIR={0}".format(self.spec["hip-rocclr"].prefix),
|
||||||
"-DLIBROCclr_STATIC_DIR={0}/lib".format
|
"-DLIBROCclr_STATIC_DIR={0}/lib".format
|
||||||
@ -251,3 +252,14 @@ def post_install(self):
|
|||||||
config_file_name = "amdocl64_30800.icd"
|
config_file_name = "amdocl64_30800.icd"
|
||||||
with open(join_path(vendor_config_path, config_file_name), "w") as f:
|
with open(join_path(vendor_config_path, config_file_name), "w") as f:
|
||||||
f.write("libamdocl64.so")
|
f.write("libamdocl64.so")
|
||||||
|
|
||||||
|
test_src_dir = "tests/ocltst"
|
||||||
|
|
||||||
|
def test(self):
|
||||||
|
test_dir = join_path(self.spec["rocm-opencl"].prefix, self.test_src_dir)
|
||||||
|
with working_dir(test_dir, create=True):
|
||||||
|
os.environ["LD_LIBRARY_PATH"] += os.pathsep + test_dir
|
||||||
|
args = ["-m", "liboclruntime.so", "-A", "oclruntime.exclude"]
|
||||||
|
self.run_test("ocltst", args)
|
||||||
|
args = ["-m", "liboclperf.so", "-A", "oclperf.exclude"]
|
||||||
|
self.run_test("ocltst", args)
|
||||||
|
Loading…
Reference in New Issue
Block a user