-
Notifications
You must be signed in to change notification settings - Fork 11
single_version_only for actx.compile #228
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
base: main
Are you sure you want to change the base?
Changes from all commits
183b9e8
5ed25a5
a3ca58b
20b03b2
b8c0e25
d8071ea
7175fad
b3c69c7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -557,7 +557,8 @@ def clone(self) -> Self: | |
"setup-only" array context "leaks" into the application. | ||
""" | ||
|
||
def compile(self, f: Callable[..., Any]) -> Callable[..., Any]: | ||
def compile(self, f: Callable[..., Any], | ||
single_version_only: bool = False) -> Callable[..., Any]: | ||
"""Compiles *f* for repeated use on this array context. *f* is expected | ||
to be a `pure function <https://en.wikipedia.org/wiki/Pure_function>`__ | ||
performing an array computation. | ||
|
@@ -573,6 +574,8 @@ def compile(self, f: Callable[..., Any]) -> Callable[..., Any]: | |
it may be called only once (or a few times). | ||
|
||
:arg f: the function executing the computation. | ||
:arg single_version_only: If *True*, raise an error if *f* is compiled | ||
more than once (due to different input argument types). | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
:return: a function with the same signature as *f*. | ||
""" | ||
return f | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -630,9 +630,11 @@ def call_loopy(self, program, **kwargs): | |
|
||
return call_loopy(program, processed_kwargs, entrypoint) | ||
|
||
def compile(self, f: Callable[..., Any]) -> Callable[..., Any]: | ||
def compile(self, f: Callable[..., Any], | ||
single_version_only: bool = False) -> Callable[..., Any]: | ||
from .compile import LazilyPyOpenCLCompilingFunctionCaller | ||
return LazilyPyOpenCLCompilingFunctionCaller(self, f) | ||
return LazilyPyOpenCLCompilingFunctionCaller(self, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe also handle the other sub-classes of BaseLazilyCompilingFunctionCaller? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added in 5ed25a5 |
||
f, single_version_only) | ||
|
||
def transform_dag(self, dag: pytato.DictOfNamedArrays | ||
) -> pytato.DictOfNamedArrays: | ||
|
@@ -844,9 +846,10 @@ def _thaw(ary): | |
self._rec_map_container(_thaw, array, self._frozen_array_types), | ||
actx=self) | ||
|
||
def compile(self, f: Callable[..., Any]) -> Callable[..., Any]: | ||
def compile(self, f: Callable[..., Any], | ||
single_version_only: bool = False) -> Callable[..., Any]: | ||
from .compile import LazilyJAXCompilingFunctionCaller | ||
return LazilyJAXCompilingFunctionCaller(self, f) | ||
return LazilyJAXCompilingFunctionCaller(self, f, single_version_only) | ||
|
||
def tag(self, tags: ToTagSetConvertible, array): | ||
def _tag(ary): | ||
|
Uh oh!
There was an error while loading. Please reload this page.