Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

compiler: Add opkwargs property to ArgumentsMap #2142

Merged
merged 1 commit into from
Jun 28, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions devito/operator/operator.py
Original file line number Diff line number Diff line change
Expand Up @@ -1061,6 +1061,16 @@ def comm(self):
"""The MPI communicator the arguments are collective over."""
return self.grid.comm if self.grid is not None else MPI.COMM_NULL

@property
def opkwargs(self):
temp_registry = {v: k for k, v in platform_registry.items()}
platform = temp_registry[self.platform]

temp_registry = {v: k for k, v in compiler_registry.items()}
compiler = temp_registry[self.compiler.__class__]

return {'platform': platform, 'compiler': compiler, 'language': self.language}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not self.compiler and self.platform

opkwargs is a bit vague since it only returns the "language" part

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

self.compiler and self.platform contain Compiler and Platform objects respectively instead of the original str arguments passed to the operator. Downstream operators will expect arguments passed to them to be str's

Is there a Devito word that encompasses platform, compiler, and language to use a more descriptive method name?



def parse_kwargs(**kwargs):
"""
Expand Down