Skip to content

Commit 3bf89eb

Browse files
committed
tests: switch sensitive amd gpu tests to safe math
1 parent 993808b commit 3bf89eb

File tree

5 files changed

+35
-27
lines changed

5 files changed

+35
-27
lines changed

.github/workflows/docker-bases.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,10 @@ jobs:
222222
file: './docker/Dockerfile.amd'
223223
push: true
224224
target: 'amdclang'
225+
build-args: |
226+
ROCM_VERSION=5.5.1
227+
UCX_BRANCH=v1.13.1
228+
OMPI_BRANCH=v4.1.4
225229
tags: devitocodes/bases:amd
226230

227231
- name: AMD HIP image
@@ -231,6 +235,4 @@ jobs:
231235
file: './docker/Dockerfile.amd'
232236
push: true
233237
target: 'hip'
234-
build-args: |
235-
arch=hip
236238
tags: devitocodes/bases:amd-hip

devito/arch/compiler.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -563,7 +563,7 @@ def __init_finalize__(self, **kwargs):
563563
if language in ['C', 'openmp']:
564564
self.ldflags += ['-target', 'x86_64-pc-linux-gnu']
565565
self.ldflags += ['-fopenmp']
566-
self.ldflags += ['--offload-arch=native']
566+
self.ldflags += ['--offload-arch=%s' % platform.march]
567567
elif platform in [POWER8, POWER9]:
568568
# It doesn't make much sense to use AOMP on Power, but it should work
569569
self.cflags.append('-mcpu=native')

docker/Dockerfile.amd

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,10 @@ ENV ROCM_HOME=/opt/rocm \
4545
UCX_HOME=/opt/ucx \
4646
OMPI_HOME=/opt/ompi
4747

48+
# Adding ROCM
49+
ENV PATH=$ROCM_HOME/bin:$PATH \
50+
LD_LIBRARY_PATH=$ROCM_HOME/lib:$ROCM_HOME/lib/llvm/lib:$LD_LIBRARY_PATH
51+
4852
# Until rocm base has it fixed
4953
RUN ln -s /opt/rocm/llvm/bin/offload-arch /opt/rocm/bin/offload-arch | echo "offload-arch already exis"
5054

docker/Dockerfile.devito

Lines changed: 26 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -12,42 +12,46 @@ ARG USER_ID=1000
1212
ARG GROUP_ID=1000
1313

1414
################## Install devito ############################################
15-
# Copy Devito
16-
ADD . /app/devito
1715

18-
# Update if outdated
19-
RUN apt-get update
16+
# Update if outdated and install extras
17+
RUN apt-get update && \
18+
apt-get install -y git cmake libncurses5-dev libncursesw5-dev libdrm-dev libsystemd-dev
2019

21-
# Remove git files
22-
RUN rm -rf /app/devito/.git
20+
# Usefull utilities
21+
# Nvtop
22+
RUN git clone https://github.com/Syllo/nvtop.git /app/nvtop && \
23+
mkdir -p /app/nvtop/build && cd /app/nvtop/build && \
24+
cmake .. -DNVIDIA_SUPPORT=ON -DAMDGPU_SUPPORT=ON -DINTEL_SUPPORT=ON && \
25+
make && make install
2326

24-
# Install pip dependencies and devito as a pip package
27+
# Install pip dependencies
2528
RUN python3 -m venv /venv && \
2629
/venv/bin/pip install --no-cache-dir --upgrade pip && \
2730
/venv/bin/pip install --no-cache-dir jupyter && \
2831
/venv/bin/pip install --no-cache-dir wheel && \
29-
eval "$MPI4PY_FLAGS /venv/bin/pip install --no-cache-dir -r /app/devito/requirements-mpi.txt" && \
30-
/venv/bin/pip install --no-cache-dir -e /app/devito[extras,tests] && \
31-
rm -rf ~/.cache/pip
32-
33-
# Usefull utilities
34-
# Nvtop
35-
RUN apt-get install -y git cmake libncurses5-dev libncursesw5-dev libdrm-dev libsystemd-dev cmake && \
36-
git clone https://github.com/Syllo/nvtop.git /app/nvtop && \
37-
mkdir -p /app/nvtop/build && cd /app/nvtop/build && \
38-
cmake .. -DNVIDIA_SUPPORT=ON -DAMDGPU_SUPPORT=ON -DINTEL_SUPPORT=ON && \
39-
make && \
40-
make install && \
4132
ln -fs /app/nvtop/build/src/nvtop /venv/bin/nvtop
4233

43-
# Safety cleanup
44-
RUN apt-get clean && apt-get autoclean && apt-get autoremove -y && \
45-
rm -rf /var/lib/apt/lists/*
34+
# Copy Devito
35+
ADD . /app/devito
36+
37+
# Remove git files
38+
RUN rm -rf /app/devito/.git
39+
40+
# Mpi4py
41+
RUN eval "$MPI4PY_FLAGS /venv/bin/pip install --no-cache-dir --verbose -r /app/devito/requirements-mpi.txt"
42+
43+
# Devito
44+
RUN /venv/bin/pip install --no-cache-dir -e /app/devito[extras,tests] && rm -rf ~/.cache/pip
4645

4746
FROM $base as user
4847
# COPY is much faster than RUN chown by order of magnitude so we have a final step that
4948
# just copies the built image into the user.
5049

50+
# Last installs (such as gdb needed in user mode) and cleanup
51+
RUN apt-get update && apt install gdb -y && \
52+
apt-get clean && apt-get autoclean && apt-get autoremove -y && \
53+
rm -rf /var/lib/apt/lists/*
54+
5155
# User/Group Ids
5256
ARG USER_ID=1000
5357
ARG GROUP_ID=1000

tests/test_gpu_common.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -643,7 +643,6 @@ def test_streaming_multi_input(self, opt, ntmps):
643643

644644
assert np.all(grad.data == grad1.data)
645645

646-
@switchconfig(safe_math=True)
647646
def test_streaming_multi_input_conddim_foward(self):
648647
nt = 10
649648
grid = Grid(shape=(4, 4))
@@ -672,7 +671,6 @@ def test_streaming_multi_input_conddim_foward(self):
672671

673672
assert np.all(v.data == v1.data)
674673

675-
@switchconfig(safe_math=True)
676674
def test_streaming_multi_input_conddim_backward(self):
677675
nt = 10
678676
grid = Grid(shape=(4, 4))

0 commit comments

Comments
 (0)