Skip to content
26 changes: 20 additions & 6 deletions conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
from sympy.printing import sstr

from devito import Eq, Revolver, configuration # noqa
from devito.arch import Arm, Cpu64, Device, get_advisor_path, sniff_mpi_distro
from devito.arch import Arm, Cpu64, Device, Power, get_advisor_path, sniff_mpi_distro
from devito.arch.compiler import (
IntelCompiler, NvidiaCompiler, OneapiCompiler, compiler_registry
GNUCompiler, IntelCompiler, NvidiaCompiler, OneapiCompiler, compiler_registry
)
from devito.checkpointing import NoopRevolver
from devito.finite_differences.differentiable import EvalDerivative
Expand All @@ -35,10 +35,19 @@ def skipif(items, whole_module=False):
items = as_tuple(items)
# Sanity check
accepted = set()
accepted.update({'device', 'device-C', 'device-openmp', 'device-openacc',
'device-aomp', 'cpu64-icc', 'cpu64-icx', 'cpu64-nvc',
'noadvisor', 'cpu64-arm', 'cpu64-icpx', 'chkpnt'})
accepted.update({'nodevice', 'noomp'})
accepted.update({
# GPU (device-language)
'device', 'device-C', 'device-openmp', 'device-openacc', 'device-aomp',
# CPU (cpu64-instruction set)
'cpu64-icc', 'cpu64-icx', 'cpu64-nvc', 'cpu64-icpx',
# CPU (cpu64-architecture)
'cpu64-arm',
# CPU (cpu64-architecture-compiler)
'cpu64-power-gcc',
# Miscellaneous
'chkpnt'
})
accepted.update({'noadvisor', 'nodevice', 'noomp'})
unknown = sorted(set(items) - accepted)
if unknown:
raise ValueError(f"Illegal skipif argument(s) `{unknown}`")
Expand Down Expand Up @@ -97,6 +106,11 @@ def skipif(items, whole_module=False):
if i == 'cpu64-arm' and isinstance(configuration['platform'], Arm):
skipit = "Arm doesn't support x86-specific instructions"
break
if i == 'cpu64-power-gcc' and \
isinstance(configuration['platform'], Power) and \
isinstance(configuration['compiler'], GNUCompiler):
skipit = "GCC cannot compile these POWER instructions"
break
# Skip if pyrevolve not installed
if i == 'chkpnt' and Revolver is NoopRevolver:
skipit = "pyrevolve not installed"
Expand Down
7 changes: 7 additions & 0 deletions devito/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,13 @@ def _preprocess_autopadding(v):
[False, True, 0, 1, np.float16, np.float32, np.float64],
preprocessor=_preprocess_autopadding)

# Use any GPU present on the node to set parameters such as the autopadding
# value. This can be disabled by setting this parameter to , but should not be
# toggled. By setting the value to 'cpu-only' the user is promising that they
# will not try to use the GPU at any point during the running of their script,
# this is useful when iGPUs, APUs or disabled GPUs are present on a node.
configuration.add('autopadding-mode', None, [None, 'cpu-only'])

# Select target device
configuration.add('deviceid', -1, preprocessor=int, impacts_jit=False)

Expand Down
3 changes: 2 additions & 1 deletion devito/arch/archinfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import psutil
from packaging.version import InvalidVersion, parse

from devito import configuration
from devito.logger import warning
from devito.tools import all_equal, as_tuple, memoized_func

Expand Down Expand Up @@ -1245,7 +1246,7 @@ def node_max_mem_trans_nbytes(platform):

if isinstance(platform, Cpu64):
gpu_info = get_gpu_info()
if not gpu_info:
if configuration['autopadding-mode'] == 'cpu-only' or not gpu_info:
# This node may simply not have a GPU
return mmtb0

Expand Down
3 changes: 2 additions & 1 deletion devito/logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,8 @@ def set_log_level(level, comm=None):
from devito import configuration

if comm is not None and configuration['mpi']:
if comm.rank != 0:
from devito.mpi.distributed import MPI
if comm is not MPI.COMM_NULL and comm.rank != 0:
logger.removeHandler(stream_handler)
logger.addHandler(logging.NullHandler())
else:
Expand Down
21 changes: 11 additions & 10 deletions devito/parameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,20 +141,21 @@ def _signature_items(self):

env_vars_mapper = {
'DEVITO_ARCH': 'compiler',
'DEVITO_PLATFORM': 'platform',
'DEVITO_PROFILING': 'profiling',
'DEVITO_AUTOPADDING_MODE': 'autopadding-mode',
'DEVITO_AUTOTUNING': 'autotuning',
'DEVITO_DEVELOP': 'develop-mode',
'DEVITO_OPT': 'opt',
'DEVITO_MPI': 'mpi',
'DEVITO_TOPOLOGY': 'topology',
'DEVITO_DEVICEID': 'deviceid',
'DEVITO_LANGUAGE': 'language',
'DEVITO_AUTOTUNING': 'autotuning',
'DEVITO_LOGGING': 'log-level',
'DEVITO_FIRST_TOUCH': 'first-touch',
'DEVITO_JIT_BACKDOOR': 'jit-backdoor',
'DEVITO_IGNORE_UNKNOWN_PARAMS': 'ignore-unknowns',
'DEVITO_SAFE_MATH': 'safe-math'
'DEVITO_JIT_BACKDOOR': 'jit-backdoor',
'DEVITO_LANGUAGE': 'language',
'DEVITO_LOGGING': 'log-level',
'DEVITO_MPI': 'mpi',
'DEVITO_OPT': 'opt',
'DEVITO_PLATFORM': 'platform',
'DEVITO_PROFILING': 'profiling',
'DEVITO_SAFE_MATH': 'safe-math',
'DEVITO_TOPOLOGY': 'topology',
}

env_vars_deprecated = {
Expand Down
2 changes: 1 addition & 1 deletion devito/passes/iet/parpragma.py
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ def _make_partree(self, candidates, nthreads=None):
prefix = []
elif nthreads is not None:
body = self.HostIteration(schedule='static',
parallel=nthreads is not self.nthreads_nested,
parallel=nthreads is not self.nthreads,
ncollapsed=ncollapsed, nthreads=nthreads,
**root.args)
prefix = []
Expand Down
3 changes: 2 additions & 1 deletion tests/test_autotuner.py
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,7 @@ def test_hierarchical_blocking(opt_options):
assert len(op._state['autotuning'][1]['tuned']) == 4


@skipif('cpu64-power-gcc')
@switchconfig(platform='cpu64-dummy', develop_mode=True) # `cpu64-dummy `to fix ncores
@pytest.mark.parametrize('opt_options', [{'skewing': False}, {'skewing': True}])
def test_multiple_threads(opt_options):
Expand All @@ -309,7 +310,7 @@ def test_multiple_threads(opt_options):
assert len(op._state['autotuning'][0]['tuned']) == 3


@skipif('cpu64-arm')
@skipif(['cpu64-arm', 'cpu64-power-gcc'])
@switchconfig(platform='knl7210', develop_mode=True) # `knl7210` for nested parallelsim
def test_nested_nthreads():
grid = Grid(shape=(96, 96, 96))
Expand Down
4 changes: 3 additions & 1 deletion tests/test_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,9 @@ def test_w_halo_wo_padding(self):
) == u2.shape_with_halo
assert u2.shape_with_halo == (11, 11, 11)

@switchconfig(autopadding=True, platform='bdw')
# Platform is used to fix the pad value
# GPU is disabled to prevent GPU pad value from being used
@switchconfig(autopadding_mode='cpu-only', autopadding=True, platform='bdw')
def test_w_halo_w_autopadding(self):
grid = Grid(shape=(4, 4, 4))
u0 = Function(name='u0', grid=grid, space_order=0)
Expand Down
1 change: 1 addition & 0 deletions tests/test_dle.py
Original file line number Diff line number Diff line change
Expand Up @@ -1057,6 +1057,7 @@ def test_incr_perfect_outer(self):
op()
assert np.all(w.data == 10)

@skipif('cpu64-power-gcc')
def test_incr_perfect_sparse_outer(self):
grid = Grid(shape=(3, 3, 3))

Expand Down
6 changes: 4 additions & 2 deletions tests/test_mpi.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
from devito.mpi.distributed import CustomTopology
from devito.mpi.routines import ComputeCall, HaloUpdateCall, HaloUpdateList, MPICall
from devito.tools import Bunch
from devito.types.dimension import ModuloDimension
from examples.seismic.acoustic import acoustic_setup


Expand Down Expand Up @@ -3289,8 +3290,9 @@ def test_interpolation_at_uforward(self, mode):

calls, _ = check_halo_exchanges(op, 2, 1)
args = calls[0].arguments
assert args[-2].name == 't2'
assert args[-2].origin == t + 1
t2 = next(filter(lambda a: isinstance(a, ModuloDimension), args))
assert t2.name == 't2'
assert t2.origin == t + 1


def gen_serial_norms(shape, so):
Expand Down
Loading