Skip to content

Commit

Permalink
advisor: Turn class attrs to instance attrs
Browse files Browse the repository at this point in the history
  • Loading branch information
georgebisbas committed Feb 17, 2025
1 parent 4d553a4 commit 398b613
Showing 1 changed file with 19 additions and 15 deletions.
34 changes: 19 additions & 15 deletions devito/operator/profiling.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,6 @@

class Profiler:

_default_includes = []
_default_libs = []
_ext_calls = []

_include_dirs = []
_lib_dirs = []

_supports_async_sections = False

_verbosity = 0

def __init__(self, name):
self.name = name

Expand All @@ -53,6 +42,17 @@ def __init__(self, name):
# Python-level timers
self.py_timers = OrderedDict()

# Initialize instance attributes
self._default_includes = []
self._default_libs = []
self._ext_calls = []
self._include_dirs = []
self._lib_dirs = []

self._supports_async_sections = False

self._verbosity = 0

self.initialized = True

def add_include_dir(self, dir_path):
Expand Down Expand Up @@ -369,12 +369,13 @@ class AdvisorProfiler(AdvancedProfiler):
_api_resume = '__itt_resume'
_api_pause = '__itt_pause'

_default_includes = ['ittnotify.h']
_default_libs = ['ittnotify']
_ext_calls = [_api_resume, _api_pause]

def __init__(self, name):
super().__init__(name)

self._default_includes.append('ittnotify.h')
self._default_libs.append('ittnotify')
self._ext_calls.extend([self._api_resume, self._api_pause])

path = get_advisor_path()
if path:
self.add_include_dir(path.joinpath('include').as_posix())
Expand All @@ -383,6 +384,9 @@ def __init__(self, name):
self.initialized = False

def analyze(self, iet):
"""
A no-op, as the Advisor profiler does not need to analyze the IET.
"""
return

def instrument(self, iet, timer):
Expand Down

0 comments on commit 398b613

Please sign in to comment.