diff --git a/.github/workflows/docker-bases.yml b/.github/workflows/docker-bases.yml index f0574af99b3..2d10b3e7e8c 100644 --- a/.github/workflows/docker-bases.yml +++ b/.github/workflows/docker-bases.yml @@ -72,12 +72,6 @@ jobs: dockerfile: './docker/Dockerfile.cpu' runner: ubuntu-latest - - tag: 'devitocodes/bases:cpu-icx' - arch: 'arch=icx' - version: '' - dockerfile: './docker/Dockerfile.cpu' - runner: ubuntu-latest - - tag: 'devitocodes/bases:cpu-nvc' arch: 'arch=nvc-host' version: '' diff --git a/.github/workflows/pytest-core-nompi.yml b/.github/workflows/pytest-core-nompi.yml index d08386ee95b..c59628b12ff 100644 --- a/.github/workflows/pytest-core-nompi.yml +++ b/.github/workflows/pytest-core-nompi.yml @@ -34,8 +34,8 @@ jobs: pytest-ubuntu-py39-gcc9-omp, pytest-osx-py37-clang-omp, pytest-docker-py37-gcc-omp, - pytest-docker-py37-icc-omp, - pytest-docker-py38-icx-omp + pytest-docker-py37-intel-omp, + pytest-docker-py38-intel-omp ] set: [base, adjoint] include: @@ -95,14 +95,14 @@ jobs: language: "openmp" sympy: "1.10" - - name: pytest-docker-py37-icc-omp + - name: pytest-docker-py37-intel-omp python-version: '3.7' os: ubuntu-22.04 arch: "icc" language: "openmp" sympy: "1.11" - - name: pytest-docker-py38-icx-omp + - name: pytest-docker-py38-intel-omp python-version: '3.8' os: ubuntu-22.04 arch: "icx" @@ -129,15 +129,20 @@ jobs: with: python-version: ${{ matrix.python-version }} - - name: Build docker image - if: contains(matrix.name, 'docker') + - name: Build docker image for GCC variants + if: "contains(matrix.name, 'docker') && contains(matrix.name, 'gcc')" run: | docker build . --file docker/Dockerfile.devito --tag devito_img --build-arg base=devitocodes/bases:cpu-${{ matrix.arch }} + - name: Build docker image for INTEL variants + if: "contains(matrix.name, 'docker') && contains(matrix.name, 'intel')" + run: | + docker build . --file docker/Dockerfile.devito --tag devito_img --build-arg base=devitocodes/bases:cpu-icc + - name: Set run prefix run: | if [[ "${{ matrix.name }}" =~ "docker" ]]; then - echo "RUN_CMD=docker run --rm -e CODECOV_TOKEN=${{ secrets.CODECOV_TOKEN }} --name testrun devito_img" >> $GITHUB_ENV + echo "RUN_CMD=docker run --rm -e CODECOV_TOKEN=${{ secrets.CODECOV_TOKEN }} -e DEVITO_ARCH=${{ matrix.arch }} --name testrun devito_img" >> $GITHUB_ENV else echo "RUN_CMD=" >> $GITHUB_ENV fi diff --git a/devito/arch/compiler.py b/devito/arch/compiler.py index b17de06d685..86c6e85e124 100644 --- a/devito/arch/compiler.py +++ b/devito/arch/compiler.py @@ -552,8 +552,8 @@ def __init__(self, *args, **kwargs): self.cflags.append('-fsycl-targets=spir64') if language == 'openmp': - # To be switched to `-fiopenmp` or `-qopenmp` as soon as - # it is fixed in the new Intel OneAPI release + # TODO: To be switched to `-fiopenmp` or `-qopenmp` as soon as + # it is fixed in the new Intel OneAPI release (current: 2023.0) self.cflags.append('-fopenmp') if platform is NVIDIAX: self.cflags.append('-fopenmp-targets=nvptx64-cuda') @@ -854,11 +854,11 @@ def __lookup_cmds__(self): 'nvidia': NvidiaCompiler, 'cuda': CudaCompiler, 'osx': ClangCompiler, - 'intel': IntelCompiler, - 'icpc': IntelCompiler, - 'icc': IntelCompiler, + 'intel': OneapiCompiler, 'icx': OneapiCompiler, 'icpx': OneapiCompiler, + 'icc': IntelCompiler, + 'icpc': IntelCompiler, 'intel-knl': IntelKNLCompiler, 'knl': IntelKNLCompiler, 'dpcpp': DPCPPCompiler, diff --git a/devito/parameters.py b/devito/parameters.py index 0c56f10b441..fab69407609 100644 --- a/devito/parameters.py +++ b/devito/parameters.py @@ -241,6 +241,13 @@ def __init__(self, **params): def __call__(self, func, *args, **kwargs): @wraps(func) def wrapper(*args, **kwargs): + # Do not switch if condition is False + try: + if not self.params.pop('condition'): + return + except KeyError: + pass + previous = {} for k, v in self.params.items(): previous[k] = configuration[k] diff --git a/docker/Dockerfile.cpu b/docker/Dockerfile.cpu index 5a4a6ee234a..9ebda2d9f0c 100644 --- a/docker/Dockerfile.cpu +++ b/docker/Dockerfile.cpu @@ -55,14 +55,6 @@ ENV DEVITO_LANGUAGE="openmp" # MPICC compiler for mpi4py ENV MPICC=$I_MPI_ROOT/bin/mpiicc -############################################################## -# ICX image -############################################################## -FROM icc as icx - -# Devito config -ENV DEVITO_ARCH="icx" - ############################################################## # Published image ############################################################## diff --git a/tests/conftest.py b/tests/conftest.py index 5c8c16fdeb7..51d8e631383 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -7,8 +7,7 @@ from devito import Eq, configuration # noqa from devito.finite_differences.differentiable import EvalDerivative from devito.arch import Cpu64, Device, sniff_mpi_distro, Arm -from devito.arch.compiler import (compiler_registry, IntelCompiler, OneapiCompiler, - NvidiaCompiler) +from devito.arch.compiler import compiler_registry, IntelCompiler, NvidiaCompiler from devito.ir.iet import retrieve_iteration_tree, FindNodes, Iteration, ParallelBlock from devito.tools import as_tuple @@ -24,8 +23,7 @@ def skipif(items, whole_module=False): # Sanity check accepted = set() accepted.update({'device', 'device-C', 'device-openmp', 'device-openacc', - 'device-aomp', 'cpu64-icc', 'cpu64-icpx', 'cpu64-nvc', - 'cpu64-arm'}) + 'device-aomp', 'cpu64-icc', 'cpu64-nvc', 'cpu64-arm'}) accepted.update({'nompi', 'nodevice'}) unknown = sorted(set(items) - accepted) if unknown: @@ -71,12 +69,6 @@ def skipif(items, whole_module=False): isinstance(configuration['platform'], Cpu64): skipit = "`icc+cpu64` won't work with this test" break - # Skip if it won't run with OneAPICompiler - if i == 'cpu64-icpx' and \ - isinstance(configuration['compiler'], OneapiCompiler) and \ - isinstance(configuration['platform'], Cpu64): - skipit = "`icpx+cpu64` won't work with this test" - break # Skip if it won't run on Arm if i == 'cpu64-arm' and isinstance(configuration['platform'], Arm): skipit = "Arm doesn't support x86-specific instructions" diff --git a/tests/test_dimension.py b/tests/test_dimension.py index f38a8e18b84..af2a8bb7538 100644 --- a/tests/test_dimension.py +++ b/tests/test_dimension.py @@ -9,7 +9,8 @@ SparseFunction, SparseTimeFunction, Eq, Operator, Constant, Dimension, DefaultDimension, SubDimension, switchconfig, SubDomain, Lt, Le, Gt, Ge, Ne, Buffer, sin, SpaceDimension, - CustomDimension, dimensions) + CustomDimension, dimensions, configuration) +from devito.arch.compiler import OneapiCompiler from devito.ir.iet import (Conditional, Expression, Iteration, FindNodes, FindSymbols, retrieve_iteration_tree) from devito.symbolics import indexify, retrieve_functions, IntDiv @@ -1382,8 +1383,8 @@ def test_affiness(self): iterations = [i for i in FindNodes(Iteration).visit(op) if i.dim is not time] assert all(i.is_Affine for i in iterations) - # Skipping this test with icx, as it requires safe-math - @skipif('cpu64-icpx') + @switchconfig(condition=isinstance(configuration['compiler'], + OneapiCompiler), safe_math=True) def test_sparse_time_function(self): nt = 20