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

Parameter studies #265

Draft
wants to merge 30 commits into
base: main
Choose a base branch
from
Draft

Parameter studies #265

wants to merge 30 commits into from

Conversation

nkoskelo
Copy link
Contributor

@nkoskelo nkoskelo commented Jul 8, 2024

This is an enhancement pull request.

Its purpose is to allow a user to specify a program, P($var1$, $var2$, $\dots$) $\rightarrow out$ and transform it into a new program $P'(var1_{s1}, var2_{s2}, \dots)$ $\rightarrow out_{s1,s2}$. $out_{s1,s2, \dots}$ will contain the answers to running $P$ on each input variable grouping in the input shape.

Needs:

arraycontext/impl/pytato/__init__.py Outdated Show resolved Hide resolved
arraycontext/impl/pytato/__init__.py Outdated Show resolved Hide resolved
arraycontext/impl/pytato/__init__.py Outdated Show resolved Hide resolved
arraycontext/impl/pytato/__init__.py Outdated Show resolved Hide resolved
examples/uncertain_prop.py Outdated Show resolved Hide resolved
arraycontext/impl/pytato/__init__.py Outdated Show resolved Hide resolved
examples/uncertain_prop.py Outdated Show resolved Hide resolved
arraycontext/impl/pytato/__init__.py Outdated Show resolved Hide resolved
arraycontext/impl/pytato/__init__.py Outdated Show resolved Hide resolved
arraycontext/impl/pytato/__init__.py Outdated Show resolved Hide resolved
@inducer inducer marked this pull request as draft July 8, 2024 15:29
@inducer inducer changed the title DRAFT: UQ to Inner Loop UQ to Inner Loop Jul 8, 2024
@nkoskelo nkoskelo requested a review from inducer July 10, 2024 19:49
examples/parameter_study.py Outdated Show resolved Hide resolved
examples/parameter_study.py Outdated Show resolved Hide resolved
@inducer inducer changed the title UQ to Inner Loop Parameter studies Jul 16, 2024
@inducer
Copy link
Owner

inducer commented Jul 16, 2024

Unsubscribing... @-mention or request review once it's ready for a look or needs attention.

examples/parameter_study.py Outdated Show resolved Hide resolved
arraycontext/parameter_study/transform.py Outdated Show resolved Hide resolved
arraycontext/parameter_study/transform.py Outdated Show resolved Hide resolved
arraycontext/parameter_study/transform.py Outdated Show resolved Hide resolved
arraycontext/parameter_study/transform.py Outdated Show resolved Hide resolved
arraycontext/parameter_study/transform.py Outdated Show resolved Hide resolved
arraycontext/parameter_study/transform.py Outdated Show resolved Hide resolved
arraycontext/parameter_study/transform.py Outdated Show resolved Hide resolved
arraycontext/parameter_study/transform.py Outdated Show resolved Hide resolved
arraycontext/parameter_study/transform.py Outdated Show resolved Hide resolved
Comment on lines 87 to 92
Args is a list of variable names and the realized input data that needs
to be packed for a parameter study or uncertainty quantification.

Args needs to be in the format
[v0, v1, v2, ..., vN] where N is the total number of instances you want to
try. Note these may be across multiple parameter studies on the same inputs.
Copy link
Owner

Choose a reason for hiding this comment

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

Have you looked at this docstring rendered?

arraycontext/parameter_study/__init__.py Outdated Show resolved Hide resolved
Comment on lines 454 to 457
def transform_loopy_program(self,
t_unit: lp.TranslationUnit) -> lp.TranslationUnit:
# Update in a subclass if you want.
return t_unit
Copy link
Owner

Choose a reason for hiding this comment

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

Why is this here?

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 is here so that I can actually execute the code made in the examples folder. Perhaps it would be better to just make a subclass in the examples code and then use that instead.

arraycontext/parameter_study/transform.py Outdated Show resolved Hide resolved
arraycontext/parameter_study/transform.py Outdated Show resolved Hide resolved
arraycontext/parameter_study/transform.py Outdated Show resolved Hide resolved
arraycontext/parameter_study/transform.py Outdated Show resolved Hide resolved
@inducer
Copy link
Owner

inducer commented Jul 23, 2024

Unsubscribing... @-mention or request review once it's ready for a look or needs attention.

Comment on lines 119 to 122
def transform_loopy_program(self,
t_unit: lp.TranslationUnit) -> lp.TranslationUnit:
# Update in a subclass if you want.
return t_unit
Copy link
Owner

Choose a reason for hiding this comment

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

Remove, see #272.

return compiled_func(arg_id_to_arg)


def _cut_to_single_instance_size(name, arg) -> Array:
Copy link
Owner

Choose a reason for hiding this comment

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

Just build the right-size Placeholder to start with.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We only build the placeholder once. I am allowing the multiple-instance argument to be passed to the function _to_input_for_compiled(arg, actx) whose functionality depends on the input ArrayContext on account of a subsequent call to actx.transform_dag(arg). We are cutting to a placeholder afterwards so that the pytato.transfrom.materialize_with_mpms materialization strategy is still used. Other ArrayContexts may have other strategies implemented before the compilation step.

nkoskelo and others added 6 commits August 6, 2024 15:50
…equence result in the same numerical values as the one multiple instance execution.
…th the parameter study and then you get an Array or Container of the same type as if you had done the single instance program.
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