hipsycl: update package (#42518)

This commit is contained in:
Thomas-Ulrich 2024-02-19 14:34:05 +01:00 committed by GitHub
parent a0e80b23b9
commit abe617c4ea
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -26,6 +26,8 @@ class Hipsycl(CMakePackage):
license("BSD-2-Clause") license("BSD-2-Clause")
version("stable", branch="stable", submodules=True) version("stable", branch="stable", submodules=True)
version("23.10.0", commit="3952b468c9da89edad9dff953cdcab0a3c3bf78c", submodules=True)
version("0.9.4", commit="99d9e24d462b35e815e0e59c1b611936c70464ae", submodules=True)
version("0.9.4", commit="99d9e24d462b35e815e0e59c1b611936c70464ae", submodules=True) version("0.9.4", commit="99d9e24d462b35e815e0e59c1b611936c70464ae", submodules=True)
version("0.9.3", commit="51507bad524c33afe8b124804091b10fa25618dc", submodules=True) version("0.9.3", commit="51507bad524c33afe8b124804091b10fa25618dc", submodules=True)
version("0.9.2", commit="49fd02499841ae884c61c738610e58c27ab51fdb", submodules=True) version("0.9.2", commit="49fd02499841ae884c61c738610e58c27ab51fdb", submodules=True)
@ -120,42 +122,65 @@ def cmake_args(self):
@run_after("install") @run_after("install")
def filter_config_file(self): def filter_config_file(self):
config_file_paths = filesystem.find(self.prefix, "syclcc.json") def edit_config(filename, editor):
if len(config_file_paths) != 1: config_file_paths = filesystem.find(self.prefix, filename)
raise InstallError( if len(config_file_paths) != 1:
"installed hipSYCL must provide a unique compiler driver " raise InstallError(
"configuration file, found: {0}".format(config_file_paths) "installed hipSYCL must provide a unique compiler driver"
"configuration file ({0}), found: {1}".format(filename, config_file_paths)
)
config_file_path = config_file_paths[0]
with open(config_file_path) as f:
config = json.load(f)
config_modified = editor(config)
with open(config_file_path, "w") as f:
json.dump(config_modified, f, indent=2)
if self.spec.satisfies("@:23.10.0"):
configfiles = {"core": "syclcc.json", "cuda": "syclcc.json"}
else:
configfiles = {"core": "acpp-core.json", "cuda": "acpp-cuda.json"}
def adjust_core_config(config):
config["default-cpu-cxx"] = self.compiler.cxx
return config
edit_config(configfiles["core"], adjust_core_config)
if self.spec.satisfies("+cuda"):
# 1. Fix compiler: use the real one in place of the Spack wrapper
# 2. Fix stdlib: we need to make sure cuda-enabled binaries find
# the libc++.so and libc++abi.so dyn linked to the sycl
# ptx backend
rpaths = set()
so_paths = filesystem.find_libraries(
"libc++", self.spec["llvm"].prefix, shared=True, recursive=True
) )
config_file_path = config_file_paths[0] if len(so_paths) != 1:
with open(config_file_path) as f: raise InstallError(
config = json.load(f) "concretized llvm dependency must provide a "
# 1. Fix compiler: use the real one in place of the Spack wrapper "unique directory containing libc++.so, "
config["default-cpu-cxx"] = self.compiler.cxx "found: {0}".format(so_paths)
# 2. Fix stdlib: we need to make sure cuda-enabled binaries find )
# the libc++.so and libc++abi.so dyn linked to the sycl rpaths.add(path.dirname(so_paths[0]))
# ptx backend so_paths = filesystem.find_libraries(
rpaths = set() "libc++abi", self.spec["llvm"].prefix, shared=True, recursive=True
so_paths = filesystem.find_libraries(
"libc++", self.spec["llvm"].prefix, shared=True, recursive=True
)
if len(so_paths) != 1:
raise InstallError(
"concretized llvm dependency must provide a "
"unique directory containing libc++.so, "
"found: {0}".format(so_paths)
) )
rpaths.add(path.dirname(so_paths[0])) if len(so_paths) != 1:
so_paths = filesystem.find_libraries( raise InstallError(
"libc++abi", self.spec["llvm"].prefix, shared=True, recursive=True "concretized llvm dependency must provide a "
) "unique directory containing libc++abi, "
if len(so_paths) != 1: "found: {0}".format(so_paths)
raise InstallError( )
"concretized llvm dependency must provide a " rpaths.add(path.dirname(so_paths[0]))
"unique directory containing libc++abi, "
"found: {0}".format(so_paths) def adjust_cuda_config(config):
) config["default-cuda-link-line"] += " " + " ".join(
rpaths.add(path.dirname(so_paths[0])) "-rpath {0}".format(p) for p in rpaths
config["default-cuda-link-line"] += " " + " ".join("-rpath {0}".format(p) for p in rpaths) )
# Replace the installed config file return config
with open(config_file_path, "w") as f:
json.dump(config, f, indent=2) edit_config(configfiles["cuda"], adjust_cuda_config)