Skip to content

Commit

Permalink
advisor: Several review edits and final touches
Browse files Browse the repository at this point in the history
  • Loading branch information
georgebisbas committed Feb 14, 2025
1 parent ed910e5 commit b79acd3
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 14 deletions.
4 changes: 2 additions & 2 deletions conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def skipif(items, whole_module=False):
accepted = set()
accepted.update({'device', 'device-C', 'device-openmp', 'device-openacc',
'device-aomp', 'cpu64-icc', 'cpu64-icx', 'cpu64-nvc',
'only-advisor', 'cpu64-arm', 'cpu64-icpx', 'chkpnt'})
'noadvisor', 'cpu64-arm', 'cpu64-icpx', 'chkpnt'})
accepted.update({'nodevice'})
unknown = sorted(set(items) - accepted)
if unknown:
Expand Down Expand Up @@ -80,7 +80,7 @@ def skipif(items, whole_module=False):
skipit = "`icx+cpu64` won't work with this test"
break
# Skip if icx or advisor are not available
if i not in 'only-advisor' or \
if i not in ('noadvisor',) or \
not isinstance(configuration['compiler'], IntelCompiler) or \
not get_advisor_path():
skipit = "Only `icx+advisor` should be tested here"
Expand Down
4 changes: 2 additions & 2 deletions devito/arch/archinfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -465,6 +465,7 @@ def get_cuda_path():
return None


@memoized_func
def get_advisor_path():
"""
Detect if Intel Advisor is installed on the machine and return
Expand All @@ -480,8 +481,7 @@ def get_advisor_path():
if "intel/advisor" in env_path_dir or "intel/oneapi/advisor" in env_path_dir:
path = Path(env_path_dir)
if path.name.startswith('bin'):
path = path.parent
return path
return path.parent

return path

Expand Down
2 changes: 1 addition & 1 deletion devito/operator/operator.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ def _build(cls, expressions, **kwargs):
# Required for the jit-compilation
op._compiler = kwargs['compiler']

# Add any metadata from the profiler
# Required for compilation by the profiler
op._compiler.add_include_dirs(profiler._include_dirs)
op._compiler.add_library_dirs(profiler._lib_dirs, rpath=True)
op._compiler.add_libraries(profiler._default_libs)
Expand Down
17 changes: 10 additions & 7 deletions devito/operator/profiling.py
Original file line number Diff line number Diff line change
Expand Up @@ -368,12 +368,14 @@ class AdvisorProfiler(AdvancedProfiler):
_ext_calls = [_api_resume, _api_pause]

def __init__(self, name):
super(AdvisorProfiler, self).__init__(name)
super().__init__(name)
path = get_advisor_path()
self._include_dirs = [path.joinpath('include').as_posix()]

libdir = path.joinpath('lib64').as_posix()
self._lib_dirs = [libdir]
if path:
self._include_dirs = [path.joinpath('include').as_posix()]
libdir = path.joinpath('lib64').as_posix()
self._lib_dirs = [libdir]
else:
self.initialized = False

def analyze(self, iet):
return
Expand Down Expand Up @@ -508,8 +510,9 @@ def create_profile(name):
if profiler.initialized:
return profiler
else:
warning("Couldn't set up `%s` profiler; reverting to `advanced`" % level)
profiler = profiler_registry['basic'](name)
rlevel = 'advanced'
warning(f"Couldn't set up `{level}` profiler; reverting to `{rlevel}`")
profiler = profiler_registry[rlevel](name)
# We expect the `advanced` profiler to always initialize successfully
assert profiler.initialized
return profiler
Expand Down
3 changes: 1 addition & 2 deletions tests/test_benchmark.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ def test_run_mpi(mode):
run('acoustic', **kwargs)


@skipif('only-advisor')
@skipif('noadvisor')
@switchconfig(profiling='advisor')
def test_advisor_profiling():
"""
Expand All @@ -102,5 +102,4 @@ def test_advisor_profiling():

op = Operator(eq0)
assert 'ittnotify.h' in op._includes
op._jit_compile()
op.apply(time_M=5)

0 comments on commit b79acd3

Please sign in to comment.