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

API: Establish pydata_backend #646

Merged
merged 3 commits into from
Mar 13, 2024
Merged

API: Establish pydata_backend #646

merged 3 commits into from
Mar 13, 2024

Conversation

mtsokol
Copy link
Collaborator

@mtsokol mtsokol commented Mar 12, 2024

Replaces #645

Hi @hameerabbasi,

Including the new backend in pydata/sparse ended up a bit convoluted, therefore I decided to break this task into smaller steps.

Here's the first step which moves existing implementation to sparse/pydata_backend directory with tests and adds context manager that tracks backend contextvar. The test suite has a lot of pydata specific calls so it will be a separate effort to make tests common for both backends.

I applied all your comments from #645 here.

The next PR will run some stub tests with finch to see that it can be installed and run in CI.

Copy link

github-actions bot commented Mar 12, 2024

Test Results

5 899 tests  +2   5 865 ✅  - 1   3m 18s ⏱️ -1s
    1 suites ±0      34 💤 +3 
    1 files   ±0       0 ❌ ±0 

Results for commit 4c309c7. ± Comparison against base commit 92e8078.

This pull request removes 5897 and adds 5899 tests. Note that renamed tests count towards both.
sparse.tests.test_array_function ‑ test_binary[dot-arg_order0]
sparse.tests.test_array_function ‑ test_binary[dot-arg_order1]
sparse.tests.test_array_function ‑ test_binary[dot-arg_order2]
sparse.tests.test_array_function ‑ test_binary[matmul-arg_order0]
sparse.tests.test_array_function ‑ test_binary[matmul-arg_order1]
sparse.tests.test_array_function ‑ test_binary[matmul-arg_order2]
sparse.tests.test_array_function ‑ test_binary[result_type-arg_order0]
sparse.tests.test_array_function ‑ test_binary[result_type-arg_order1]
sparse.tests.test_array_function ‑ test_binary[result_type-arg_order2]
sparse.tests.test_array_function ‑ test_binary[tensordot-arg_order0]
…
sparse.pydata_backend.tests.test_array_function ‑ test_binary[dot-arg_order0]
sparse.pydata_backend.tests.test_array_function ‑ test_binary[dot-arg_order1]
sparse.pydata_backend.tests.test_array_function ‑ test_binary[dot-arg_order2]
sparse.pydata_backend.tests.test_array_function ‑ test_binary[matmul-arg_order0]
sparse.pydata_backend.tests.test_array_function ‑ test_binary[matmul-arg_order1]
sparse.pydata_backend.tests.test_array_function ‑ test_binary[matmul-arg_order2]
sparse.pydata_backend.tests.test_array_function ‑ test_binary[result_type-arg_order0]
sparse.pydata_backend.tests.test_array_function ‑ test_binary[result_type-arg_order1]
sparse.pydata_backend.tests.test_array_function ‑ test_binary[result_type-arg_order2]
sparse.pydata_backend.tests.test_array_function ‑ test_binary[tensordot-arg_order0]
…
This pull request removes 31 skipped tests and adds 34 skipped tests. Note that renamed tests count towards both.
sparse.tests.test_compressed ‑ test_reductions_float16[f4-axis4-sum-kwargs0]
sparse.tests.test_compressed ‑ test_reductions_float16[f8-axis4-sum-kwargs0]
sparse.tests.test_compressed ‑ test_reductions_float16[i4-0-mean-kwargs1]
sparse.tests.test_compressed ‑ test_reductions_float16[i4-0-sum-kwargs0]
sparse.tests.test_compressed ‑ test_reductions_float16[i4-1-mean-kwargs1]
sparse.tests.test_compressed ‑ test_reductions_float16[i4-1-sum-kwargs0]
sparse.tests.test_compressed ‑ test_reductions_float16[i4-axis4-mean-kwargs1]
sparse.tests.test_compressed ‑ test_reductions_float16[i4-axis4-sum-kwargs0]
sparse.tests.test_compressed ‑ test_reductions_float16[i8-0-mean-kwargs1]
sparse.tests.test_compressed ‑ test_reductions_float16[i8-0-sum-kwargs0]
…
sparse.pydata_backend.tests.test_compressed ‑ test_reductions_float16[f4-None-sum-kwargs0]
sparse.pydata_backend.tests.test_compressed ‑ test_reductions_float16[f4-axis4-sum-kwargs0]
sparse.pydata_backend.tests.test_compressed ‑ test_reductions_float16[f8-axis4-sum-kwargs0]
sparse.pydata_backend.tests.test_compressed ‑ test_reductions_float16[i4-0-mean-kwargs1]
sparse.pydata_backend.tests.test_compressed ‑ test_reductions_float16[i4-0-sum-kwargs0]
sparse.pydata_backend.tests.test_compressed ‑ test_reductions_float16[i4-1-mean-kwargs1]
sparse.pydata_backend.tests.test_compressed ‑ test_reductions_float16[i4-1-sum-kwargs0]
sparse.pydata_backend.tests.test_compressed ‑ test_reductions_float16[i4-axis4-mean-kwargs1]
sparse.pydata_backend.tests.test_compressed ‑ test_reductions_float16[i4-axis4-sum-kwargs0]
sparse.pydata_backend.tests.test_compressed ‑ test_reductions_float16[i8-0-mean-kwargs1]
…

♻️ This comment has been updated with latest results.

Copy link
Collaborator

@hameerabbasi hameerabbasi left a comment

Choose a reason for hiding this comment

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

Thanks for the great work here, @mtsokol! A couple of comments.

sparse/__init__.py Show resolved Hide resolved
sparse/pydata_backend/__init__.py Outdated Show resolved Hide resolved
sparse/tests/test_backends.py Outdated Show resolved Hide resolved
sparse/__init__.py Outdated Show resolved Hide resolved
Copy link
Collaborator

@hameerabbasi hameerabbasi left a comment

Choose a reason for hiding this comment

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

Small changes.

sparse/__init__.py Outdated Show resolved Hide resolved
sparse/tests/conftest.py Show resolved Hide resolved
@hameerabbasi
Copy link
Collaborator

We also need a rebase.

@hameerabbasi hameerabbasi merged commit 32e6e0b into main Mar 13, 2024
9 checks passed
@hameerabbasi hameerabbasi deleted the pydata-backend branch March 13, 2024 09:52
@rgommers
Copy link

Quick question: since pydata_backend and finch_backend are (I assume) private and are only supposed to be used via context manager backend selection, wouldn't it be better to prepend underscores to the directory names?

@mtsokol
Copy link
Collaborator Author

mtsokol commented Mar 18, 2024

Sure! I think they can be prepended with an underscore. There will always be backend-specific members, like GCXS only present in pydata_backend, but importing it is hidden by backend selection mechanism (env-var or context manager).

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.

3 participants