Skip to content

Commit 8c20f97

Browse files
committed
comiler: better handle buffer ispace
1 parent a75cbf7 commit 8c20f97

File tree

3 files changed

+26
-14
lines changed

3 files changed

+26
-14
lines changed

.github/workflows/docker-bases.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,16 @@ on:
1818
inputs:
1919
cpu:
2020
type: boolean
21-
default: false
21+
default: true
2222
nvidia:
2323
type: boolean
24-
default: false
24+
default: true
2525
amd:
2626
type: boolean
27-
default: false
27+
default: true
2828
intel:
2929
type: boolean
30-
default: false
30+
default: true
3131

3232
tags:
3333
description: "Build compiler bases"

devito/passes/clusters/buffering.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -461,12 +461,13 @@ def itdims(self):
461461
@cached_property
462462
def ispace(self):
463463
# The IterationSpace within which the buffer will be accessed
464+
464465
# NOTE: The `key` is to avoid Clusters including `f` but not directly
465466
# using it in an expression, such as HaloTouch Clusters
466467
def key(c):
467468
bufferdim = any(i in c.ispace.dimensions for i in self.bdims)
468-
timeonly = all(d.is_Time for d in c.ispace.dimensions)
469-
return bufferdim or timeonly
469+
xd_only = all(d._defines & self.xd._defines for d in c.ispace.dimensions)
470+
return bufferdim or xd_only
470471

471472
ispaces = set()
472473
for c in self.clusters:
@@ -478,14 +479,13 @@ def key(c):
478479
continue
479480

480481
# Iterations space and buffering dims
481-
ispace = c.ispace
482-
edims = [d for d in self.bdims if d not in ispace.dimensions]
482+
edims = [d for d in self.bdims if d not in c.ispace.dimensions]
483483
if not edims:
484-
ispaces.add(ispace)
484+
ispaces.add(c.ispace)
485485
else:
486486
# Add all missing buffering dimensions and reorder to
487487
# avoid duplicates with different ordering
488-
ispaces.add(ispace.insert(self.dim, edims).reorder())
488+
ispaces.add(c.ispace.insert(self.dim, edims).reorder())
489489

490490
if len(ispaces) > 1:
491491
# Best effort to make buffering work in the presence of multiple

docker/Dockerfile.nvidia

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,20 +20,32 @@ RUN apt-get update && \
2020

2121
# nodesource: nvdashboard requires nodejs>=10
2222
RUN curl https://developer.download.nvidia.com/hpc-sdk/ubuntu/DEB-GPG-KEY-NVIDIA-HPC-SDK | gpg --yes --dearmor -o /usr/share/keyrings/nvidia-hpcsdk-archive-keyring.gpg
23-
RUN echo 'deb [trusted=yes, signed-by=/usr/share/keyrings/nvidia-hpcsdk-archive-keyring.gpg] https://developer.download.nvidia.com/hpc-sdk/ubuntu/amd64 /' | tee /etc/apt/sources.list.d/nvhpc.list
23+
RUN arch="$(uname -m)" && \
24+
case "$arch" in \
25+
x86_64) nvplat=amd64 ;; \
26+
aarch64|arm64) nvplat=arm64 ;; \
27+
*) echo "Unsupported architecture: $arch" >&2; exit 1 ;; \
28+
esac && \
29+
echo "deb [trusted=yes, signed-by=/usr/share/keyrings/nvidia-hpcsdk-archive-keyring.gpg] https://developer.download.nvidia.com/hpc-sdk/ubuntu/${nvplat} /" | tee /etc/apt/sources.list.d/nvhpc.list
2430
RUN apt-key update *&& apt-get update -y
2531

2632
# Install nvhpc. `nvhpc` is the alias for the latest avaialble version
2733
ARG ver=nvhpc
2834
# We use the standard apt-get for the default latest nvhpc. For earlier version, apt has a bug that it will always
2935
# install the latest nvhpc-x-y no matter which version nvhpc-x-z is requested which would double (extra 10Gb) the size of the image.
3036
# So for specific version we directly download the specific deb and install it.
31-
RUN if [ "$ver" = "nvhpc" ]; then \
37+
RUN arch="$(uname -m)" && \
38+
case "$arch" in \
39+
x86_64) nvplat=amd64 ;; \
40+
aarch64|arm64) nvplat=arm64 ;; \
41+
*) echo "Unsupported architecture: $arch" >&2; exit 1 ;; \
42+
esac && \
43+
if [ "$ver" = "nvhpc" ]; then \
3244
apt-get install -y -q --allow-unauthenticated ${ver}; \
3345
else \
3446
export year=$(echo $ver | cut -d "-" -f 2) && export minor=$(echo $ver | cut -d "-" -f 3) && \
35-
wget https://developer.download.nvidia.com/hpc-sdk/ubuntu/amd64/nvhpc_${year}.${minor}_amd64.deb && \
36-
apt-get install --allow-unauthenticated -y -q ./nvhpc_${year}.${minor}_amd64.deb; \
47+
wget https://developer.download.nvidia.com/hpc-sdk/ubuntu/${nvplat}/nvhpc_${year}.${minor}_${nvplat}.deb && \
48+
apt-get install --allow-unauthenticated -y -q ./nvhpc_${year}.${minor}_${nvplat}.deb; \
3749
fi;
3850

3951
# Nodejs https://github.com/nodesource/distributions

0 commit comments

Comments
 (0)