Skip to content

Commit

Permalink
docs: More updates from Archer2
Browse files Browse the repository at this point in the history
  • Loading branch information
georgebisbas committed Oct 20, 2023
1 parent 3cc2cef commit 8efd2fc
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 11 deletions.
12 changes: 6 additions & 6 deletions devito/builtins/arithmetic.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
}


@dv.switchconfig(log_level='ERROR')
#@dv.switchconfig(log_level='ERROR')
def norm(f, order=2):
"""
Compute the norm of a Function.
Expand Down Expand Up @@ -57,7 +57,7 @@ def norm(f, order=2):
return f.dtype(v)


@dv.switchconfig(log_level='ERROR')
#@dv.switchconfig(log_level='ERROR')
def sum(f, dims=None):
"""
Compute the sum of the Function data over specified dimensions.
Expand Down Expand Up @@ -110,7 +110,7 @@ def sum(f, dims=None):
return out


@dv.switchconfig(log_level='ERROR')
#@dv.switchconfig(log_level='ERROR')
def sumall(f):
"""
Compute the sum of all Function data.
Expand Down Expand Up @@ -140,7 +140,7 @@ def sumall(f):
return f.dtype(mr.v)


@dv.switchconfig(log_level='ERROR')
#@dv.switchconfig(log_level='ERROR')
def inner(f, g):
"""
Inner product of two Functions.
Expand Down Expand Up @@ -195,7 +195,7 @@ def inner(f, g):
return f.dtype(mr.v)


@dv.switchconfig(log_level='ERROR')
#@dv.switchconfig(log_level='ERROR')
def mmin(f):
"""
Retrieve the minimum.
Expand All @@ -215,7 +215,7 @@ def mmin(f):
raise ValueError("Expected Function, not `%s`" % type(f))


@dv.switchconfig(log_level='ERROR')
#@dv.switchconfig(log_level='ERROR')
def mmax(f):
"""
Retrieve the maximum.
Expand Down
2 changes: 1 addition & 1 deletion devito/builtins/initializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
__all__ = ['assign', 'smooth', 'gaussian_smooth', 'initialize_function']


@dv.switchconfig(log_level='ERROR')
#@dv.switchconfig(log_level='ERROR')
def assign(f, rhs=0, options=None, name='assign', assign_halo=False, **kwargs):
"""
Assign a list of RHSs to a list of Functions.
Expand Down
10 changes: 9 additions & 1 deletion devito/logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,24 @@
# Add extra logging levels (note: INFO has value=20, WARNING has value=30)
DEBUG = logging.DEBUG
PERF = 19
BENCH = logging.DEBUG
INFO = logging.INFO
WARNING = logging.WARNING
ERROR = logging.ERROR
CRITICAL = logging.CRITICAL

logging.addLevelName(PERF, "PERF")
logging.addLevelName(BENCH, "BENCH")


logger_registry = {
'DEBUG': DEBUG,
'PERF': PERF,
'INFO': INFO,
'WARNING': WARNING,
'ERROR': ERROR,
'CRITICAL': CRITICAL
'CRITICAL': CRITICAL,
'BENCH': BENCH
}

NOCOLOR = '%s'
Expand Down Expand Up @@ -136,6 +140,10 @@ def error(msg, *args, **kwargs):
log(msg, ERROR, *args, **kwargs)


def bench(msg, *args, **kwargs):
log(msg, BENCH, *args, **kwargs)


def debug(msg, *args, **kwargs):
log(msg, DEBUG, *args, **kwargs)

Expand Down
11 changes: 10 additions & 1 deletion devito/mpi/distributed.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import numpy as np
from cgen import Struct, Value

from devito.logger import set_log_level
from devito.data import LEFT, CENTER, RIGHT, Decomposition
from devito.parameters import configuration
from devito.tools import EnrichedTuple, as_tuple, ctypes_to_cstr, filter_ordered
Expand Down Expand Up @@ -192,11 +193,19 @@ def __init__(self, shape, dimensions, input_comm=None, topology=None):
global init_by_devito
init_by_devito = True

# If BENCH logging is selected, only emit from rank 0
if configuration['log-level'] == 'BENCH':
set_log_level('DEBUG', comm=MPI.COMM_WORLD)

# Note: the cloned communicator doesn't need to be explicitly freed;
# mpi4py takes care of that when the object gets out of scope
self._input_comm = (input_comm or MPI.COMM_WORLD).Clone()

topology = ('*', '*', 1)
# if len(shape) == 3:
# topology = ('*', '*', 1)

# topology = ('*', '*', 1)
# topology = ('*', '*', 8)

if topology is None:
# `MPI.Compute_dims` sets the dimension sizes to be as close to each other
Expand Down
9 changes: 8 additions & 1 deletion devito/operator/operator.py
Original file line number Diff line number Diff line change
Expand Up @@ -989,7 +989,14 @@ def lower_perfentry(v):
if a in args:
perf_args[a] = args[a]
break
perf("Performance[mode=%s] arguments: %s" % (self._mode, perf_args))

if configuration['mpi']:
perf("Performance[mode=%s, mpi=%s] arguments: %s" % (self._mode,
configuration['mpi'], perf_args))
else:
perf("Performance[mode=%s] arguments: %s" % (self._mode, perf_args))

# perf("Performance[mode=%s] arguments: %s" % (self._mode, perf_args))

return summary

Expand Down
2 changes: 1 addition & 1 deletion devito/operator/profiling.py
Original file line number Diff line number Diff line change
Expand Up @@ -521,7 +521,7 @@ def timings(self):

def create_profile(name):
"""Create a new Profiler."""
if configuration['log-level'] in ['DEBUG', 'PERF'] and \
if configuration['log-level'] in ['DEBUG', 'PERF', 'BENCH'] and \
configuration['profiling'] == 'basic':
# Enforce performance profiling in DEBUG mode
level = 'advanced'
Expand Down

0 comments on commit 8efd2fc

Please sign in to comment.