|
| 1 | +# Migration to the Finch Julia backend |
| 2 | +To switch to the Finch Julia backend, set the environment variable `SPARSE_BACKEND="Finch"`, then continue using. |
| 3 | + |
| 4 | +While this is largely compatible with the Array API, support for some functions may not be present, and API compatibility isn't strictly preserved with the default (Numba) backend. |
| 5 | + |
| 6 | +However, the new backend has a large performance benefit over the default backend. Below, you will find a table of common invocations, with their equivalents in the Finch Julia backend. The most common change is a standard API for construction of arrays. |
| 7 | + |
| 8 | +| Numba Backend<br>(`SPARSE_BACKEND="Numba"`) | Finch Julia Backend<br>(`SPARSE_BACKEND="Finch"`) | Notes | |
| 9 | +|---------------------------------------------|----------------------------------------------------|-------| |
| 10 | +| `sparse.COO.from_numpy(arr, fill_value=fv)`<br>`sparse.COO.from_scipy(arr)`<br>`sparse.COO(x)` | `sparse.asarray(x, format="coo", [fill_value=fv])` | Doesn't support pulling out individual arrays | |
| 11 | +| `sparse.GCXS.from_numpy(arr, fill_value=fv)`<br>`sparse.GCXS.from_scipy(arr)`<br>`sparse.GCXS(x)` | `sparse.asarray(x, format="csf", [fill_value=fv])` | Format might not be a 1:1 match | |
| 12 | +| `sparse.DOK.from_numpy(arr, fill_value=fv)`<br>`sparse.DOK.from_scipy(arr)`<br>`sparse.DOK(x)` | `sparse.asarray(x, format="dok", [fill_value=fv])` | Format might not be a 1:1 match | |
| 13 | + |
| 14 | +Most things work as expected, with the following exceptions, which aren't defined yet for Finch: |
| 15 | + |
| 16 | +* `sparse.broadcast_to` |
| 17 | +* `sparse.solve` |
| 18 | +* Statistical functions: `mean`, `std`, `var` |
| 19 | +* `sparse.isdtype` |
| 20 | +* `sparse.reshape` |
| 21 | +* Some elementwise functions |
| 22 | +* Manipulation functions: `concat`, `expand_dims`, `squeeze`, `flip`, `roll`, `stack` |
| 23 | +* `arg*` functions: `argmin`, `argmax` |
| 24 | +* Sorting functions: `sort`, `argsort` |
| 25 | + |
| 26 | +IEEE-754 compliance is hard to maintain with sparse arrays in general. This is now even more true of the Julia backend, which trades off performance for IEEE-754 compatibility. |
0 commit comments