Skip to content

Commit 7aad8b3

Browse files
authored
Merge pull request #2766 from devitocodes/rocm7
arch: support rocm7
2 parents 20da795 + 8c3f17d commit 7aad8b3

File tree

4 files changed

+30
-9
lines changed

4 files changed

+30
-9
lines changed

.github/workflows/docker-bases.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,5 +246,5 @@ jobs:
246246
push: true
247247
target: "hip"
248248
build-args: |
249-
ROCM_VERSION=6.3.4
249+
ROCM_VERSION=7.0.2
250250
tags: devitocodes/bases:amd-hip

devito/arch/compiler.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -760,6 +760,7 @@ class HipCompiler(Compiler):
760760
_default_cpp = True
761761

762762
def __init_finalize__(self, **kwargs):
763+
self.cflags.append('-Wno-unused-result')
763764

764765
if configuration['mpi']:
765766
# We rather use `hipcc` to compile MPI, but for this we have to
@@ -773,6 +774,23 @@ def __init_finalize__(self, **kwargs):
773774

774775
self.src_ext = 'cpp'
775776

777+
@property
778+
def version(self):
779+
try:
780+
res = run(['hipconfig', "--version"], stdout=PIPE, stderr=DEVNULL)
781+
ver = res.stdout.decode("utf-8").split('-')[0]
782+
ver = Version(ver)
783+
except (UnicodeDecodeError, OSError):
784+
ver = Version("0")
785+
return ver
786+
787+
@property
788+
def _cxxstd(self):
789+
if self.version >= Version("7.0.0"):
790+
return 'c++17'
791+
else:
792+
return 'c++14'
793+
776794
def __lookup_cmds__(self):
777795
self.CC = 'hipcc'
778796
self.CXX = 'hipcc'

devito/ir/cgen/printer.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,9 @@ def prec_literal(self, expr):
9292
def func_literal(self, expr):
9393
return self._func_literals.get(self._prec(expr), '')
9494

95+
def ns(self, expr):
96+
return self._ns
97+
9598
def func_prefix(self, expr, mfunc=False):
9699
prefix = self._func_prefix.get(self._prec(expr), '')
97100
if mfunc:
@@ -193,7 +196,7 @@ def _print_math_func(self, expr, nest=False, known=None):
193196
else:
194197
args = ', '.join([self._print(arg) for arg in expr.args])
195198

196-
return f'{self._ns}{cname}({args})'
199+
return f'{self.ns(expr)}{cname}({args})'
197200

198201
def _print_Pow(self, expr):
199202
# Completely reimplement `_print_Pow` from sympy, since it doesn't
@@ -207,11 +210,11 @@ def _print_Pow(self, expr):
207210
return self._print_Float(Float(1.0)) + '/' + \
208211
self.parenthesize(expr.base, PREC)
209212
elif equal_valued(expr.exp, 0.5):
210-
return f'{self._ns}sqrt{suffix}({base})'
213+
return f'{self.ns(expr)}sqrt{suffix}({base})'
211214
elif expr.exp == S.One/3 and self.standard != 'C89':
212-
return f'{self._ns}cbrt{suffix}({base})'
215+
return f'{self.ns(expr)}cbrt{suffix}({base})'
213216
else:
214-
return f'{self._ns}pow{suffix}({base}, {self._print(expr.exp)})'
217+
return f'{self.ns(expr)}pow{suffix}({base}, {self._print(expr.exp)})'
215218

216219
def _print_SafeInv(self, expr):
217220
"""Print a SafeInv as a C-like division with a check for zero."""
@@ -241,7 +244,7 @@ def _print_Mul(self, expr):
241244
def _print_fmath_func(self, name, expr):
242245
args = ",".join([self._print(i) for i in expr.args])
243246
func = f'{self.func_prefix(expr, mfunc=True)}{name}{self.func_literal(expr)}'
244-
return f"{self._ns}{func}({args})"
247+
return f"{self.ns(expr)}{func}({args})"
245248

246249
def _print_Min(self, expr):
247250
if len(expr.args) > 2:
@@ -391,7 +394,7 @@ def _print_SizeOf(self, expr):
391394
return f'sizeof({self._print(expr.intype)}{self._print(expr.stars)})'
392395

393396
def _print_MathFunction(self, expr):
394-
return f"{self._ns}{self._print_DefFunction(expr)}"
397+
return f"{self.ns(expr)}{self._print_DefFunction(expr)}"
395398

396399
def _print_Fallback(self, expr):
397400
return expr.__str__()

docker/Dockerfile.amd

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
# Based on https://github.com/amd/InfinityHub-CI/tree/main/base-gpu-mpi-rocm-docker
44
##############################################################
55

6-
ARG ROCM_VERSION=6.3.2
6+
ARG ROCM_VERSION=7.0.2
77

88
FROM rocm/dev-ubuntu-22.04:${ROCM_VERSION}-complete AS sdk-base
99

10-
ARG UCX_BRANCH="v1.16.0"
10+
ARG UCX_BRANCH="v1.17.x"
1111
ARG OMPI_BRANCH="v5.0.x"
1212

1313
# Update and Install basic Linux development tools

0 commit comments

Comments
 (0)