-
Notifications
You must be signed in to change notification settings - Fork 5
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
ENH: Test tools for jax.jit and dask #115
base: main
Are you sure you want to change the base?
Conversation
|
||
# some xp backends are untyped | ||
# mypy: disable-error-code=no-untyped-usage | ||
|
||
lazy_xp_function(atleast_nd, static_argnames=("ndim", "xp")) | ||
lazy_xp_function(cov, static_argnames="xp") | ||
# FIXME .device attribute https://github.com/data-apis/array-api-compat/pull/238 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
data-apis/array-api-compat#238
Evidence that the numpy-compat PR works: crusaderky@d27f75d
lazy_xp_function(kron, static_argnames="xp") | ||
lazy_xp_function(nunique, static_argnames="xp") | ||
lazy_xp_function(pad, static_argnames=("pad_width", "mode", "constant_values", "xp")) | ||
# FIXME calls in1d which calls xp.unique_values without size |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is non-trivial to fix. Will look into it in a follow-up.
a00a646
to
57e6cd0
Compare
allow_dask_compute : int, optional | ||
Number of times `func` is allowed to internally materialize the Dask graph. This | ||
is typically triggered by `bool()`, `float()`, or `np.asarray()`. | ||
|
||
Set to 1 if you are aware that `func` converts the input parameters to numpy and | ||
want to let it do so at least for the time being, knowing that it is going to be | ||
extremely detrimental for performance. | ||
|
||
If a test needs values higher than 1 to pass, it is a canary that the conversion | ||
to numpy/bool/float is happening multiple times, which translates to multiple | ||
computations of the whole graph. Short of making the function fully lazy, you | ||
should at least add explicit calls to `np.asarray()` early in the function. | ||
*Note:* the counter of `allow_dask_compute` resets after each call to `func`, so | ||
a test function that invokes `func` multiple times should still work with this | ||
parameter set to 1. | ||
|
||
Default: 0, meaning that `func` must be fully lazy and never materialize the | ||
graph. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In a previous version this was a all-or-nothing test. scipy/scipy#22240 (comment) prompted me to change it.
Porting of scipy/scipy#22308, with additional support for Dask.