Skip to content
Merged
Show file tree
Hide file tree
Changes from 13 commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
9a6554a
CUDA intrinsics tests: correct np.float -> np.float16
gmarkall Nov 24, 2022
83d08f6
TestLinalgSvd.test_no_input_mutation: use reconstruction if necessary
gmarkall Dec 22, 2022
4c619e6
test_comp_nest_with_dependency: skip on NumPy 1.24
gmarkall Nov 24, 2022
f5f5b74
Avoid use of np.bool in stencilparfor.py
gmarkall Nov 24, 2022
90afbca
test_hypot: Tweak regex so it matches NumPy 1.24
gmarkall Nov 24, 2022
99966f4
Don't test summing with timedelta dtype
gmarkall Nov 24, 2022
937f7f8
Replace use of deprecated np.bool with np.bool_
gmarkall Nov 24, 2022
cd867db
Overload np.MachAr only for NumPy < 1.24
gmarkall Nov 24, 2022
8d8abd1
_internal.c: Remove NPY_API_VERSION checks
gmarkall Nov 25, 2022
915a237
init_ufunc_dispatch: Handle unexpected ufunc methods gracefully
gmarkall Jan 3, 2023
da739e1
init_ufunc_dispatch: Update for NumPy 1.24
gmarkall Jan 3, 2023
a4a0b8d
Update NumPy version support documentation
gmarkall Jan 3, 2023
9ffee5d
Mody test matrix to test NumPy versions 1.21-1.24
gmarkall Jan 3, 2023
334be3b
Docs: Correct NumPy upper bound for 0.57 release
gmarkall Jan 11, 2023
1304e64
Update comment on skipped test
gmarkall Jan 11, 2023
444fa1a
Merge remote-tracking branch 'numba/main' into np-124-review
gmarkall Jan 27, 2023
a0a8300
Correct name of ufunc method in fastcall flags error
gmarkall Jan 27, 2023
fbec218
Merge remote-tracking branch 'numba/main' into np-124-review
gmarkall Feb 6, 2023
0d95edb
Merge remote-tracking branch 'numba/main' into np-124-review
gmarkall Feb 17, 2023
9d04211
Merge remote-tracking branch 'numba/main' into np-124-review
gmarkall Feb 28, 2023
2f72663
Merge remote-tracking branch 'numba/main' into np-124-review
gmarkall Mar 6, 2023
2d0f930
Use conda-forge for NumPy 1.24
gmarkall Mar 6, 2023
158033b
Attempt to correct syntax for NumPy package channel setting on Windows
gmarkall Mar 6, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 34 additions & 34 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ jobs:
name: macOS
vmImage: macos-11
matrix:
py38_np118:
py38_np121:
PYTHON: '3.8'
NUMPY: '1.18'
NUMPY: '1.21'
CONDA_ENV: 'azure_ci'
TEST_START_INDEX: 0
py310_np123:
py310_np124:
PYTHON: '3.10'
NUMPY: '1.23'
NUMPY: '1.24'
CONDA_ENV: 'azure_ci'
TEST_THREADING: 'tbb'
TEST_START_INDEX: 1
Expand All @@ -29,89 +29,89 @@ jobs:
name: Linux
vmImage: ubuntu-20.04
matrix:
py38_np118_vanilla:
py38_np121_vanilla:
PYTHON: '3.8'
NUMPY: '1.18'
NUMPY: '1.21'
CONDA_ENV: azure_ci
VANILLA_INSTALL: yes
TEST_START_INDEX: 2
py38_np118_cov:
py38_np121_cov:
PYTHON: '3.8'
NUMPY: '1.18'
NUMPY: '1.21'
CONDA_ENV: azure_ci
RUN_COVERAGE: yes
RUN_FLAKE8: yes
RUN_MYPY: yes
TEST_START_INDEX: 3
py38_np119_tbb:
py38_np122_tbb:
PYTHON: '3.8'
NUMPY: '1.19.2=*_0'
NUMPY: '1.22'
CONDA_ENV: azure_ci
TEST_THREADING: 'tbb'
TEST_START_INDEX: 4
py38_np119_omp:
py38_np122_omp:
PYTHON: '3.8'
NUMPY: '1.19.2=*_0'
NUMPY: '1.22'
CONDA_ENV: azure_ci
TEST_THREADING: omp
TEST_START_INDEX: 5
py38_np119_workqueue:
py38_np122_workqueue:
PYTHON: '3.8'
NUMPY: '1.19.2=*_0'
NUMPY: '1.22'
CONDA_ENV: azure_ci
TEST_THREADING: workqueue
TEST_START_INDEX: 6
py38_np120_doc:
py38_np123_doc:
PYTHON: '3.8'
NUMPY: '1.20'
NUMPY: '1.23'
CONDA_ENV: azure_ci
BUILD_DOC: yes
TEST_START_INDEX: 7
py38_np120:
py38_np122:
PYTHON: '3.8'
NUMPY: '1.20'
NUMPY: '1.22'
CONDA_ENV: azure_ci
TEST_START_INDEX: 8
py38_np120_svml:
py38_np123_svml:
PYTHON: '3.8'
NUMPY: '1.20'
NUMPY: '1.23'
CONDA_ENV: azure_ci
TEST_SVML: yes
TEST_START_INDEX: 9
py38_np122:
py38_np124:
PYTHON: '3.8'
NUMPY: '1.22'
NUMPY: '1.24'
CONDA_ENV: azure_ci
TEST_START_INDEX: 10
py39_np119:
py39_np123:
PYTHON: '3.9'
NUMPY: '1.19.2=*_0'
NUMPY: '1.23'
CONDA_ENV: azure_ci
TEST_START_INDEX: 11
py39_np120_typeguard:
py39_np123_typeguard:
PYTHON: '3.9'
NUMPY: '1.20'
NUMPY: '1.23'
CONDA_ENV: azure_ci
RUN_TYPEGUARD: yes
TEST_START_INDEX: 12
py39_np121:
py39_np122:
PYTHON: '3.9'
NUMPY: '1.21'
NUMPY: '1.22'
CONDA_ENV: azure_ci
TEST_START_INDEX: 13
py39_np123:
py39_np124:
PYTHON: '3.9'
NUMPY: '1.23'
NUMPY: '1.24'
CONDA_ENV: azure_ci
TEST_START_INDEX: 14
py310_np121:
py310_np123:
PYTHON: '3.10'
NUMPY: '1.21'
NUMPY: '1.23'
CONDA_ENV: azure_ci
TEST_START_INDEX: 15
py310_np123:
py310_np124:
PYTHON: '3.10'
NUMPY: '1.23'
NUMPY: '1.24'
CONDA_ENV: azure_ci
TEST_START_INDEX: 16

Expand Down
8 changes: 4 additions & 4 deletions buildscripts/azure/azure-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ jobs:
vmImage: ${{ parameters.vmImage }}
strategy:
matrix:
py310_np123:
py310_np124:
PYTHON: '3.10'
NUMPY: '1.23'
NUMPY: '1.24'
CONDA_ENV: 'testenv'
TEST_START_INDEX: 17
py38_np118:
py38_np121:
PYTHON: '3.8'
NUMPY: '1.18'
NUMPY: '1.21'
CONDA_ENV: 'testenv'
TEST_START_INDEX: 18

Expand Down
2 changes: 1 addition & 1 deletion buildscripts/gpuci/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ fi;
# Test with different NumPy versions with each toolkit (it's not worth testing
# the Cartesian product of versions here, we just need to test with different
# CUDA and NumPy versions).
declare -A CTK_NUMPY_VMAP=( ["11.0"]="1.19" ["11.1"]="1.21" ["11.2"]="1.22" ["11.5"]="1.23")
declare -A CTK_NUMPY_VMAP=( ["11.0"]="1.21" ["11.1"]="1.22" ["11.2"]="1.23" ["11.5"]="1.24")
NUMPY_VER="${CTK_NUMPY_VMAP[$CUDA_TOOLKIT_VER]}"


Expand Down
4 changes: 2 additions & 2 deletions docs/source/user/installing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Installation
Compatibility
-------------

Numba is compatible with Python 3.8--3.10, and NumPy versions 1.18 or later.
Numba is compatible with Python 3.8--3.10, and NumPy versions 1.21--1.24.

Our supported platforms are:

Expand Down Expand Up @@ -257,7 +257,7 @@ information.
+----------++--------------+---------------------------+----------------------------+------------------------------+-------------------+-----------------------------+
| Numba | Release date | Python | NumPy | llvmlite | LLVM | TBB |
+===========+==============+===========================+============================+==============================+===================+=============================+
| 0.57.x | TBC | 3.8.x <= version < 3.12 | 1.19 <= version < 1.24 | 0.40.x | 11.x | 2021.x |
| 0.57.0 | TBC | 3.8.x <= version < 3.12 | 1.21 <= version < 1.24 | 0.40.x | 11.x | 2021.x |
Comment thread
stuartarchibald marked this conversation as resolved.
Resolved
+-----------+--------------+---------------------------+----------------------------+------------------------------+-------------------+-----------------------------+
| 0.56.4 | 2022-11-03 | 3.7.x <= version < 3.11 | 1.18 <= version < 1.24 | 0.39.x | 11.x | 2021.x |
+-----------+--------------+---------------------------+----------------------------+------------------------------+-------------------+-----------------------------+
Expand Down
4 changes: 2 additions & 2 deletions numba/cuda/tests/cudapy/test_intrinsics.py
Original file line number Diff line number Diff line change
Expand Up @@ -833,7 +833,7 @@ def test_hmax(self):
arg2 = np.float16(4.)
compiled[1, 1](ary, arg1, arg2)
np.testing.assert_allclose(ary[0], arg2)
arg1 = np.float(5.)
arg1 = np.float16(5.)
compiled[1, 1](ary, arg1, arg2)
np.testing.assert_allclose(ary[0], arg1)

Expand All @@ -845,7 +845,7 @@ def test_hmin(self):
arg2 = np.float16(4.)
compiled[1, 1](ary, arg1, arg2)
np.testing.assert_allclose(ary[0], arg1)
arg1 = np.float(5.)
arg1 = np.float16(5.)
compiled[1, 1](ary, arg1, arg2)
np.testing.assert_allclose(ary[0], arg2)

Expand Down
4 changes: 4 additions & 0 deletions numba/np/arraymath.py
Original file line number Diff line number Diff line change
Expand Up @@ -3964,6 +3964,10 @@ def histogram_impl(a, bins=10, range=None):
# This module is imported under the compiler lock which should deal with the
# lack of thread safety in the warning filter.
def _gen_np_machar():
# NumPy 1.24 removed np.MachAr
if numpy_version >= (1, 24):
return

np122plus = numpy_version >= (1, 22)
w = None
with warnings.catch_warnings(record=True) as w:
Expand Down
25 changes: 11 additions & 14 deletions numba/np/ufunc/_internal.c
Original file line number Diff line number Diff line change
Expand Up @@ -306,9 +306,7 @@ static struct _ufunc_dispatch {
PyCFunctionWithKeywords ufunc_accumulate;
PyCFunctionWithKeywords ufunc_reduceat;
PyCFunctionWithKeywords ufunc_outer;
#if NPY_API_VERSION >= 0x00000008
PyCFunction ufunc_at;
#endif
} ufunc_dispatch;

static int
Expand All @@ -324,10 +322,8 @@ init_ufunc_dispatch(int *numpy_uses_fastcall)
if (strncmp(crnt_name, "accumulate", 11) == 0) {
ufunc_dispatch.ufunc_accumulate =
(PyCFunctionWithKeywords)crnt->ml_meth;
#if NPY_API_VERSION >= 0x00000008
} else if (strncmp(crnt_name, "at", 3) == 0) {
ufunc_dispatch.ufunc_at = crnt->ml_meth;
#endif
} else {
result = -1;
}
Expand All @@ -347,10 +343,15 @@ init_ufunc_dispatch(int *numpy_uses_fastcall)
} else if (strncmp(crnt_name, "reduceat", 9) == 0) {
ufunc_dispatch.ufunc_reduceat =
(PyCFunctionWithKeywords)crnt->ml_meth;
} else if (strncmp(crnt_name, "resolve_dtypes", 15) == 0) {
/* Ignored */
} else {
result = -1;
}
break;
case '_':
// We ignore private methods
break;
default:
result = -1; /* Unknown method */
}
Expand All @@ -362,6 +363,8 @@ init_ufunc_dispatch(int *numpy_uses_fastcall)
*numpy_uses_fastcall = crnt->ml_flags & METH_FASTCALL;
}
else if (*numpy_uses_fastcall != (crnt->ml_flags & METH_FASTCALL)) {
PyErr_SetString(PyExc_RuntimeError,
"ufunc.at() flags do not match numpy_uses_fastcall");
Comment thread
stuartarchibald marked this conversation as resolved.
Resolved
return -1;
}
}
Expand All @@ -372,11 +375,13 @@ init_ufunc_dispatch(int *numpy_uses_fastcall)
&& (ufunc_dispatch.ufunc_accumulate != NULL)
&& (ufunc_dispatch.ufunc_reduceat != NULL)
&& (ufunc_dispatch.ufunc_outer != NULL)
#if NPY_API_VERSION >= 0x00000008
&& (ufunc_dispatch.ufunc_at != NULL)
#endif
);
} else {
char const * const fmt = "Unexpected ufunc method %s()";
PyErr_Format(PyExc_RuntimeError, fmt, crnt_name);
Comment thread
stuartarchibald marked this conversation as resolved.
Resolved
}

return result;
}

Expand Down Expand Up @@ -446,13 +451,11 @@ dufunc_outer_fast(PyDUFuncObject * self,
}


#if NPY_API_VERSION >= 0x00000008
static PyObject *
dufunc_at(PyDUFuncObject * self, PyObject * args)
{
return ufunc_dispatch.ufunc_at((PyObject*)self->ufunc, args);
}
#endif

static PyObject *
dufunc__compile_for_args(PyDUFuncObject * self, PyObject * args,
Expand Down Expand Up @@ -630,11 +633,9 @@ static struct PyMethodDef dufunc_methods[] = {
{"outer",
(PyCFunction)dufunc_outer,
METH_VARARGS | METH_KEYWORDS, NULL},
#if NPY_API_VERSION >= 0x00000008
{"at",
(PyCFunction)dufunc_at,
METH_VARARGS, NULL},
#endif
{"_compile_for_args",
(PyCFunction)dufunc__compile_for_args,
METH_VARARGS | METH_KEYWORDS,
Expand Down Expand Up @@ -664,11 +665,9 @@ static struct PyMethodDef dufunc_methods_fast[] = {
{"outer",
(PyCFunction)dufunc_outer_fast,
METH_FASTCALL | METH_KEYWORDS, NULL},
#if NPY_API_VERSION >= 0x00000008
{"at",
(PyCFunction)dufunc_at,
METH_VARARGS, NULL},
#endif
{"_compile_for_args",
(PyCFunction)dufunc__compile_for_args,
METH_VARARGS | METH_KEYWORDS,
Expand Down Expand Up @@ -837,9 +836,7 @@ MOD_INIT(_internal)
if (PyModule_AddIntMacro(m, PyUFunc_One)
|| PyModule_AddIntMacro(m, PyUFunc_Zero)
|| PyModule_AddIntMacro(m, PyUFunc_None)
#if NPY_API_VERSION >= 0x00000007
|| PyModule_AddIntMacro(m, PyUFunc_ReorderableNone)
#endif
)
return MOD_ERROR_VAL;

Expand Down
7 changes: 6 additions & 1 deletion numba/stencils/stencilparfor.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
find_callname, require, find_const, GuardException)
from numba.core.errors import NumbaValueError
from numba.core.utils import OPERATORS_TO_BUILTINS
from numba.np import numpy_support


def _compute_last_ind(dim_size, index_const):
Expand Down Expand Up @@ -264,7 +265,11 @@ def _mk_stencil_parfor(self, label, in_args, out_arr, stencil_ir,
dtype_g_np_assign = ir.Assign(dtype_g_np, dtype_g_np_var, loc)
init_block.body.append(dtype_g_np_assign)

dtype_np_attr_call = ir.Expr.getattr(dtype_g_np_var, return_type.dtype.name, loc)
return_type_name = numpy_support.as_dtype(
return_type.dtype).type.__name__
if return_type_name == 'bool':
return_type_name = 'bool_'
dtype_np_attr_call = ir.Expr.getattr(dtype_g_np_var, return_type_name, loc)
dtype_attr_var = ir.Var(scope, mk_unique_var("$np_attr_attr"), loc)
self.typemap[dtype_attr_var.name] = types.functions.NumberClass(return_type.dtype)
dtype_attr_assign = ir.Assign(dtype_np_attr_call, dtype_attr_var, loc)
Expand Down
15 changes: 6 additions & 9 deletions numba/tests/test_array_methods.py
Original file line number Diff line number Diff line change
Expand Up @@ -1337,7 +1337,7 @@ def test_sum_dtype_kws(self):
pyfunc = array_sum_dtype_kws
cfunc = jit(nopython=True)(pyfunc)
all_dtypes = [np.float64, np.float32, np.int64, np.int32, np.uint32,
np.uint64, np.complex64, np.complex128, TIMEDELTA_M]
np.uint64, np.complex64, np.complex128]
all_test_arrays = [
[np.ones((7, 6, 5, 4, 3), arr_dtype),
np.ones(1, arr_dtype),
Expand All @@ -1351,24 +1351,23 @@ def test_sum_dtype_kws(self):
np.dtype('uint32'): [np.float64, np.int64, np.float32],
np.dtype('uint64'): [np.float64, np.int64],
np.dtype('complex64'): [np.complex64, np.complex128],
np.dtype('complex128'): [np.complex128],
np.dtype(TIMEDELTA_M): [np.dtype(TIMEDELTA_M)]}
Comment thread
stuartarchibald marked this conversation as resolved.
Resolved
np.dtype('complex128'): [np.complex128]}

for arr_list in all_test_arrays:
for arr in arr_list:
for out_dtype in out_dtypes[arr.dtype]:
subtest_str = ("Testing np.sum with {} input and {} output"
.format(arr.dtype, out_dtype))
with self.subTest(subtest_str):
self.assertPreciseEqual(pyfunc(arr, dtype=out_dtype),
cfunc(arr, dtype=out_dtype))
self.assertPreciseEqual(pyfunc(arr, dtype=out_dtype),
cfunc(arr, dtype=out_dtype))

def test_sum_axis_dtype_kws(self):
""" test sum with axis and dtype parameters over a whole range of dtypes """
pyfunc = array_sum_axis_dtype_kws
cfunc = jit(nopython=True)(pyfunc)
all_dtypes = [np.float64, np.float32, np.int64, np.int32, np.uint32,
np.uint64, np.complex64, np.complex128, TIMEDELTA_M]
np.uint64, np.complex64, np.complex128]
all_test_arrays = [
[np.ones((7, 6, 5, 4, 3), arr_dtype),
np.ones(1, arr_dtype),
Expand All @@ -1382,9 +1381,7 @@ def test_sum_axis_dtype_kws(self):
np.dtype('uint32'): [np.float64, np.int64, np.float32],
np.dtype('uint64'): [np.float64, np.uint64],
np.dtype('complex64'): [np.complex64, np.complex128],
np.dtype('complex128'): [np.complex128],
np.dtype(TIMEDELTA_M): [np.dtype(TIMEDELTA_M)],
np.dtype(TIMEDELTA_Y): [np.dtype(TIMEDELTA_Y)]}
np.dtype('complex128'): [np.complex128]}

for arr_list in all_test_arrays:
for arr in arr_list:
Expand Down
Loading