Skip to content

Commit d47b87a

Browse files
authored
Add Array API tests for Numba backend. (#688)
1 parent 4ef54e3 commit d47b87a

File tree

5 files changed

+120
-5
lines changed

5 files changed

+120
-5
lines changed

.github/workflows/ci.yml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,10 @@ jobs:
142142
run: |
143143
source ci/test_examples.sh
144144
array_api_tests:
145+
strategy:
146+
matrix:
147+
backend: ['Numba', 'Finch']
148+
fail-fast: false
145149
runs-on: ubuntu-latest
146150
steps:
147151
- name: Checkout Repo
@@ -150,7 +154,7 @@ jobs:
150154
uses: actions/checkout@v4
151155
with:
152156
repository: data-apis/array-api-tests
153-
ref: '3cf8ef654c456d9fd1633d64e67b4470465940e9' # Latest commit as of 2024-04-09
157+
ref: '33f2d2ea2f3dd2b3ceeeb4519d55e08096184149' # Latest commit as of 2024-05-29
154158
submodules: 'true'
155159
path: 'array-api-tests'
156160
- name: Set up Python
@@ -159,17 +163,17 @@ jobs:
159163
python-version: '3.11'
160164
- name: Install build and test dependencies from PyPI
161165
run: |
162-
python -m pip install -r array-api-tests/requirements.txt
166+
python -m pip install pytest-xdist -r array-api-tests/requirements.txt
163167
- name: Build and install Sparse
164168
run: |
165169
python -m pip install '.[finch]'
166170
- name: Run the test suite
167171
env:
168172
ARRAY_API_TESTS_MODULE: sparse
169-
SPARSE_BACKEND: Finch
173+
SPARSE_BACKEND: ${{ matrix.backend }}
170174
run: |
171175
cd ${GITHUB_WORKSPACE}/array-api-tests
172-
pytest array_api_tests -v -c pytest.ini --ci --max-examples=2 --derandomize --disable-deadline -o xfail_strict=True --xfails-file ${GITHUB_WORKSPACE}/ci/array-api-xfails.txt --skips-file ${GITHUB_WORKSPACE}/ci/array-api-skips.txt
176+
pytest array_api_tests -v -c pytest.ini -n 4 --ci --max-examples=2 --derandomize --disable-deadline -o xfail_strict=True --xfails-file ${GITHUB_WORKSPACE}/ci/${{ matrix.backend }}-array-api-xfails.txt --skips-file ${GITHUB_WORKSPACE}/ci/${{ matrix.backend }}-array-api-skips.txt
173177
on:
174178
# Trigger the workflow on push or pull request,
175179
# but only for the main branch
File renamed without changes.

ci/array-api-xfails.txt renamed to ci/Finch-array-api-xfails.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ array_api_tests/test_data_type_functions.py::test_broadcast_to
135135
array_api_tests/test_data_type_functions.py::test_isdtype
136136
array_api_tests/test_data_type_functions.py::test_result_type
137137
# TODO: check error
138-
array_api_tests/test_data_type_functions.py::test_finfo[float32]
138+
array_api_tests/test_data_type_functions.py::test_finfo[Float32]
139139

140140
# test_has_names
141141

@@ -330,6 +330,7 @@ array_api_tests/test_statistical_functions.py::test_mean
330330
# TODO: check errors
331331
array_api_tests/test_statistical_functions.py::test_max
332332
array_api_tests/test_statistical_functions.py::test_min
333+
array_api_tests/test_statistical_functions.py::test_sum
333334
array_api_tests/test_statistical_functions.py::test_prod
334335

335336
# test_utility_functions

ci/Numba-array-api-skips.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
array_api_tests/test_operators_and_elementwise_functions.py::test_floor

ci/Numba-array-api-xfails.txt

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
array_api_tests/test_array_object.py::test_setitem
2+
array_api_tests/test_array_object.py::test_getitem_masking
3+
array_api_tests/test_array_object.py::test_setitem_masking
4+
array_api_tests/test_creation_functions.py::test_arange
5+
array_api_tests/test_creation_functions.py::test_linspace
6+
array_api_tests/test_creation_functions.py::test_meshgrid
7+
array_api_tests/test_data_type_functions.py::test_finfo[float32]
8+
array_api_tests/test_data_type_functions.py::test_isdtype
9+
array_api_tests/test_has_names.py::test_has_names[linalg-cholesky]
10+
array_api_tests/test_has_names.py::test_has_names[linalg-cross]
11+
array_api_tests/test_has_names.py::test_has_names[linalg-det]
12+
array_api_tests/test_has_names.py::test_has_names[linalg-diagonal]
13+
array_api_tests/test_has_names.py::test_has_names[linalg-eigh]
14+
array_api_tests/test_has_names.py::test_has_names[linalg-eigvalsh]
15+
array_api_tests/test_has_names.py::test_has_names[linalg-inv]
16+
array_api_tests/test_has_names.py::test_has_names[linalg-matmul]
17+
array_api_tests/test_has_names.py::test_has_names[linalg-matrix_norm]
18+
array_api_tests/test_has_names.py::test_has_names[linalg-matrix_power]
19+
array_api_tests/test_has_names.py::test_has_names[linalg-matrix_rank]
20+
array_api_tests/test_has_names.py::test_has_names[linalg-matrix_transpose]
21+
array_api_tests/test_has_names.py::test_has_names[linalg-outer]
22+
array_api_tests/test_has_names.py::test_has_names[linalg-pinv]
23+
array_api_tests/test_has_names.py::test_has_names[linalg-qr]
24+
array_api_tests/test_has_names.py::test_has_names[linalg-slogdet]
25+
array_api_tests/test_has_names.py::test_has_names[linalg-solve]
26+
array_api_tests/test_has_names.py::test_has_names[linalg-svd]
27+
array_api_tests/test_has_names.py::test_has_names[linalg-svdvals]
28+
array_api_tests/test_has_names.py::test_has_names[linalg-tensordot]
29+
array_api_tests/test_has_names.py::test_has_names[linalg-trace]
30+
array_api_tests/test_has_names.py::test_has_names[linalg-vecdot]
31+
array_api_tests/test_has_names.py::test_has_names[linalg-vector_norm]
32+
array_api_tests/test_has_names.py::test_has_names[set-unique_all]
33+
array_api_tests/test_has_names.py::test_has_names[set-unique_inverse]
34+
array_api_tests/test_has_names.py::test_has_names[creation-arange]
35+
array_api_tests/test_has_names.py::test_has_names[creation-from_dlpack]
36+
array_api_tests/test_has_names.py::test_has_names[creation-linspace]
37+
array_api_tests/test_has_names.py::test_has_names[creation-meshgrid]
38+
array_api_tests/test_has_names.py::test_has_names[sorting-argsort]
39+
array_api_tests/test_has_names.py::test_has_names[data_type-isdtype]
40+
array_api_tests/test_has_names.py::test_has_names[elementwise-conj]
41+
array_api_tests/test_has_names.py::test_has_names[array_method-__dlpack__]
42+
array_api_tests/test_has_names.py::test_has_names[array_method-__dlpack_device__]
43+
array_api_tests/test_has_names.py::test_has_names[array_method-__setitem__]
44+
array_api_tests/test_has_names.py::test_has_names[array_method-to_device]
45+
array_api_tests/test_has_names.py::test_has_names[array_attribute-device]
46+
array_api_tests/test_has_names.py::test_has_names[array_attribute-mT]
47+
array_api_tests/test_indexing_functions.py::test_take
48+
array_api_tests/test_linalg.py::test_vecdot
49+
array_api_tests/test_manipulation_functions.py::test_concat
50+
array_api_tests/test_operators_and_elementwise_functions.py::test_add[__add__(x, s)]
51+
array_api_tests/test_operators_and_elementwise_functions.py::test_add[__iadd__(x, s)]
52+
array_api_tests/test_operators_and_elementwise_functions.py::test_bitwise_left_shift[__lshift__(x, s)]
53+
array_api_tests/test_operators_and_elementwise_functions.py::test_bitwise_left_shift[__ilshift__(x, s)]
54+
array_api_tests/test_operators_and_elementwise_functions.py::test_bitwise_right_shift[__rshift__(x, s)]
55+
array_api_tests/test_operators_and_elementwise_functions.py::test_bitwise_right_shift[__irshift__(x, s)]
56+
array_api_tests/test_operators_and_elementwise_functions.py::test_ceil
57+
array_api_tests/test_operators_and_elementwise_functions.py::test_conj
58+
array_api_tests/test_operators_and_elementwise_functions.py::test_divide[__truediv__(x, s)]
59+
array_api_tests/test_operators_and_elementwise_functions.py::test_imag
60+
array_api_tests/test_operators_and_elementwise_functions.py::test_multiply[__mul__(x, s)]
61+
array_api_tests/test_operators_and_elementwise_functions.py::test_multiply[__imul__(x, s)]
62+
array_api_tests/test_operators_and_elementwise_functions.py::test_pow[__pow__(x, s)]
63+
array_api_tests/test_operators_and_elementwise_functions.py::test_pow[__ipow__(x, s)]
64+
array_api_tests/test_operators_and_elementwise_functions.py::test_real
65+
array_api_tests/test_operators_and_elementwise_functions.py::test_subtract[__sub__(x, s)]
66+
array_api_tests/test_operators_and_elementwise_functions.py::test_subtract[__isub__(x, s)]
67+
array_api_tests/test_operators_and_elementwise_functions.py::test_trunc
68+
array_api_tests/test_searching_functions.py::test_argmax
69+
array_api_tests/test_searching_functions.py::test_argmin
70+
array_api_tests/test_searching_functions.py::test_nonzero_zerodim_error
71+
array_api_tests/test_set_functions.py::test_unique_all
72+
array_api_tests/test_set_functions.py::test_unique_inverse
73+
array_api_tests/test_signatures.py::test_func_signature[unique_all]
74+
array_api_tests/test_signatures.py::test_func_signature[unique_inverse]
75+
array_api_tests/test_signatures.py::test_func_signature[arange]
76+
array_api_tests/test_signatures.py::test_func_signature[empty]
77+
array_api_tests/test_signatures.py::test_func_signature[empty_like]
78+
array_api_tests/test_signatures.py::test_func_signature[eye]
79+
array_api_tests/test_signatures.py::test_func_signature[from_dlpack]
80+
array_api_tests/test_signatures.py::test_func_signature[full]
81+
array_api_tests/test_signatures.py::test_func_signature[full_like]
82+
array_api_tests/test_signatures.py::test_func_signature[linspace]
83+
array_api_tests/test_signatures.py::test_func_signature[meshgrid]
84+
array_api_tests/test_signatures.py::test_func_signature[ones]
85+
array_api_tests/test_signatures.py::test_func_signature[ones_like]
86+
array_api_tests/test_signatures.py::test_func_signature[zeros]
87+
array_api_tests/test_signatures.py::test_func_signature[zeros_like]
88+
array_api_tests/test_signatures.py::test_func_signature[broadcast_to]
89+
array_api_tests/test_signatures.py::test_func_signature[squeeze]
90+
array_api_tests/test_signatures.py::test_func_signature[argsort]
91+
array_api_tests/test_signatures.py::test_func_signature[sort]
92+
array_api_tests/test_signatures.py::test_func_signature[isdtype]
93+
array_api_tests/test_signatures.py::test_func_signature[conj]
94+
array_api_tests/test_signatures.py::test_array_method_signature[__dlpack__]
95+
array_api_tests/test_signatures.py::test_array_method_signature[__dlpack_device__]
96+
array_api_tests/test_signatures.py::test_array_method_signature[__setitem__]
97+
array_api_tests/test_signatures.py::test_array_method_signature[to_device]
98+
array_api_tests/test_sorting_functions.py::test_argsort
99+
array_api_tests/test_sorting_functions.py::test_sort
100+
array_api_tests/test_special_cases.py::test_unary[isfinite(x_i is NaN) -> False]
101+
array_api_tests/test_special_cases.py::test_empty_arrays[prod]
102+
array_api_tests/test_special_cases.py::test_nan_propagation[max]
103+
array_api_tests/test_special_cases.py::test_nan_propagation[mean]
104+
array_api_tests/test_special_cases.py::test_nan_propagation[min]
105+
array_api_tests/test_special_cases.py::test_nan_propagation[prod]
106+
array_api_tests/test_special_cases.py::test_nan_propagation[std]
107+
array_api_tests/test_special_cases.py::test_nan_propagation[sum]
108+
array_api_tests/test_special_cases.py::test_nan_propagation[var]
109+
array_api_tests/test_statistical_functions.py::test_mean

0 commit comments

Comments
 (0)