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
12 changes: 6 additions & 6 deletions .github/workflows/docker-bases.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
############## Basic gcc CPU ##########################
#######################################################
deploy-cpu-bases:
if: inputs.cpu
if: ${{ github.event_name != 'workflow_dispatch' || inputs.cpu }}
name: "cpu-base-${{ matrix.arch }}-gcc${{ matrix.gcc }}"
runs-on: ${{ matrix.runner }}
env:
Expand Down Expand Up @@ -88,7 +88,7 @@ jobs:
tags: "devitocodes/bases:cpu-gcc${{ matrix.gcc }}-${{ matrix.arch }}"

deploy-cpu-bases-manifest:
if: inputs.cpu
if: ${{ github.event_name != 'workflow_dispatch' || inputs.cpu }}
name: "cpu-base-manifest"
runs-on: ubuntu-latest
needs: deploy-cpu-bases
Expand Down Expand Up @@ -123,7 +123,7 @@ jobs:
############## Intel OneApi CPU #######################
#######################################################
deploy-oneapi-bases:
if: inputs.intel
if: ${{ github.event_name != 'workflow_dispatch' || inputs.intel }}
name: "oneapi-base"
runs-on: ubuntu-latest
env:
Expand Down Expand Up @@ -181,7 +181,7 @@ jobs:
################### Nvidia nvhpc ######################
#######################################################
deploy-nvidia-bases:
if: inputs.nvidia
if: ${{ github.event_name != 'workflow_dispatch' || inputs.nvidia }}
name: "nvidia-bases-${{ matrix.arch }}"
runs-on: ${{ matrix.runner }}
env:
Expand Down Expand Up @@ -270,7 +270,7 @@ jobs:
tags: "devitocodes/bases:cpu-nvc${{ matrix.extra_tag }}-${{ matrix.arch }}"

deploy-nvidia-bases-manifest:
if: inputs.nvidia
if: ${{ github.event_name != 'workflow_dispatch' || inputs.nvidia }}
name: "nvidia-base-manifest"
runs-on: ubuntu-latest
needs: deploy-nvidia-bases
Expand Down Expand Up @@ -305,7 +305,7 @@ jobs:
##################### AMD #############################
#######################################################
deploy-amd-bases:
if: inputs.amd
if: ${{ github.event_name != 'workflow_dispatch' || inputs.amd }}
name: "amd-base"
runs-on: ["self-hosted", "amdgpu"]
env:
Expand Down
6 changes: 5 additions & 1 deletion devito/ir/clusters/algorithms.py
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,7 @@ def guard(clusters):

# Chain together all `cds` conditions from all expressions in `c`
guards = {}
mode = sympy.Or
for cd in cds:
# `BOTTOM` parent implies a guard that lives outside of
# any iteration space, which corresponds to the placeholder None
Expand All @@ -270,6 +271,7 @@ def guard(clusters):

# Pull `cd` from any expr
condition = guards.setdefault(k, [])
mode = mode and cd.relation
for e in exprs:
try:
condition.append(e.conditionals[cd])
Expand All @@ -284,7 +286,9 @@ def guard(clusters):
conditionals.pop(cd, None)
exprs[i] = e.func(*e.args, conditionals=conditionals)

guards = {d: sympy.And(*v, evaluate=False) for d, v in guards.items()}
# Combination `mode` is And by default.
# If all conditions are Or then Or combination `mode` is used.
guards = {d: mode(*v, evaluate=False) for d, v in guards.items()}

# Construct a guarded Cluster
processed.append(c.rebuild(exprs=exprs, guards=guards))
Expand Down
2 changes: 1 addition & 1 deletion devito/ir/equations/equation.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ def __new__(cls, *args, **kwargs):
else:
cond = diff2sympy(lower_exprs(d.condition))
if d._factor is not None:
cond = sympy.And(cond, GuardFactor(d))
cond = d.relation(cond, GuardFactor(d))
conditionals[d] = cond
# Replace dimension with index
index = d.index
Expand Down
14 changes: 12 additions & 2 deletions devito/types/dimension.py
Original file line number Diff line number Diff line change
Expand Up @@ -860,6 +860,11 @@ class ConditionalDimension(DerivedDimension):
If True, use `self`, rather than the parent Dimension, to
index into arrays. A typical use case is when arrays are accessed
indirectly via the ``condition`` expression.
relation: Or/And, default=And
How this ConditionalDimension will be combined with other ones during
lowering for example combining Function's ConditionalDimension with
an Equation's implicit_dim. All Dimensions within an equation
must have `Or` relation for the final combined condition to be Or.

Examples
--------
Expand Down Expand Up @@ -913,10 +918,10 @@ class ConditionalDimension(DerivedDimension):
is_Conditional = True

__rkwargs__ = DerivedDimension.__rkwargs__ + \
('factor', 'condition', 'indirect')
('factor', 'condition', 'indirect', 'relation')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not a big fan of the name "relation" as it's a bit vague


def __init_finalize__(self, name, parent=None, factor=None, condition=None,
indirect=False, **kwargs):
indirect=False, relation=sympy.And, **kwargs):
# `parent=None` degenerates to a ConditionalDimension outside of
# any iteration space
if parent is None:
Expand All @@ -937,6 +942,7 @@ def __init_finalize__(self, name, parent=None, factor=None, condition=None,

self._condition = condition
self._indirect = indirect
self._relation = relation

@property
def uses_symbolic_factor(self):
Expand Down Expand Up @@ -978,6 +984,10 @@ def condition(self):
def indirect(self):
return self._indirect

@property
def relation(self):
return self._relation

@cached_property
def free_symbols(self):
retval = set(super().free_symbols)
Expand Down
4 changes: 2 additions & 2 deletions docker/Dockerfile.intel
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ FROM base AS oneapi

# Download the key to system keyring
# https://www.intel.com/content/www/us/en/develop/documentation/installation-guide-for-intel-oneapi-toolkits-linux/top/installation/install-using-package-managers/apt.html#apt
SHELL /bin/bash -o pipefail
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
RUN wget --progress=dot:giga -O- https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB | gpg --dearmor > /usr/share/keyrings/oneapi-archive-keyring.gpg
RUN echo "deb [signed-by=/usr/share/keyrings/oneapi-archive-keyring.gpg] https://apt.repos.intel.com/oneapi all main" > /etc/apt/sources.list.d/oneAPI.list

Expand All @@ -37,7 +37,7 @@ RUN apt-get update -y && \

# Drivers mandatory for intel gpu
# https://dgpu-docs.intel.com/driver/installation.html#ubuntu-install-steps
SHELL /bin/bash -o pipefail
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
RUN wget -qO - https://repositories.intel.com/graphics/intel-graphics.key | gpg --dearmor > /usr/share/keyrings/intel-graphics.gpg
RUN echo "deb [arch=amd64 signed-by=/usr/share/keyrings/intel-graphics.gpg] https://repositories.intel.com/graphics/ubuntu jammy unified" > /etc/apt/sources.list.d/intel-gpu-jammy.list

Expand Down
4 changes: 2 additions & 2 deletions docker/Dockerfile.nvidia
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ RUN apt-get update && \
dh-autoreconf python3-venv python3-dev python3-pip

# nodesource: nvdashboard requires nodejs>=10
SHELL /bin/bash -o pipefail
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
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
RUN arch="$(uname -m)" && \
case "$arch" in \
Expand Down Expand Up @@ -92,7 +92,7 @@ ENV UCX_TLS=cuda,cuda_copy,cuda_ipc,sm,shm,self
#ENV UCX_TLS=cuda,cuda_copy,cuda_ipc,sm,shm,self,rc_x,gdr_copy

# Make simlink for path setup since ENV doesn't accept shell commands.
SHELL /bin/bash -o pipefail
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
RUN arch="$(uname -m)" && \
case "$arch" in \
x86_64) linux=Linux_x86_64 ;; \
Expand Down
2 changes: 1 addition & 1 deletion examples/seismic/tutorials/02_rtm.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
" return demo_model('marmousi2d-isotropic', data_path='../../../../data/',\n",
" grid=grid, nbl=20)\n",
" filter_sigma = (6, 6)\n",
" nshots = 301 # Need good covergae in shots, one every two grid points\n",
" nshots = 301 # Need good coverage in shots, one every two grid points\n",
" nreceivers = 601 # One receiver every grid point\n",
" t0 = 0.\n",
" tn = 3500. # Simulation last 3.5 second (3500 ms)\n",
Expand Down
Loading
Loading