Skip to content

distributed-lazy: delete unneeded temporaries after execution - #258

Merged
inducer merged 452 commits into
mainfrom
dist-delete-unneeded
Feb 10, 2022
Merged

distributed-lazy: delete unneeded temporaries after execution#258
inducer merged 452 commits into
mainfrom
dist-delete-unneeded

Conversation

@matthiasdiener

@matthiasdiener matthiasdiener commented Feb 7, 2022

Copy link
Copy Markdown
Contributor

Add-on for #148.

Should help with illinois-ceesd/mirgecom#599

@matthiasdiener
matthiasdiener changed the base branch from main to distributed-v3 February 7, 2022 20:22
Comment thread pytato/distributed.py Outdated
@matthiasdiener
matthiasdiener marked this pull request as ready for review February 8, 2022 01:18
@matthiasdiener matthiasdiener self-assigned this Feb 8, 2022
@matthiasdiener matthiasdiener changed the title Dist delete unneeded distributed-lazy: delete unneeded temporaries after execution Feb 8, 2022

@inducer inducer left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Thanks! LGTM subject to these minor fixes.

Comment thread pytato/distributed.py Outdated
Comment on lines +612 to +621
# Keep a count on how often each input name is used,
# in order to be able to free them.
partition_input_names_refcount: Dict[str, int] = {}

for pid in pids_to_execute:
for name in partition.parts[pid].all_input_names():
if name in partition_input_names_refcount:
partition_input_names_refcount[name] += 1
else:
partition_input_names_refcount[name] = 1

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

This should be a @memoize_method on the partition. No need to recompute on every evaluation IMO. (Make sure to not modify the cached dictionary in place!)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done in 4b592fb

Comment thread pytato/distributed.py Outdated

if __debug__:
for _, v in partition_input_names_refcount.items():
assert v == 0

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Maybe also assert that the values are gone from context?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done in 5481125

Comment thread pytato/distributed.py Outdated
Base automatically changed from distributed-v3 to main February 9, 2022 04:55

@inducer inducer left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Thanks, LGTM! I'll aply the suggestion.

Comment thread pytato/distributed.py Outdated
@inducer
inducer enabled auto-merge (squash) February 10, 2022 20:00
@inducer

inducer commented Feb 10, 2022

Copy link
Copy Markdown
Owner

This should be able to land after inducer/pytools#118 merges.

@matthiasdiener

Copy link
Copy Markdown
Contributor Author

This should be able to land after inducer/pytools#118 merges.

It will need a new pytools release+conda package I guess.

@inducer

inducer commented Feb 10, 2022

Copy link
Copy Markdown
Owner

Yep, you're totally right. 🤦 Doing that now.

@inducer

inducer commented Feb 10, 2022

Copy link
Copy Markdown
Owner

https://pypi.org/project/pytools/2022.1/

@inducer
inducer merged commit 1af35bb into main Feb 10, 2022
@inducer
inducer deleted the dist-delete-unneeded branch February 10, 2022 22:09
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