Skip to content

Commit dc5610c

Browse files
author
George Bisbas
committed
advisor: Isolate profiler and compiler
1 parent 632ed77 commit dc5610c

3 files changed

Lines changed: 15 additions & 13 deletions

File tree

devito/arch/compiler.py

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -769,18 +769,6 @@ def __init_finalize__(self, **kwargs):
769769
self.__init_intel_mpi__()
770770
self.__init_intel_mpi_flags__()
771771

772-
if configuration['profiling'] == 'advisor':
773-
# Locate the Intel Advisor installation and
774-
# add the necessary paths and flags to the compiler
775-
path = get_advisor_path()
776-
self.add_include_dirs(path.joinpath('include').as_posix())
777-
778-
_default_libs = ['ittnotify']
779-
self.add_libraries(_default_libs)
780-
781-
libdir = path.joinpath('lib64').as_posix()
782-
self.add_library_dirs(libdir, rpath=True)
783-
784772
def __init_intel_mpi__(self, **kwargs):
785773
# Make sure the MPI compiler uses an Intel compiler underneath,
786774
# whatever the MPI distro is

devito/operator/operator.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,12 @@ def _build(cls, expressions, **kwargs):
219219

220220
# Required for the jit-compilation
221221
op._compiler = kwargs['compiler']
222+
223+
# Add any metadata from the profiler
224+
op._compiler.add_include_dirs(profiler._include_dirs)
225+
op._compiler.add_library_dirs(profiler._lib_dirs, rpath=True)
226+
op._compiler.add_libraries(profiler._default_libs)
227+
222228
op._language = kwargs['language']
223229
op._lib = None
224230
op._cfunction = None

devito/operator/profiling.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import numpy as np
99
from sympy import S
1010

11+
from devito.arch import get_advisor_path
1112
from devito.ir.iet import (ExpressionBundle, List, TimedList, Section,
1213
Iteration, FindNodes, Transformer)
1314
from devito.ir.support import IntervalGroup
@@ -32,6 +33,9 @@ class Profiler:
3233
_default_libs = []
3334
_ext_calls = []
3435

36+
_include_dirs = []
37+
_lib_dirs = []
38+
3539
_supports_async_sections = False
3640

3741
_verbosity = 0
@@ -365,7 +369,11 @@ class AdvisorProfiler(AdvancedProfiler):
365369

366370
def __init__(self, name):
367371
super(AdvisorProfiler, self).__init__(name)
368-
return
372+
path = get_advisor_path()
373+
self._include_dirs = [path.joinpath('include').as_posix()]
374+
375+
libdir = path.joinpath('lib64').as_posix()
376+
self._lib_dirs = [libdir]
369377

370378
def analyze(self, iet):
371379
return

0 commit comments

Comments
 (0)