From aa3b2c836be0dcc1ad71df37a3c0c482c5b064e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20Sok=C3=B3=C5=82?= Date: Fri, 6 Dec 2024 09:33:55 +0000 Subject: [PATCH] Upgrade `finch-tensor` to 0.2.0 --- benchmarks_original/matmul_example.py | 2 +- benchmarks_original/mttkrp_example.py | 2 +- benchmarks_original/sddmm_example.py | 2 +- benchmarks_original/spmv_add_example.py | 2 +- ci/environment.yml | 2 +- examples/matmul_example.py | 2 +- examples/mttkrp_example.py | 2 +- examples/sddmm_example.py | 2 +- examples/sparse_finch.ipynb | 4 ++-- examples/spmv_add_example.py | 2 +- examples/triangles_example.py | 2 +- pixi.toml | 2 +- pyproject.toml | 2 +- sparse/tests/test_backends.py | 2 +- 14 files changed, 15 insertions(+), 15 deletions(-) diff --git a/benchmarks_original/matmul_example.py b/benchmarks_original/matmul_example.py index fc0e0d90..0066b464 100644 --- a/benchmarks_original/matmul_example.py +++ b/benchmarks_original/matmul_example.py @@ -29,7 +29,7 @@ a = sparse.asarray(a_sps) b = sparse.asarray(b_sps) - @sparse.compiled + @sparse.compiled() def sddmm_finch(a, b): return a @ b diff --git a/benchmarks_original/mttkrp_example.py b/benchmarks_original/mttkrp_example.py index ed910bf3..a9eb4c5f 100644 --- a/benchmarks_original/mttkrp_example.py +++ b/benchmarks_original/mttkrp_example.py @@ -31,7 +31,7 @@ D = sparse.asarray(np.array(D_sps, order="F")) C = sparse.asarray(np.array(C_sps, order="F")) - @sparse.compiled + @sparse.compiled() def mttkrp_finch(B, D, C): return sparse.sum(B[:, :, :, None] * D[None, None, :, :] * C[None, :, None, :], axis=(1, 2)) diff --git a/benchmarks_original/sddmm_example.py b/benchmarks_original/sddmm_example.py index 62bd7502..3984817a 100644 --- a/benchmarks_original/sddmm_example.py +++ b/benchmarks_original/sddmm_example.py @@ -30,7 +30,7 @@ a = sparse.asarray(np.array(a_sps, order="F")) b = sparse.asarray(np.array(b_sps, order="C")) - @sparse.compiled + @sparse.compiled() def sddmm_finch(s, a, b): return sparse.sum( s[:, :, None] * (a[:, None, :] * sparse.permute_dims(b, (1, 0))[None, :, :]), diff --git a/benchmarks_original/spmv_add_example.py b/benchmarks_original/spmv_add_example.py index 9e453306..0662019c 100644 --- a/benchmarks_original/spmv_add_example.py +++ b/benchmarks_original/spmv_add_example.py @@ -29,7 +29,7 @@ x = sparse.asarray(np.array(x_sps, order="C")) y = sparse.asarray(np.array(y_sps, order="C")) - @sparse.compiled + @sparse.compiled() def spmv_finch(A, x, y): return sparse.sum(A[:, None, :] * sparse.permute_dims(x, (1, 0))[None, :, :], axis=-1) + y diff --git a/ci/environment.yml b/ci/environment.yml index e86b34b7..749e1c5d 100644 --- a/ci/environment.yml +++ b/ci/environment.yml @@ -13,6 +13,6 @@ dependencies: - pytest-cov - pytest-xdist - pip: - - finch-tensor>=0.1.31 + - finch-tensor>=0.2.0 - finch-mlir>=0.0.2 - pytest-codspeed diff --git a/examples/matmul_example.py b/examples/matmul_example.py index fc0e0d90..0066b464 100644 --- a/examples/matmul_example.py +++ b/examples/matmul_example.py @@ -29,7 +29,7 @@ a = sparse.asarray(a_sps) b = sparse.asarray(b_sps) - @sparse.compiled + @sparse.compiled() def sddmm_finch(a, b): return a @ b diff --git a/examples/mttkrp_example.py b/examples/mttkrp_example.py index ed910bf3..a9eb4c5f 100644 --- a/examples/mttkrp_example.py +++ b/examples/mttkrp_example.py @@ -31,7 +31,7 @@ D = sparse.asarray(np.array(D_sps, order="F")) C = sparse.asarray(np.array(C_sps, order="F")) - @sparse.compiled + @sparse.compiled() def mttkrp_finch(B, D, C): return sparse.sum(B[:, :, :, None] * D[None, None, :, :] * C[None, :, None, :], axis=(1, 2)) diff --git a/examples/sddmm_example.py b/examples/sddmm_example.py index 62bd7502..3984817a 100644 --- a/examples/sddmm_example.py +++ b/examples/sddmm_example.py @@ -30,7 +30,7 @@ a = sparse.asarray(np.array(a_sps, order="F")) b = sparse.asarray(np.array(b_sps, order="C")) - @sparse.compiled + @sparse.compiled() def sddmm_finch(s, a, b): return sparse.sum( s[:, :, None] * (a[:, None, :] * sparse.permute_dims(b, (1, 0))[None, :, :]), diff --git a/examples/sparse_finch.ipynb b/examples/sparse_finch.ipynb index 4d100215..5bd5bfee 100644 --- a/examples/sparse_finch.ipynb +++ b/examples/sparse_finch.ipynb @@ -175,7 +175,7 @@ " D = sparse.asarray(np.array(D_sps, order=\"F\"))\n", " C = sparse.asarray(np.array(C_sps, order=\"F\"))\n", "\n", - " @sparse.compiled\n", + " @sparse.compiled()\n", " def mttkrp_finch(B, D, C):\n", " return sparse.sum(B[:, :, :, None] * D[None, None, :, :] * C[None, :, None, :], axis=(1, 2))\n", "\n", @@ -270,7 +270,7 @@ " a = sparse.asarray(np.array(a_sps, order=\"F\"))\n", " b = sparse.asarray(np.array(b_sps, order=\"C\"))\n", "\n", - " @sparse.compiled\n", + " @sparse.compiled()\n", " def sddmm_finch(s, a, b):\n", " return sparse.sum(\n", " s[:, :, None] * (a[:, None, :] * sparse.permute_dims(b, (1, 0))[None, :, :]),\n", diff --git a/examples/spmv_add_example.py b/examples/spmv_add_example.py index 9e453306..0662019c 100644 --- a/examples/spmv_add_example.py +++ b/examples/spmv_add_example.py @@ -29,7 +29,7 @@ x = sparse.asarray(np.array(x_sps, order="C")) y = sparse.asarray(np.array(y_sps, order="C")) - @sparse.compiled + @sparse.compiled() def spmv_finch(A, x, y): return sparse.sum(A[:, None, :] * sparse.permute_dims(x, (1, 0))[None, :, :], axis=-1) + y diff --git a/examples/triangles_example.py b/examples/triangles_example.py index 97ee3f24..5fbbc7a0 100644 --- a/examples/triangles_example.py +++ b/examples/triangles_example.py @@ -23,7 +23,7 @@ a_sps = nx.to_scipy_sparse_array(G) a = sparse.asarray(a_sps) - # @sparse.compiled NOTE: blocked by https://github.com/willow-ahrens/Finch.jl/issues/615 + @sparse.compiled() def count_triangles_finch(a): return sparse.sum(a @ a * a) / 6 diff --git a/pixi.toml b/pixi.toml index 2420a4ac..14cbd70a 100644 --- a/pixi.toml +++ b/pixi.toml @@ -49,7 +49,7 @@ precompile = "python -c 'import finch'" [feature.finch.pypi-dependencies] scipy = ">=0.19" -finch-tensor = ">=0.1.31" +finch-tensor = ">=0.2.0" [feature.finch.activation.env] SPARSE_BACKEND = "Finch" diff --git a/pyproject.toml b/pyproject.toml index 1716ae13..cbf39ec6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -54,7 +54,7 @@ tests = [ tox = ["sparse[tests]", "tox"] notebooks = ["sparse[tests]", "nbmake", "matplotlib"] all = ["sparse[docs,tox,notebooks]", "matrepr"] -finch = ["finch-tensor>=0.1.35"] +finch = ["finch-tensor>=0.2.0"] [project.urls] Documentation = "https://sparse.pydata.org/" diff --git a/sparse/tests/test_backends.py b/sparse/tests/test_backends.py index c448362b..a87a834d 100644 --- a/sparse/tests/test_backends.py +++ b/sparse/tests/test_backends.py @@ -54,7 +54,7 @@ def test_finch_lazy_backend(backend): assert_equal(transposed.todense(), np_eye.T) - @sparse.compiled + @sparse.compiled() def my_fun(tns1, tns2): tmp = sparse.add(tns1, tns2) return sparse.sum(tmp, axis=0)