Skip to content

Commit ec30442

Browse files
author
George Bisbas
committed
advisor: Several review edits and final touches
1 parent d854bb4 commit ec30442

5 files changed

Lines changed: 16 additions & 14 deletions

File tree

conftest.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def skipif(items, whole_module=False):
3333
accepted = set()
3434
accepted.update({'device', 'device-C', 'device-openmp', 'device-openacc',
3535
'device-aomp', 'cpu64-icc', 'cpu64-icx', 'cpu64-nvc',
36-
'only-advisor', 'cpu64-arm', 'cpu64-icpx', 'chkpnt'})
36+
'noadvisor', 'cpu64-arm', 'cpu64-icpx', 'chkpnt'})
3737
accepted.update({'nodevice'})
3838
unknown = sorted(set(items) - accepted)
3939
if unknown:
@@ -80,7 +80,7 @@ def skipif(items, whole_module=False):
8080
skipit = "`icx+cpu64` won't work with this test"
8181
break
8282
# Skip if icx or advisor are not available
83-
if i not in 'only-advisor' or \
83+
if i not in ('noadvisor',) or \
8484
not isinstance(configuration['compiler'], IntelCompiler) or \
8585
not get_advisor_path():
8686
skipit = "Only `icx+advisor` should be tested here"

devito/arch/archinfo.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -465,6 +465,7 @@ def get_cuda_path():
465465
return None
466466

467467

468+
@memoized_func
468469
def get_advisor_path():
469470
"""
470471
Detect if Intel Advisor is installed on the machine and return
@@ -480,8 +481,7 @@ def get_advisor_path():
480481
if "intel/advisor" in env_path_dir or "intel/oneapi/advisor" in env_path_dir:
481482
path = Path(env_path_dir)
482483
if path.name.startswith('bin'):
483-
path = path.parent
484-
return path
484+
return path.parent
485485

486486
return path
487487

devito/operator/operator.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ def _build(cls, expressions, **kwargs):
220220
# Required for the jit-compilation
221221
op._compiler = kwargs['compiler']
222222

223-
# Add any metadata from the profiler
223+
# Required for compilation by the profiler
224224
op._compiler.add_include_dirs(profiler._include_dirs)
225225
op._compiler.add_library_dirs(profiler._lib_dirs, rpath=True)
226226
op._compiler.add_libraries(profiler._default_libs)

devito/operator/profiling.py

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -368,12 +368,14 @@ class AdvisorProfiler(AdvancedProfiler):
368368
_ext_calls = [_api_resume, _api_pause]
369369

370370
def __init__(self, name):
371-
super(AdvisorProfiler, self).__init__(name)
371+
super().__init__(name)
372372
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]
373+
if path:
374+
self._include_dirs = [path.joinpath('include').as_posix()]
375+
libdir = path.joinpath('lib64').as_posix()
376+
self._lib_dirs = [libdir]
377+
else:
378+
self.initialized = False
377379

378380
def analyze(self, iet):
379381
return
@@ -508,8 +510,9 @@ def create_profile(name):
508510
if profiler.initialized:
509511
return profiler
510512
else:
511-
warning("Couldn't set up `%s` profiler; reverting to `advanced`" % level)
512-
profiler = profiler_registry['basic'](name)
513+
rlevel = 'advanced'
514+
warning(f"Couldn't set up `{level}` profiler; reverting to `{rlevel}`")
515+
profiler = profiler_registry[rlevel](name)
513516
# We expect the `advanced` profiler to always initialize successfully
514517
assert profiler.initialized
515518
return profiler

tests/test_benchmark.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ def test_run_mpi(mode):
8989
run('acoustic', **kwargs)
9090

9191

92-
@skipif('only-advisor')
92+
@skipif('noadvisor')
9393
@switchconfig(profiling='advisor')
9494
def test_advisor_profiling():
9595
"""
@@ -102,5 +102,4 @@ def test_advisor_profiling():
102102

103103
op = Operator(eq0)
104104
assert 'ittnotify.h' in op._includes
105-
op._jit_compile()
106105
op.apply(time_M=5)

0 commit comments

Comments
 (0)