Skip to content

Commit

Permalink
docs: Use with
Browse files Browse the repository at this point in the history
  • Loading branch information
georgebisbas committed Jan 15, 2024
1 parent ab9b08b commit 00a4c34
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 19 deletions.
2 changes: 1 addition & 1 deletion FAQ.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
- [Can I subclass basic types such as TimeFunction](#can-i-subclass-basic-types-such-as-timefunction)
- [How can I change the compilation flags (for example, I want to change the optimization level from -O3 to -O0)](#how-can-i-change-the-compilation-flags-for-example-i-want-to-change-the-optimization-level-from--o3-to--o0)
- [Is the jitted code IEEE-compliant](#is-the-jitted-code-ieee-compliant)
- [Can I control the MPI domain decomposition?](#can-i-control-the-mpi-domain-decomposition)
- [Can I control the MPI domain decomposition](#can-i-control-the-mpi-domain-decomposition)
- [How should I use MPI on multi-socket machines](#how-should-I-use-MPI-on-multi-socket-machines)
- [How do I make sure my code is "MPI safe"](#how-do-i-make-sure-my-code-is-MPI-safe)
- [Why does my Operator kernel die suddenly](#why-does-my-operator-kernel-die-suddenly)
Expand Down
2 changes: 1 addition & 1 deletion devito/logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def set_log_level(level, comm=None):
"""
from devito import configuration

if comm is not None:
if comm is not None and configuration['mpi']:
if comm.rank != 0:
logger.removeHandler(stream_handler)
logger.addHandler(logging.NullHandler())
Expand Down
24 changes: 8 additions & 16 deletions devito/operator/operator.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from cached_property import cached_property
import ctypes

from devito import switchconfig
from devito.arch import compiler_registry, platform_registry
from devito.data import default_allocator
from devito.exceptions import InvalidOperator
Expand Down Expand Up @@ -856,8 +857,10 @@ def apply(self, **kwargs):
# Post-process runtime arguments
self._postprocess_arguments(args, **kwargs)

# Output summary of performance achieved
return self._emit_apply_profiling(args)
# Output summary of performance achieved and
# temporarily drop MPI for printing arguments
with switchconfig(mpi=False):
return self._emit_apply_profiling(args)

# Performance profiling

Expand Down Expand Up @@ -895,10 +898,8 @@ def _emit_timings(timings, indent=''):
def _emit_apply_profiling(self, args):
"""Produce a performance summary of the profiled sections."""

# In case 'MPI0' is selected for logging, restrict result printing to one rank
temp = configuration['log-level']
if configuration['mpi']:
set_log_level(configuration['log-level'], comm=args.comm)
# In case MPI is used restrict result logging to one rank
set_log_level('DEBUG', comm=args.comm)

# Rounder to 2 decimal places
fround = lambda i: ceil(i * 100) / 100
Expand Down Expand Up @@ -993,16 +994,7 @@ def lower_perfentry(v):
if a in args:
perf_args[a] = args[a]
break

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))

# Restore logging configuration to all ranks
if configuration['mpi']:
set_log_level(temp, comm=None)
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 @@ -473,7 +473,7 @@ def add_glb_vanilla(self, key, time):
ops = sum(v.ops for v in self.input.values())
traffic = sum(v.traffic for v in self.input.values())

if np.isnan(traffic):
if np.isnan(traffic) or traffic == 0:
return

gflops = float(ops)/10**9
Expand Down

0 comments on commit 00a4c34

Please sign in to comment.