Skip to content
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion .github/workflows/docker-bases.yml
Original file line number Diff line number Diff line change
Expand Up @@ -246,5 +246,5 @@ jobs:
push: true
target: "hip"
build-args: |
ROCM_VERSION=6.3.4
ROCM_VERSION=7.0.2
tags: devitocodes/bases:amd-hip
18 changes: 18 additions & 0 deletions devito/arch/compiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -760,6 +760,7 @@ class HipCompiler(Compiler):
_default_cpp = True

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

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

self.src_ext = 'cpp'

@property
def version(self):
try:
res = run(['hipconfig', "--version"], stdout=PIPE, stderr=DEVNULL)
ver = res.stdout.decode("utf-8").split('-')[0]
ver = Version(ver)
except (UnicodeDecodeError, OSError):
ver = Version("0")
return ver

@property
def _cxxstd(self):
if self.version >= Version("7.0.0"):
return 'c++17'
else:
return 'c++14'

def __lookup_cmds__(self):
self.CC = 'hipcc'
self.CXX = 'hipcc'
Expand Down
15 changes: 9 additions & 6 deletions devito/ir/cgen/printer.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,9 @@ def prec_literal(self, expr):
def func_literal(self, expr):
return self._func_literals.get(self._prec(expr), '')

def ns(self, expr):
return self._ns

def func_prefix(self, expr, mfunc=False):
prefix = self._func_prefix.get(self._prec(expr), '')
if mfunc:
Expand Down Expand Up @@ -193,7 +196,7 @@ def _print_math_func(self, expr, nest=False, known=None):
else:
args = ', '.join([self._print(arg) for arg in expr.args])

return f'{self._ns}{cname}({args})'
return f'{self.ns(expr)}{cname}({args})'

def _print_Pow(self, expr):
# Completely reimplement `_print_Pow` from sympy, since it doesn't
Expand All @@ -207,11 +210,11 @@ def _print_Pow(self, expr):
return self._print_Float(Float(1.0)) + '/' + \
self.parenthesize(expr.base, PREC)
elif equal_valued(expr.exp, 0.5):
return f'{self._ns}sqrt{suffix}({base})'
return f'{self.ns(expr)}sqrt{suffix}({base})'
elif expr.exp == S.One/3 and self.standard != 'C89':
return f'{self._ns}cbrt{suffix}({base})'
return f'{self.ns(expr)}cbrt{suffix}({base})'
else:
return f'{self._ns}pow{suffix}({base}, {self._print(expr.exp)})'
return f'{self.ns(expr)}pow{suffix}({base}, {self._print(expr.exp)})'

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

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

def _print_MathFunction(self, expr):
return f"{self._ns}{self._print_DefFunction(expr)}"
return f"{self.ns(expr)}{self._print_DefFunction(expr)}"

def _print_Fallback(self, expr):
return expr.__str__()
Expand Down
4 changes: 2 additions & 2 deletions docker/Dockerfile.amd
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
# Based on https://github.com/amd/InfinityHub-CI/tree/main/base-gpu-mpi-rocm-docker
##############################################################

ARG ROCM_VERSION=6.3.2
ARG ROCM_VERSION=7.0.2

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

ARG UCX_BRANCH="v1.16.0"
ARG UCX_BRANCH="v1.17.x"
ARG OMPI_BRANCH="v5.0.x"

# Update and Install basic Linux development tools
Expand All @@ -24,7 +24,7 @@
OMPI_HOME=/opt/ompi

# Adding ROCM
ENV PATH=$ROCM_HOME/bin:$PATH \

Check warning on line 27 in docker/Dockerfile.amd

View workflow job for this annotation

GitHub Actions / amd-base

Variables should be defined before their use

UndefinedVar: Usage of undefined variable '$LD_LIBRARY_PATH' More info: https://docs.docker.com/go/dockerfile/rule/undefined-var/

Check warning on line 27 in docker/Dockerfile.amd

View workflow job for this annotation

GitHub Actions / amd-base

Variables should be defined before their use

UndefinedVar: Usage of undefined variable '$LD_LIBRARY_PATH' More info: https://docs.docker.com/go/dockerfile/rule/undefined-var/
LD_LIBRARY_PATH=$ROCM_HOME/lib:$ROCM_HOME/lib/llvm/lib:$LD_LIBRARY_PATH

# Until rocm base has it fixed
Expand Down Expand Up @@ -82,7 +82,7 @@
RUN rm -rf /tmp/ucx && rm -rf /tmp/ompi

# Adding OpenMPI and UCX to Environment
ENV PATH=$OMPI_HOME/bin:$UCX_HOME/bin:$PATH \

Check warning on line 85 in docker/Dockerfile.amd

View workflow job for this annotation

GitHub Actions / amd-base

Variables should be defined before their use

UndefinedVar: Usage of undefined variable '$PKG_CONFIG_PATH' More info: https://docs.docker.com/go/dockerfile/rule/undefined-var/

Check warning on line 85 in docker/Dockerfile.amd

View workflow job for this annotation

GitHub Actions / amd-base

Variables should be defined before their use

UndefinedVar: Usage of undefined variable '$INCLUDE' More info: https://docs.docker.com/go/dockerfile/rule/undefined-var/

Check warning on line 85 in docker/Dockerfile.amd

View workflow job for this annotation

GitHub Actions / amd-base

Variables should be defined before their use

UndefinedVar: Usage of undefined variable '$CPATH' (did you mean $PATH?) More info: https://docs.docker.com/go/dockerfile/rule/undefined-var/

Check warning on line 85 in docker/Dockerfile.amd

View workflow job for this annotation

GitHub Actions / amd-base

Variables should be defined before their use

UndefinedVar: Usage of undefined variable '$CPLUS_INCLUDE_PATH' More info: https://docs.docker.com/go/dockerfile/rule/undefined-var/

Check warning on line 85 in docker/Dockerfile.amd

View workflow job for this annotation

GitHub Actions / amd-base

Variables should be defined before their use

UndefinedVar: Usage of undefined variable '$C_INCLUDE_PATH' More info: https://docs.docker.com/go/dockerfile/rule/undefined-var/

Check warning on line 85 in docker/Dockerfile.amd

View workflow job for this annotation

GitHub Actions / amd-base

Variables should be defined before their use

UndefinedVar: Usage of undefined variable '$PKG_CONFIG_PATH' More info: https://docs.docker.com/go/dockerfile/rule/undefined-var/

Check warning on line 85 in docker/Dockerfile.amd

View workflow job for this annotation

GitHub Actions / amd-base

Variables should be defined before their use

UndefinedVar: Usage of undefined variable '$INCLUDE' More info: https://docs.docker.com/go/dockerfile/rule/undefined-var/

Check warning on line 85 in docker/Dockerfile.amd

View workflow job for this annotation

GitHub Actions / amd-base

Variables should be defined before their use

UndefinedVar: Usage of undefined variable '$CPATH' (did you mean $PATH?) More info: https://docs.docker.com/go/dockerfile/rule/undefined-var/

Check warning on line 85 in docker/Dockerfile.amd

View workflow job for this annotation

GitHub Actions / amd-base

Variables should be defined before their use

UndefinedVar: Usage of undefined variable '$CPLUS_INCLUDE_PATH' More info: https://docs.docker.com/go/dockerfile/rule/undefined-var/

Check warning on line 85 in docker/Dockerfile.amd

View workflow job for this annotation

GitHub Actions / amd-base

Variables should be defined before their use

UndefinedVar: Usage of undefined variable '$C_INCLUDE_PATH' More info: https://docs.docker.com/go/dockerfile/rule/undefined-var/
LD_LIBRARY_PATH=$OMPI_HOME/lib:$UCX_HOME/lib:$LD_LIBRARY_PATH \
C_INCLUDE_PATH=$OMPI_HOME/include:$UCX_HOME/include:$C_INCLUDE_PATH \
CPLUS_INCLUDE_PATH=$OMPI_HOME/include:$UCX_HOME/include:$CPLUS_INCLUDE_PATH \
Expand Down
Loading