-
Notifications
You must be signed in to change notification settings - Fork 12
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
Remove _get_backend_opts from StencilConfig #354
Conversation
Also cleanup an inspect call that was accidentally run twice.
def _get_backend_opts( | ||
self, | ||
device_sync: Optional[bool] = None, | ||
format_source: Optional[bool] = None, | ||
) -> Dict[str, Any]: | ||
backend_opts: Dict[str, Any] = {} | ||
all_backend_opts: Optional[Dict[str, Any]] = { | ||
"device_sync": { | ||
"backend": r".*(gpu|cuda)$", | ||
"value": False, | ||
}, | ||
"format_source": { | ||
"value": False, | ||
}, | ||
"verbose": {"backend": r"(gt:|cuda)", "value": False}, | ||
} | ||
for name, option in all_backend_opts.items(): | ||
using_option_backend = re.match( | ||
option.get("backend", ""), self.compilation_config.backend | ||
) | ||
if "backend" not in option or using_option_backend: | ||
backend_opts[name] = option["value"] | ||
|
||
if device_sync is not None: | ||
backend_opts["device_sync"] = device_sync | ||
if format_source is not None: | ||
backend_opts["format_source"] = format_source | ||
|
||
return backend_opts | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was a really confusing function, and we didn't end up ever using the confusing logic here, since we always passed device_sync
and format_source
anyway. I replaced this with a simple constant dict that this would have returned.
self.backend_opts = { | ||
"device_sync": self.compilation_config.device_sync, | ||
"format_source": self.compilation_config.format_source, | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a good idea. Though I'm a little confused now from looking at _get_backend_opts
, is there an expected value for the gpu backend? It looks like we've been running with device_sync=True
for our runs lately.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Question for myself: does this affect the dace:*
backends? The runs so far seem to have used device_sync=True
. We think this should not be a namelist option.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does this affect the dace:* backends?
It adds a device_sync
call the way other GPU backends do.
Also cleanup an inspect call that was accidentally run twice.