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

add materialization counter #333

Draft
wants to merge 6 commits into
base: count-tags
Choose a base branch
from
Draft

Conversation

matthiasdiener
Copy link
Collaborator

No description provided.

@matthiasdiener matthiasdiener self-assigned this Jun 1, 2022
@@ -426,3 +429,27 @@ def get_num_tags_of_type(
return tcm(outputs)

# }}}


def get_num_materialized(outputs: Union[Array, DictOfNamedArrays]) \
Copy link
Owner

Choose a reason for hiding this comment

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

Suggested change
def get_num_materialized(outputs: Union[Array, DictOfNamedArrays]) \
def get_num_materialized_predecessors(outputs: Union[Array, DictOfNamedArrays]) \


def is_materialized(expr: ArrayOrNames) -> bool:
if (isinstance(expr, Array) and
any(isinstance(tag, ImplStored) for tag in expr.tags)):
Copy link
Owner

Choose a reason for hiding this comment

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

Suggested change
any(isinstance(tag, ImplStored) for tag in expr.tags)):
expr.tags_of_type(ImplStored)):

@@ -426,3 +429,27 @@ def get_num_tags_of_type(
return tcm(outputs)

# }}}


def get_num_materialized(outputs: Union[Array, DictOfNamedArrays]) \
Copy link
Owner

Choose a reason for hiding this comment

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

My main issue with this approach is that it has at least quadratic complexity. A possible improvement would be a CombineMapper that simply counts the materialized predecessors for each node. I.e. combine is a sum, and each node returns 1 if it's materialized and uses inherited behavior (reduce ("combine") over predecessors).

Base automatically changed from mat_stats to count-tags June 6, 2022 01:12
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.

None yet

2 participants