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

Remove _get_backend_opts from StencilConfig #354

Merged
merged 2 commits into from
Oct 13, 2022
Merged

Conversation

jdahm
Copy link
Contributor

@jdahm jdahm commented Oct 11, 2022

Also cleanup an inspect call that was accidentally run twice.

jdahm added 2 commits October 11, 2022 10:33
Also cleanup an inspect call that was accidentally run twice.
Comment on lines -219 to -248
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

Copy link
Contributor Author

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.

@jdahm jdahm requested a review from elynnwu October 12, 2022 16:53
Comment on lines +174 to +177
self.backend_opts = {
"device_sync": self.compilation_config.device_sync,
"format_source": self.compilation_config.format_source,
}
Copy link
Collaborator

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.

Copy link
Contributor Author

@jdahm jdahm Oct 12, 2022

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.

Copy link
Contributor Author

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.

@jdahm jdahm merged commit 882db88 into main Oct 13, 2022
@jdahm jdahm deleted the cleanup-stencil-config branch October 13, 2022 22:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants