-
Notifications
You must be signed in to change notification settings - Fork 10
TST: run tests on CPU+GPU #221
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,9 +34,11 @@ class Backend(Enum): # numpydoc ignore=PR01,PR02 # type: ignore[no-subclass-an | |
NUMPY_READONLY = "numpy:readonly", _compat.is_numpy_namespace | ||
CUPY = "cupy", _compat.is_cupy_namespace | ||
TORCH = "torch", _compat.is_torch_namespace | ||
TORCH_GPU = "torch:gpu", _compat.is_torch_namespace | ||
DASK = "dask.array", _compat.is_dask_namespace | ||
SPARSE = "sparse", _compat.is_pydata_sparse_namespace | ||
JAX = "jax.numpy", _compat.is_jax_namespace | ||
JAX_GPU = "jax.numpy:gpu", _compat.is_jax_namespace | ||
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. As an aside, I profoundly dislike that this enum is used in production by the dispatch mechanism. 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.
what motivates your dislike? 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. This enum contains a lot of "backends" that are just variant duplicates, which is an artifact of using this enum to parametrize the 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. okay, I see the problem. Happy to go with whatever works best for you. FWIW I would like to keep using an enum in the dispatch mechanism, but fair enough if it is too messy to maintain the |
||
|
||
def __new__( | ||
cls, value: str, _is_namespace: Callable[[ModuleType], bool] | ||
|
@@ -54,7 +56,9 @@ def __init__( | |
|
||
def __str__(self) -> str: # type: ignore[explicit-override] # pyright: ignore[reportImplicitOverride] # numpydoc ignore=RT01 | ||
"""Pretty-print parameterized test names.""" | ||
return self.name.lower() | ||
return ( | ||
self.name.lower().replace("_gpu", ":gpu").replace("_readonly", ":readonly") | ||
) | ||
|
||
@property | ||
def modname(self) -> str: # numpydoc ignore=RT01 | ||
|
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.
Untested fix, which only benefits eager JAX.
On jax.jit, device propagation fails due to jax-ml/jax#26000
In a follow-up PR I'll rework the
test_device
tests to align them to the pattern recently established in scipy.