Skip to content

ENH: Generation of compatable device and dtype pairs for test_from_dlpack#443

Merged
ev-br merged 6 commits into
data-apis:masterfrom
prady0t:new-device-strategy
Jul 26, 2026
Merged

ENH: Generation of compatable device and dtype pairs for test_from_dlpack#443
ev-br merged 6 commits into
data-apis:masterfrom
prady0t:new-device-strategy

Conversation

@prady0t

@prady0t prady0t commented Jul 19, 2026

Copy link
Copy Markdown
Contributor

Closes #440

This is a fairly minimal fix. The new hh.device_dtype_pairs strategy generates pairs of all possible (dtype, device) such that dtype is compatible with device.

Running:

ARRAY_API_TESTS_MODULE=array_api_strict pytest array_api_tests/test_dlpack.py -sv --max-examples=10_000 

succeeds, which previously failed for dtype = float64 on device = no_float64

Signed-off-by: Pradyot Ranjan <99216956+pradyotRanjan@users.noreply.github.com>
Comment thread array_api_tests/dtype_helpers.py
Comment thread array_api_tests/hypothesis_helpers.py Outdated
Comment thread array_api_tests/test_dlpack.py Outdated
Signed-off-by: Pradyot Ranjan <99216956+pradyotRanjan@users.noreply.github.com>

@ev-br ev-br left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks, this seems to work with pytorch now. A couple of further requests below + please remove the now-unused function.

Comment thread array_api_tests/dtype_helpers.py Outdated
Comment thread array_api_tests/hypothesis_helpers.py
Comment thread array_api_tests/dtype_helpers.py
Comment thread array_api_tests/test_dlpack.py Outdated
Comment thread array_api_tests/test_dlpack.py Outdated
prady0t and others added 3 commits July 26, 2026 15:32
Co-authored-by: Evgeni Burovski <evgeny.burovskiy@gmail.com>
Co-authored-by: Evgeni Burovski <evgeny.burovskiy@gmail.com>
Signed-off-by: Pradyot Ranjan <99216956+pradyotRanjan@users.noreply.github.com>
@prady0t prady0t mentioned this pull request Jul 26, 2026
@ev-br

ev-br commented Jul 26, 2026

Copy link
Copy Markdown
Member

I'd want to test this on a CUDA-enabled machine locally before merging. The machine is having some issues ATM, meaning I won't be pressing the green button today.

@ev-br

ev-br commented Jul 26, 2026

Copy link
Copy Markdown
Member

Got help fixing the CUDA issue, and tested on a multi-GPU system with torch as the backend. The PR seems to work fine. So the only thing which blocks the merge is removing the function which is not used anymore:
https://github.com/data-apis/array-api-tests/pull/443/changes#diff-d40faf59941317167780108980afd61029a89a3c6201c1eaa78e31fb8716ca1aL24-L46

EDIT: the function is test_dlpack.py::_compatible_devices

Signed-off-by: Pradyot Ranjan <99216956+pradyotRanjan@users.noreply.github.com>
@prady0t

prady0t commented Jul 26, 2026

Copy link
Copy Markdown
Contributor Author

Why do we not have CUDA tests in CI? Also, why aren't we testing with different backends in CI, like torch?

@ev-br

ev-br commented Jul 26, 2026

Copy link
Copy Markdown
Member

Why do we not have CUDA tests in CI?

These are hard and $$$ to set up. There is no free CI provider, and those which are not free are not easy to set up and maintain either. cf the current SciPy churn.

Also, why aren't we testing with different backends in CI, like torch?

This question seems to pop up for every new person who looks at this test suite :-).
Here's one previous discussion: #298

IME, the most common need is to work in parallel on a branch of array_api_compat and a branch of array-api-tests. This use case is not well served by a CI setup, so what I typically do is $ pip install -e . and $ pushd/popd.

@ev-br ev-br left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM now, thank you @prady0t

@ev-br
ev-br merged commit a4023cc into data-apis:master Jul 26, 2026
5 checks passed
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.

test_from_dlpack is problematic with device-dependent dtypes

2 participants