Skip to content

Commit

Permalink
misc: Add name property to Compiler
Browse files Browse the repository at this point in the history
  • Loading branch information
ccuetom committed Jul 31, 2023
1 parent 9b69c1f commit e4ab797
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
4 changes: 4 additions & 0 deletions devito/arch/compiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,10 @@ def __new_with__(self, **kwargs):
mpi=kwargs.pop('mpi', configuration['mpi']),
**kwargs)

@property
def name(self):
return self.__class__.__name__

@memoized_meth
def get_jit_dir(self):
"""A deterministic temporary directory for jit-compiled objects."""
Expand Down
2 changes: 1 addition & 1 deletion devito/operator/operator.py
Original file line number Diff line number Diff line change
Expand Up @@ -1186,7 +1186,7 @@ def parse_kwargs(**kwargs):

# `allocator`
kwargs['allocator'] = default_allocator(
'%s.%s.%s' % (kwargs['compiler'].__class__.__name__,
'%s.%s.%s' % (kwargs['compiler'].name,
kwargs['language'],
kwargs['platform'])
)
Expand Down
5 changes: 1 addition & 4 deletions devito/parameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,10 +247,7 @@ def __exit__(self, exc_type, exc_val, exc_tb):
configuration[k] = self.previous[k]
except ValueError:
# E.g., `platform` and `compiler` will end up here
try:
configuration[k] = self.previous[k].name
except AttributeError:
super(Parameters, configuration).__setitem__(k, self.previous[k])
super(Parameters, configuration).__setitem__(k, self.previous[k])

def __call__(self, func, *args, **kwargs):
@wraps(func)
Expand Down

0 comments on commit e4ab797

Please sign in to comment.