Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 18 additions & 2 deletions repos/spack_repo/builtin/packages/petsc/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -397,6 +397,20 @@ class Petsc(Package, CudaPackage, ROCmPackage):

phases = ["configure", "build", "install"]

def patch(self):
# ROCm 7.x with minor < 4 (e.g. 7.2) incorrectly falls through to the
# ROCm 6.0-6.3 branch due to a broken version comparison in HIP.py.
# The condition `version_tuple[0] >= 6 and version_tuple[1] >= 4` was
# intended to mean >= 6.4 but fails for 7.2 since 2 < 4.
# Fix: use tuple comparison so (7,2) >= (6,4) evaluates correctly.
if "+rocm" in self.spec:
filter_file(
"if self.version_tuple[0] >= 6 and self.version_tuple[1] >= 4:",
"if (self.version_tuple[0], self.version_tuple[1]) >= (6, 4):",
"config/BuildSystem/config/packages/HIP.py",
string=True,
)

# Using the following tarballs
# * petsc-3.12 (and older) - includes docs
# * petsc-lite-3.13, petsc-lite-3.14 (without docs)
Expand Down Expand Up @@ -636,8 +650,10 @@ def configure_options(self):
hip_inc += spec[pkg].headers.include_flags + " "
for pkg in hip_lpkgs:
hip_lib += spec[pkg].libs.joined() + " "
options.append("HIPPPFLAGS=%s" % hip_inc)
options.append("--with-hip-lib=%s -L%s -lamdhip64" % (hip_lib, spec["hip"].prefix.lib))
options.append("HIPPPFLAGS=%s -Wno-unused-command-line-argument" % hip_inc)
options.append(
"--with-hip-lib=%s -L%s -lamdhip64" % (hip_lib.strip(), spec["hip"].prefix.lib)
)
else:
options.append("--with-hipc=0")

Expand Down
Loading