OBS-URL: https://build.opensuse.org/package/show/devel:languages:python:numeric/python-numba?expand=0&rev=97
This commit is contained in:
commit
23a3a6d23d
23
.gitattributes
vendored
Normal file
23
.gitattributes
vendored
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
## Default LFS
|
||||||
|
*.7z filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.bsp filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.gem filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.gz filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.jar filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.lz filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.lzma filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.obscpio filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.oxt filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.pdf filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.png filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.rpm filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.tbz filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.tbz2 filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.tgz filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.ttf filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.txz filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.whl filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.xz filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.zip filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.zst filter=lfs diff=lfs merge=lfs -text
|
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
.osc
|
5
_multibuild
Normal file
5
_multibuild
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
<multibuild>
|
||||||
|
<package>test-py310</package>
|
||||||
|
<package>test-py311</package>
|
||||||
|
<package>test-py312</package>
|
||||||
|
</multibuild>
|
BIN
numba-0.59.1.tar.gz
(Stored with Git LFS)
Normal file
BIN
numba-0.59.1.tar.gz
(Stored with Git LFS)
Normal file
Binary file not shown.
3
numba-0.60.0.tar.gz
Normal file
3
numba-0.60.0.tar.gz
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:5df6158e5584eece5fc83294b949fd30b9f1125df7708862205217e068aabf16
|
||||||
|
size 2702171
|
389
numpy21.patch
Normal file
389
numpy21.patch
Normal file
@ -0,0 +1,389 @@
|
|||||||
|
From 5f2a3d60fc9c1e25bec9fd6de0b0b8bae6f142da Mon Sep 17 00:00:00 2001
|
||||||
|
From: kc611 <ckaustubhm06@gmail.com>
|
||||||
|
Date: Mon, 30 Sep 2024 23:08:18 +0530
|
||||||
|
Subject: [PATCH 01/22] Added NumPy 2.1 Support
|
||||||
|
|
||||||
|
---
|
||||||
|
numba/cpython/randomimpl.py | 6 ++-
|
||||||
|
numba/cuda/tests/cudapy/test_debug.py | 2 +-
|
||||||
|
numba/np/arrayobj.py | 6 +--
|
||||||
|
numba/np/math/numbers.py | 5 +++
|
||||||
|
numba/np/npyfuncs.py | 58 +++++++++++++++++----------
|
||||||
|
numba/np/old_arraymath.py | 2 +
|
||||||
|
numba/np/random/old_distributions.py | 4 +-
|
||||||
|
numba/np/ufunc_db.py | 36 +++++++++++++++++
|
||||||
|
numba/tests/test_array_methods.py | 19 ++++++---
|
||||||
|
9 files changed, 105 insertions(+), 33 deletions(-)
|
||||||
|
|
||||||
|
Index: numba-0.60.0/numba/cpython/randomimpl.py
|
||||||
|
===================================================================
|
||||||
|
--- numba-0.60.0.orig/numba/cpython/randomimpl.py
|
||||||
|
+++ numba-0.60.0/numba/cpython/randomimpl.py
|
||||||
|
@@ -17,7 +17,7 @@ from numba.core.imputils import (Registr
|
||||||
|
from numba.core.typing import signature
|
||||||
|
from numba.core import types, cgutils
|
||||||
|
from numba.core.errors import NumbaTypeError
|
||||||
|
-
|
||||||
|
+from numba.np.random._constants import LONG_MAX
|
||||||
|
|
||||||
|
registry = Registry('randomimpl')
|
||||||
|
lower = registry.lower
|
||||||
|
@@ -1798,6 +1798,10 @@ def zipf_impl(a):
|
||||||
|
U = 1.0 - np.random.random()
|
||||||
|
V = np.random.random()
|
||||||
|
X = int(math.floor(U ** (-1.0 / am1)))
|
||||||
|
+
|
||||||
|
+ if (X > LONG_MAX or X < 1.0):
|
||||||
|
+ continue
|
||||||
|
+
|
||||||
|
T = (1.0 + 1.0 / X) ** am1
|
||||||
|
if X >= 1 and V * X * (T - 1.0) / (b - 1.0) <= (T / b):
|
||||||
|
return X
|
||||||
|
Index: numba-0.60.0/numba/np/arrayobj.py
|
||||||
|
===================================================================
|
||||||
|
--- numba-0.60.0.orig/numba/np/arrayobj.py
|
||||||
|
+++ numba-0.60.0/numba/np/arrayobj.py
|
||||||
|
@@ -1932,17 +1932,23 @@ def numpy_geomspace(start, stop, num=50)
|
||||||
|
raise ValueError('Geometric sequence cannot include zero')
|
||||||
|
start = result_dtype(start)
|
||||||
|
stop = result_dtype(stop)
|
||||||
|
- both_imaginary = (start.real == 0) & (stop.real == 0)
|
||||||
|
- both_negative = (np.sign(start) == -1) & (np.sign(stop) == -1)
|
||||||
|
- out_sign = 1
|
||||||
|
- if both_imaginary:
|
||||||
|
- start = start.imag
|
||||||
|
- stop = stop.imag
|
||||||
|
- out_sign = 1j
|
||||||
|
- if both_negative:
|
||||||
|
- start = -start
|
||||||
|
- stop = -stop
|
||||||
|
- out_sign = -out_sign
|
||||||
|
+ if numpy_version < (2, 0):
|
||||||
|
+ both_imaginary = (start.real == 0) & (stop.real == 0)
|
||||||
|
+ both_negative = (np.sign(start) == -1) & (np.sign(stop) == -1)
|
||||||
|
+ out_sign = 1
|
||||||
|
+ if both_imaginary:
|
||||||
|
+ start = start.imag
|
||||||
|
+ stop = stop.imag
|
||||||
|
+ out_sign = 1j
|
||||||
|
+ if both_negative:
|
||||||
|
+ start = -start
|
||||||
|
+ stop = -stop
|
||||||
|
+ out_sign = -out_sign
|
||||||
|
+ else:
|
||||||
|
+ out_sign = np.sign(start)
|
||||||
|
+ start /= out_sign
|
||||||
|
+ stop /= out_sign
|
||||||
|
+
|
||||||
|
logstart = np.log10(start)
|
||||||
|
logstop = np.log10(stop)
|
||||||
|
result = np.logspace(logstart, logstop, num)
|
||||||
|
@@ -2144,11 +2150,18 @@ def array_reshape_vararg(context, builde
|
||||||
|
return array_reshape(context, builder, new_sig, new_args)
|
||||||
|
|
||||||
|
|
||||||
|
-@overload(np.reshape)
|
||||||
|
-def np_reshape(a, newshape):
|
||||||
|
- def np_reshape_impl(a, newshape):
|
||||||
|
- return a.reshape(newshape)
|
||||||
|
- return np_reshape_impl
|
||||||
|
+if numpy_version < (2, 1):
|
||||||
|
+ @overload(np.reshape)
|
||||||
|
+ def np_reshape(a, newshape):
|
||||||
|
+ def np_reshape_impl(a, newshape):
|
||||||
|
+ return a.reshape(newshape)
|
||||||
|
+ return np_reshape_impl
|
||||||
|
+else:
|
||||||
|
+ @overload(np.reshape)
|
||||||
|
+ def np_reshape(a, shape):
|
||||||
|
+ def np_reshape_impl(a, shape):
|
||||||
|
+ return a.reshape(shape)
|
||||||
|
+ return np_reshape_impl
|
||||||
|
|
||||||
|
|
||||||
|
@overload(np.resize)
|
||||||
|
Index: numba-0.60.0/numba/np/math/numbers.py
|
||||||
|
===================================================================
|
||||||
|
--- numba-0.60.0.orig/numba/np/math/numbers.py
|
||||||
|
+++ numba-0.60.0/numba/np/math/numbers.py
|
||||||
|
@@ -397,6 +397,11 @@ def int_abs_impl(context, builder, sig,
|
||||||
|
return impl_ret_untracked(context, builder, sig.return_type, res)
|
||||||
|
|
||||||
|
|
||||||
|
+def identity_impl(context, builder, sig, args):
|
||||||
|
+ [x] = args
|
||||||
|
+ return impl_ret_untracked(context, builder, sig.return_type, x)
|
||||||
|
+
|
||||||
|
+
|
||||||
|
def uint_abs_impl(context, builder, sig, args):
|
||||||
|
[x] = args
|
||||||
|
return impl_ret_untracked(context, builder, sig.return_type, x)
|
||||||
|
Index: numba-0.60.0/numba/np/npyfuncs.py
|
||||||
|
===================================================================
|
||||||
|
--- numba-0.60.0.orig/numba/np/npyfuncs.py
|
||||||
|
+++ numba-0.60.0/numba/np/npyfuncs.py
|
||||||
|
@@ -16,6 +16,7 @@ from numba.core import typing, types, er
|
||||||
|
from numba.core.extending import register_jitable
|
||||||
|
from numba.np import npdatetime
|
||||||
|
from numba.np.math import cmathimpl, mathimpl, numbers
|
||||||
|
+from numba.np.numpy_support import numpy_version
|
||||||
|
|
||||||
|
# some NumPy constants. Note that we could generate some of them using
|
||||||
|
# the math library, but having the values copied from npy_math seems to
|
||||||
|
@@ -580,29 +581,42 @@ def np_complex_sign_impl(context, builde
|
||||||
|
# equivalent to complex sign in NumPy's sign
|
||||||
|
# but implemented via selects, balancing the 4 cases.
|
||||||
|
_check_arity_and_homogeneity(sig, args, 1)
|
||||||
|
- op = args[0]
|
||||||
|
- ty = sig.args[0]
|
||||||
|
- float_ty = ty.underlying_float
|
||||||
|
|
||||||
|
- ZERO = context.get_constant(float_ty, 0.0)
|
||||||
|
- ONE = context.get_constant(float_ty, 1.0)
|
||||||
|
- MINUS_ONE = context.get_constant(float_ty, -1.0)
|
||||||
|
- NAN = context.get_constant(float_ty, float('nan'))
|
||||||
|
- result = context.make_complex(builder, ty)
|
||||||
|
- result.real = ZERO
|
||||||
|
- result.imag = ZERO
|
||||||
|
-
|
||||||
|
- cmp_sig = typing.signature(types.boolean, *[ty] * 2)
|
||||||
|
- cmp_args = [op, result._getvalue()]
|
||||||
|
- arg1_ge_arg2 = np_complex_ge_impl(context, builder, cmp_sig, cmp_args)
|
||||||
|
- arg1_eq_arg2 = np_complex_eq_impl(context, builder, cmp_sig, cmp_args)
|
||||||
|
- arg1_lt_arg2 = np_complex_lt_impl(context, builder, cmp_sig, cmp_args)
|
||||||
|
-
|
||||||
|
- real_when_ge = builder.select(arg1_eq_arg2, ZERO, ONE)
|
||||||
|
- real_when_nge = builder.select(arg1_lt_arg2, MINUS_ONE, NAN)
|
||||||
|
- result.real = builder.select(arg1_ge_arg2, real_when_ge, real_when_nge)
|
||||||
|
+ if numpy_version >= (2, 0):
|
||||||
|
+ # NumPy >= 2.0.0
|
||||||
|
+ def complex_sign(z):
|
||||||
|
+ abs = math.hypot(z.real, z.imag)
|
||||||
|
+ if abs == 0:
|
||||||
|
+ return 0 + 0j
|
||||||
|
+ else:
|
||||||
|
+ return z / abs
|
||||||
|
+
|
||||||
|
+ res = context.compile_internal(builder, complex_sign, sig, args)
|
||||||
|
+ return impl_ret_untracked(context, builder, sig.return_type, res)
|
||||||
|
+ else:
|
||||||
|
+ op = args[0]
|
||||||
|
+ ty = sig.args[0]
|
||||||
|
+ result = context.make_complex(builder, ty)
|
||||||
|
+ float_ty = ty.underlying_float
|
||||||
|
+
|
||||||
|
+ ZERO = context.get_constant(float_ty, 0.0)
|
||||||
|
+ ONE = context.get_constant(float_ty, 1.0)
|
||||||
|
+ MINUS_ONE = context.get_constant(float_ty, -1.0)
|
||||||
|
+ NAN = context.get_constant(float_ty, float('nan'))
|
||||||
|
+
|
||||||
|
+ result.real = ZERO
|
||||||
|
+ result.imag = ZERO
|
||||||
|
+ cmp_sig = typing.signature(types.boolean, *[ty] * 2)
|
||||||
|
+ cmp_args = [op, result._getvalue()]
|
||||||
|
+ arg1_ge_arg2 = np_complex_ge_impl(context, builder, cmp_sig, cmp_args)
|
||||||
|
+ arg1_eq_arg2 = np_complex_eq_impl(context, builder, cmp_sig, cmp_args)
|
||||||
|
+ arg1_lt_arg2 = np_complex_lt_impl(context, builder, cmp_sig, cmp_args)
|
||||||
|
+
|
||||||
|
+ real_when_ge = builder.select(arg1_eq_arg2, ZERO, ONE)
|
||||||
|
+ real_when_nge = builder.select(arg1_lt_arg2, MINUS_ONE, NAN)
|
||||||
|
+ result.real = builder.select(arg1_ge_arg2, real_when_ge, real_when_nge)
|
||||||
|
|
||||||
|
- return result._getvalue()
|
||||||
|
+ return result._getvalue()
|
||||||
|
|
||||||
|
|
||||||
|
########################################################################
|
||||||
|
Index: numba-0.60.0/numba/np/ufunc_db.py
|
||||||
|
===================================================================
|
||||||
|
--- numba-0.60.0.orig/numba/np/ufunc_db.py
|
||||||
|
+++ numba-0.60.0/numba/np/ufunc_db.py
|
||||||
|
@@ -583,16 +583,58 @@ def _fill_ufunc_db(ufunc_db):
|
||||||
|
'f->f': npyfuncs.np_real_floor_impl,
|
||||||
|
'd->d': npyfuncs.np_real_floor_impl,
|
||||||
|
}
|
||||||
|
+ if numpy_version >= (2, 1):
|
||||||
|
+ ufunc_db[np.floor].update({
|
||||||
|
+ '?->?': numbers.identity_impl,
|
||||||
|
+ 'b->b': numbers.identity_impl,
|
||||||
|
+ 'B->B': numbers.identity_impl,
|
||||||
|
+ 'h->h': numbers.identity_impl,
|
||||||
|
+ 'H->H': numbers.identity_impl,
|
||||||
|
+ 'i->i': numbers.identity_impl,
|
||||||
|
+ 'I->I': numbers.identity_impl,
|
||||||
|
+ 'l->l': numbers.identity_impl,
|
||||||
|
+ 'L->L': numbers.identity_impl,
|
||||||
|
+ 'q->q': numbers.identity_impl,
|
||||||
|
+ 'Q->Q': numbers.identity_impl,
|
||||||
|
+ })
|
||||||
|
|
||||||
|
ufunc_db[np.ceil] = {
|
||||||
|
'f->f': npyfuncs.np_real_ceil_impl,
|
||||||
|
'd->d': npyfuncs.np_real_ceil_impl,
|
||||||
|
}
|
||||||
|
+ if numpy_version >= (2, 1):
|
||||||
|
+ ufunc_db[np.ceil].update({
|
||||||
|
+ '?->?': numbers.identity_impl,
|
||||||
|
+ 'b->b': numbers.identity_impl,
|
||||||
|
+ 'B->B': numbers.identity_impl,
|
||||||
|
+ 'h->h': numbers.identity_impl,
|
||||||
|
+ 'H->H': numbers.identity_impl,
|
||||||
|
+ 'i->i': numbers.identity_impl,
|
||||||
|
+ 'I->I': numbers.identity_impl,
|
||||||
|
+ 'l->l': numbers.identity_impl,
|
||||||
|
+ 'L->L': numbers.identity_impl,
|
||||||
|
+ 'q->q': numbers.identity_impl,
|
||||||
|
+ 'Q->Q': numbers.identity_impl,
|
||||||
|
+ })
|
||||||
|
|
||||||
|
ufunc_db[np.trunc] = {
|
||||||
|
'f->f': npyfuncs.np_real_trunc_impl,
|
||||||
|
'd->d': npyfuncs.np_real_trunc_impl,
|
||||||
|
}
|
||||||
|
+ if numpy_version >= (2, 1):
|
||||||
|
+ ufunc_db[np.trunc].update({
|
||||||
|
+ '?->?': numbers.identity_impl,
|
||||||
|
+ 'b->b': numbers.identity_impl,
|
||||||
|
+ 'B->B': numbers.identity_impl,
|
||||||
|
+ 'h->h': numbers.identity_impl,
|
||||||
|
+ 'H->H': numbers.identity_impl,
|
||||||
|
+ 'i->i': numbers.identity_impl,
|
||||||
|
+ 'I->I': numbers.identity_impl,
|
||||||
|
+ 'l->l': numbers.identity_impl,
|
||||||
|
+ 'L->L': numbers.identity_impl,
|
||||||
|
+ 'q->q': numbers.identity_impl,
|
||||||
|
+ 'Q->Q': numbers.identity_impl,
|
||||||
|
+ })
|
||||||
|
|
||||||
|
ufunc_db[np.fabs] = {
|
||||||
|
'f->f': npyfuncs.np_real_fabs_impl,
|
||||||
|
Index: numba-0.60.0/numba/tests/test_array_methods.py
|
||||||
|
===================================================================
|
||||||
|
--- numba-0.60.0.orig/numba/tests/test_array_methods.py
|
||||||
|
+++ numba-0.60.0/numba/tests/test_array_methods.py
|
||||||
|
@@ -774,13 +774,20 @@ class TestArrayMethods(MemoryLeakMixin,
|
||||||
|
check_arr(arr.reshape((2, 3, 4)))
|
||||||
|
check_arr(arr.reshape((2, 3, 4)).T)
|
||||||
|
check_arr(arr.reshape((2, 3, 4))[::2])
|
||||||
|
- for v in (0.0, 1.5, float('nan')):
|
||||||
|
- arr = np.array([v]).reshape(())
|
||||||
|
- check_arr(arr)
|
||||||
|
|
||||||
|
arr = np.array(["Hello", "", "world"])
|
||||||
|
check_arr(arr)
|
||||||
|
|
||||||
|
+ for v in (0.0, 1.5, float('nan')):
|
||||||
|
+ arr = np.array([v]).reshape(())
|
||||||
|
+ if numpy_version < (2, 1):
|
||||||
|
+ check_arr(arr)
|
||||||
|
+ else:
|
||||||
|
+ with self.assertRaises(ValueError) as raises:
|
||||||
|
+ njit((typeof(arr),))(pyfunc)
|
||||||
|
+ self.assertEqual(str(raises.exception),
|
||||||
|
+ "Calling nonzero on 0d arrays is not allowed. Use np.atleast_1d(scalar).nonzero() instead.")
|
||||||
|
+
|
||||||
|
def test_array_nonzero(self):
|
||||||
|
self.check_nonzero(array_nonzero)
|
||||||
|
|
||||||
|
Index: numba-0.60.0/docs/upcoming_changes/9741.highlight.rst
|
||||||
|
===================================================================
|
||||||
|
--- /dev/null
|
||||||
|
+++ numba-0.60.0/docs/upcoming_changes/9741.highlight.rst
|
||||||
|
@@ -0,0 +1,4 @@
|
||||||
|
+Added Support for NumPy 2.1
|
||||||
|
+---------------------------
|
||||||
|
+
|
||||||
|
+This release adds support for NumPy 2.1 (excluding the NEP-050 semantics).
|
||||||
|
Index: numba-0.60.0/numba/tests/test_ufuncs.py
|
||||||
|
===================================================================
|
||||||
|
--- numba-0.60.0.orig/numba/tests/test_ufuncs.py
|
||||||
|
+++ numba-0.60.0/numba/tests/test_ufuncs.py
|
||||||
|
@@ -18,7 +18,6 @@ from numba.np import numpy_support
|
||||||
|
from numba.core.registry import cpu_target
|
||||||
|
from numba.core.base import BaseContext
|
||||||
|
from numba.np import ufunc_db
|
||||||
|
-from numba.tests.support import expected_failure_np2
|
||||||
|
|
||||||
|
is32bits = tuple.__itemsize__ == 4
|
||||||
|
iswindows = sys.platform.startswith('win32')
|
||||||
|
@@ -1696,8 +1695,6 @@ class TestLoopTypesComplex(_LoopTypesTes
|
||||||
|
|
||||||
|
|
||||||
|
TestLoopTypesComplex.autogenerate()
|
||||||
|
-expected_failure_np2(TestLoopTypesComplex.test_sign_F_F)
|
||||||
|
-expected_failure_np2(TestLoopTypesComplex.test_sign_D_D)
|
||||||
|
|
||||||
|
|
||||||
|
class TestLoopTypesDatetime(_LoopTypesTester):
|
||||||
|
Index: numba-0.60.0/numba/core/typing/arraydecl.py
|
||||||
|
===================================================================
|
||||||
|
--- numba-0.60.0.orig/numba/core/typing/arraydecl.py
|
||||||
|
+++ numba-0.60.0/numba/core/typing/arraydecl.py
|
||||||
|
@@ -415,6 +415,11 @@ class ArrayAttribute(AttributeTemplate):
|
||||||
|
def resolve_nonzero(self, ary, args, kws):
|
||||||
|
assert not args
|
||||||
|
assert not kws
|
||||||
|
+ if ary.ndim == 0 and numpy_version >= (2, 1):
|
||||||
|
+ raise ValueError(
|
||||||
|
+ "Calling nonzero on 0d arrays is not allowed."
|
||||||
|
+ " Use np.atleast_1d(scalar).nonzero() instead."
|
||||||
|
+ )
|
||||||
|
# 0-dim arrays return one result array
|
||||||
|
ndim = max(ary.ndim, 1)
|
||||||
|
retty = types.UniTuple(types.Array(types.intp, 1, 'C'), ndim)
|
||||||
|
Index: numba-0.60.0/numba/np/random/_constants.py
|
||||||
|
===================================================================
|
||||||
|
--- numba-0.60.0.orig/numba/np/random/_constants.py
|
||||||
|
+++ numba-0.60.0/numba/np/random/_constants.py
|
||||||
|
@@ -1,4 +1,5 @@
|
||||||
|
import numpy as np
|
||||||
|
+import ctypes
|
||||||
|
|
||||||
|
# These constants are directly obtained from:
|
||||||
|
# https://github.com/numpy/numpy/blob/caccd283941b0bade7b71056138ded5379b1625f/numpy/random/src/distributions/ziggurat_constants.h
|
||||||
|
@@ -1222,6 +1223,7 @@ UINT8_MAX = 255
|
||||||
|
UINT16_MAX = 65535
|
||||||
|
UINT32_MAX = 4294967295
|
||||||
|
UINT64_MAX = 18446744073709551615
|
||||||
|
+LONG_MAX = (1 << ( 8 * ctypes.sizeof(ctypes.c_long) - 1)) - 1
|
||||||
|
|
||||||
|
LS2PI = 0.91893853320467267
|
||||||
|
TWELFTH = 0.083333333333333333333333
|
||||||
|
Index: numba-0.60.0/numba/__init__.py
|
||||||
|
===================================================================
|
||||||
|
--- numba-0.60.0.orig/numba/__init__.py
|
||||||
|
+++ numba-0.60.0/numba/__init__.py
|
||||||
|
@@ -34,13 +34,13 @@ def _ensure_critical_deps():
|
||||||
|
import numpy as np
|
||||||
|
numpy_version = extract_version(np)
|
||||||
|
|
||||||
|
- if numpy_version < (1, 22):
|
||||||
|
- msg = (f"Numba needs NumPy 1.22 or greater. Got NumPy "
|
||||||
|
+ if numpy_version < (1, 24):
|
||||||
|
+ msg = (f"Numba needs NumPy 1.24 or greater. Got NumPy "
|
||||||
|
f"{numpy_version[0]}.{numpy_version[1]}.")
|
||||||
|
raise ImportError(msg)
|
||||||
|
|
||||||
|
- if numpy_version > (2, 0):
|
||||||
|
- msg = (f"Numba needs NumPy 2.0 or less. Got NumPy "
|
||||||
|
+ if numpy_version > (2, 1):
|
||||||
|
+ msg = (f"Numba needs NumPy 2.1 or less. Got NumPy "
|
||||||
|
f"{numpy_version[0]}.{numpy_version[1]}.")
|
||||||
|
raise ImportError(msg)
|
||||||
|
|
||||||
|
Index: numba-0.60.0/numba/np/random/distributions.py
|
||||||
|
===================================================================
|
||||||
|
--- a/numba/np/random/distributions.py
|
||||||
|
+++ b/numba/np/random/distributions.py
|
||||||
|
@@ -394,8 +394,10 @@ def random_geometric(bitgen, p):
|
||||||
|
def random_zipf(bitgen, a):
|
||||||
|
am1 = a - 1.0
|
||||||
|
b = pow(2.0, am1)
|
||||||
|
+ Umin = pow(INT64_MAX, -am1)
|
||||||
|
while 1:
|
||||||
|
- U = 1.0 - next_double(bitgen)
|
||||||
|
+ U01 = next_double(bitgen)
|
||||||
|
+ U = U01*Umin + (1 - U01)
|
||||||
|
V = next_double(bitgen)
|
||||||
|
X = np.floor(pow(U, -1.0 / am1))
|
||||||
|
if (X > INT64_MAX or X < 1.0):
|
1534
python-numba.changes
Normal file
1534
python-numba.changes
Normal file
File diff suppressed because it is too large
Load Diff
191
python-numba.spec
Normal file
191
python-numba.spec
Normal file
@ -0,0 +1,191 @@
|
|||||||
|
#
|
||||||
|
# spec file for package python-numba
|
||||||
|
#
|
||||||
|
# Copyright (c) 2024 SUSE LLC
|
||||||
|
#
|
||||||
|
# All modifications and additions to the file contributed by third parties
|
||||||
|
# remain the property of their copyright owners, unless otherwise agreed
|
||||||
|
# upon. The license for this file, and modifications and additions to the
|
||||||
|
# file, is the same license as for the pristine package itself (unless the
|
||||||
|
# license for the pristine package is not an Open Source License, in which
|
||||||
|
# case the license is the MIT License). An "Open Source License" is a
|
||||||
|
# license that conforms to the Open Source Definition (Version 1.9)
|
||||||
|
# published by the Open Source Initiative.
|
||||||
|
|
||||||
|
# Please submit bugfixes or comments via https://bugs.opensuse.org/
|
||||||
|
#
|
||||||
|
|
||||||
|
|
||||||
|
%define plainpython python
|
||||||
|
# upper bound is exclusive: min-numpy_ver <= numpy < max_numpy_ver
|
||||||
|
%define min_numpy_ver 1.24
|
||||||
|
%define max_numpy_ver 2.2
|
||||||
|
|
||||||
|
%{?sle15_python_module_pythons}
|
||||||
|
|
||||||
|
%global flavor @BUILD_FLAVOR@%{nil}
|
||||||
|
%if "%{flavor}" == ""
|
||||||
|
%define psuffix %{nil}
|
||||||
|
%bcond_with test
|
||||||
|
# Supported Platforms: https://numba.pydata.org/numba-doc/dev/user/installing.html#compatibility
|
||||||
|
ExclusiveArch: x86_64 %ix86 ppc64le %arm aarch64
|
||||||
|
%else
|
||||||
|
%bcond_without test
|
||||||
|
%define psuffix -%{flavor}
|
||||||
|
%if "%{flavor}" != "test-py39"
|
||||||
|
%define skip_python39 1
|
||||||
|
%endif
|
||||||
|
%if "%{flavor}" != "test-py310"
|
||||||
|
%define skip_python310 1
|
||||||
|
%endif
|
||||||
|
%if "%{flavor}" != "test-py311"
|
||||||
|
%define skip_python311 1
|
||||||
|
%endif
|
||||||
|
%if "%{flavor}" != "test-py312"
|
||||||
|
%define skip_python312 1
|
||||||
|
%endif
|
||||||
|
%if "%{flavor}" != "test-py313"
|
||||||
|
%define skip_python313 1
|
||||||
|
%endif
|
||||||
|
# The obs server-side interpreter cannot use lua or rpm shrink
|
||||||
|
%if "%pythons" == "" || "%pythons" == " " || "%pythons" == " " || "%pythons" == " " || "%pythons" == " " || ( "%pythons" == "python311" && 0%{?skip_python311} )
|
||||||
|
ExclusiveArch: donotbuild
|
||||||
|
%define python_module() %flavor-not-enabled-in-buildset-for-suse-%{?suse_version}
|
||||||
|
%else
|
||||||
|
# Tests fail on ppc64 big endian, not resolvable on s390x, wrong types on 32-bit. See also above compatibility list for building
|
||||||
|
ExcludeArch: s390x ppc64 %ix86 %arm
|
||||||
|
%endif
|
||||||
|
%endif
|
||||||
|
# not supported with 0.60.0
|
||||||
|
%global skip_python313 1
|
||||||
|
Name: python-numba%{?psuffix}
|
||||||
|
Version: 0.60.0
|
||||||
|
Release: 0
|
||||||
|
Summary: NumPy-aware optimizing compiler for Python using LLVM
|
||||||
|
License: BSD-2-Clause
|
||||||
|
URL: https://numba.pydata.org/
|
||||||
|
# SourceRepository: https://github.com/numba/numba
|
||||||
|
Source: https://files.pythonhosted.org/packages/source/n/numba/numba-%{version}.tar.gz
|
||||||
|
# PATCH-FIX-OPENSUSE skip tests failing due to OBS specifics
|
||||||
|
Patch3: skip-failing-tests.patch
|
||||||
|
# PATCH-FIX-UPSTREAM https://github.com/numba/numba/pull/9741 Add Support for NumPy 2.1
|
||||||
|
Patch4: numpy21.patch
|
||||||
|
BuildRequires: %{python_module devel >= 3.9}
|
||||||
|
BuildRequires: %{python_module numpy-devel >= %{min_numpy_ver} with %python-numpy-devel < %{max_numpy_ver}}
|
||||||
|
BuildRequires: %{python_module pip}
|
||||||
|
BuildRequires: %{python_module setuptools}
|
||||||
|
BuildRequires: %{python_module wheel}
|
||||||
|
BuildRequires: fdupes
|
||||||
|
BuildRequires: gcc-c++
|
||||||
|
BuildRequires: python-rpm-macros
|
||||||
|
BuildRequires: (tbb-devel >= 2021)
|
||||||
|
Requires: (python-llvmlite >= 0.43 with python-llvmlite < 0.44)
|
||||||
|
Requires: (python-numpy >= %{min_numpy_ver} with python-numpy < %{max_numpy_ver})
|
||||||
|
Requires(post): update-alternatives
|
||||||
|
Requires(postun): update-alternatives
|
||||||
|
Recommends: python-Jinja2
|
||||||
|
Recommends: python-Pygments
|
||||||
|
Recommends: python-cffi
|
||||||
|
Recommends: python-scipy > 1.0
|
||||||
|
Recommends: python-tbb
|
||||||
|
%if %{with test}
|
||||||
|
BuildRequires: %{python_module Jinja2}
|
||||||
|
BuildRequires: %{python_module PyYAML}
|
||||||
|
BuildRequires: %{python_module Pygments}
|
||||||
|
BuildRequires: %{python_module cffi}
|
||||||
|
BuildRequires: %{python_module ipython}
|
||||||
|
BuildRequires: %{python_module numba = %{version}}
|
||||||
|
BuildRequires: %{python_module numba-devel = %{version}}
|
||||||
|
BuildRequires: %{python_module pip}
|
||||||
|
BuildRequires: %{python_module psutil}
|
||||||
|
BuildRequires: %{python_module pytest}
|
||||||
|
BuildRequires: %{python_module scipy >= 1.0}
|
||||||
|
BuildRequires: %{python_module tbb}
|
||||||
|
%endif
|
||||||
|
%python_subpackages
|
||||||
|
|
||||||
|
%description
|
||||||
|
Numba is a NumPy-aware optimizing compiler for Python. It uses the
|
||||||
|
LLVM compiler infrastructure to compile Python syntax to
|
||||||
|
machine code.
|
||||||
|
|
||||||
|
It is aware of NumPy arrays as typed memory regions and so can speed-up
|
||||||
|
code using NumPy arrays. Other, less well-typed code will be translated
|
||||||
|
to Python C-API calls, effectively removing the "interpreter", but not removing
|
||||||
|
the dynamic indirection.
|
||||||
|
|
||||||
|
Numba is also not a tracing JIT. It *compiles* your code before it gets
|
||||||
|
run, either using run-time type information or type information you provide
|
||||||
|
in the decorator.
|
||||||
|
|
||||||
|
Numba is a mechanism for producing machine code from Python syntax and typed
|
||||||
|
data structures such as those that exist in NumPy.
|
||||||
|
|
||||||
|
%package devel
|
||||||
|
Summary: Development files for numba applications
|
||||||
|
Requires: %{name} = %{version}
|
||||||
|
Requires: python-devel
|
||||||
|
Requires: python-numpy-devel >= %{min_numpy_ver}
|
||||||
|
Requires: %{plainpython}(abi) = %{python_version}
|
||||||
|
|
||||||
|
%description devel
|
||||||
|
This package contains files for developing applications using numba.
|
||||||
|
|
||||||
|
%prep
|
||||||
|
%autosetup -p1 -n numba-%{version}
|
||||||
|
sed -i -e '1{/env python/ d}' numba/misc/appdirs.py
|
||||||
|
|
||||||
|
# random timeouts in OBS
|
||||||
|
rm numba/tests/test_typedlist.py
|
||||||
|
# if we reduced the amount of tests too much:
|
||||||
|
# sed -i -e '/check_testsuite_size/ s/5000/3000/' numba/tests/test_runtests.py
|
||||||
|
|
||||||
|
%build
|
||||||
|
%if !%{with test}
|
||||||
|
export CFLAGS="%{optflags} -fPIC"
|
||||||
|
%pyproject_wheel
|
||||||
|
%endif
|
||||||
|
|
||||||
|
%install
|
||||||
|
%if !%{with test}
|
||||||
|
%pyproject_install
|
||||||
|
%{python_expand #
|
||||||
|
%fdupes %{buildroot}%{$python_sitearch}
|
||||||
|
find %{buildroot}%{$python_sitearch} -name '*.[ch]' > devel-files0-%{$python_bin_suffix}.files
|
||||||
|
sed 's|^%{buildroot}||' devel-files0-%{$python_bin_suffix}.files > devel-files-%{$python_bin_suffix}.files
|
||||||
|
sed 's|^%{buildroot}|%%exclude |' devel-files0-%{$python_bin_suffix}.files > devel-files-exclude-%{$python_bin_suffix}.files
|
||||||
|
}
|
||||||
|
%python_clone -a %{buildroot}%{_bindir}/numba
|
||||||
|
%endif
|
||||||
|
|
||||||
|
%check
|
||||||
|
%if %{with test}
|
||||||
|
# test the installed package, not the source without compiled modules
|
||||||
|
mkdir emptytestdir
|
||||||
|
pushd emptytestdir
|
||||||
|
%{python_expand # numbatests: check specific tests with `osc build -M test --define="numbatests <testnames>"`
|
||||||
|
%{_bindir}/numba-%%{$python_bin_suffix} -s
|
||||||
|
$python -m numba.runtests -v -b --exclude-tags='long_running' -m %{_smp_build_ncpus} -- %{?!numbatests:numba.tests}%{?numbatests}
|
||||||
|
}
|
||||||
|
popd
|
||||||
|
%endif
|
||||||
|
|
||||||
|
%if !%{with test}
|
||||||
|
%post
|
||||||
|
%python_install_alternative numba
|
||||||
|
|
||||||
|
%postun
|
||||||
|
%python_uninstall_alternative numba
|
||||||
|
|
||||||
|
%files %{python_files} -f devel-files-exclude-%{python_bin_suffix}.files
|
||||||
|
%license LICENSE
|
||||||
|
%doc CHANGE_LOG README.rst
|
||||||
|
%python_alternative %{_bindir}/numba
|
||||||
|
%{python_sitearch}/numba/
|
||||||
|
%{python_sitearch}/numba-%{version}.dist-info
|
||||||
|
|
||||||
|
%files %{python_files devel} -f devel-files-%{python_bin_suffix}.files
|
||||||
|
%license LICENSE
|
||||||
|
%endif
|
||||||
|
|
||||||
|
%changelog
|
71
skip-failing-tests.patch
Normal file
71
skip-failing-tests.patch
Normal file
@ -0,0 +1,71 @@
|
|||||||
|
---
|
||||||
|
numba/tests/test_parfors.py | 5 +++--
|
||||||
|
numba/tests/test_parfors_passes.py | 1 +
|
||||||
|
2 files changed, 4 insertions(+), 2 deletions(-)
|
||||||
|
|
||||||
|
Index: numba-0.59.1/numba/tests/test_parfors.py
|
||||||
|
===================================================================
|
||||||
|
--- numba-0.59.1.orig/numba/tests/test_parfors.py
|
||||||
|
+++ numba-0.59.1/numba/tests/test_parfors.py
|
||||||
|
@@ -1199,6 +1199,7 @@ class TestParforNumPy(TestParforsBase):
|
||||||
|
self.check_variants(test_impl2, data_gen)
|
||||||
|
self.count_parfors_variants(test_impl2, data_gen)
|
||||||
|
|
||||||
|
+ @unittest.skip("Fails on type check in OBS")
|
||||||
|
def test_ndarray_fill(self):
|
||||||
|
def test_impl(x):
|
||||||
|
x.fill(7.0)
|
||||||
|
@@ -4659,7 +4660,7 @@ class TestParforsVectorizer(TestPrangeBa
|
||||||
|
|
||||||
|
return asm
|
||||||
|
|
||||||
|
- @linux_only
|
||||||
|
+ @unittest.skip("Our x86_64 asm is most probably different from the upstream one.")
|
||||||
|
@TestCase.run_test_in_subprocess
|
||||||
|
def test_vectorizer_fastmath_asm(self):
|
||||||
|
""" This checks that if fastmath is set and the underlying hardware
|
||||||
|
@@ -4700,7 +4701,7 @@ class TestParforsVectorizer(TestPrangeBa
|
||||||
|
# check no zmm addressing is present
|
||||||
|
self.assertTrue('zmm' not in v)
|
||||||
|
|
||||||
|
- @linux_only
|
||||||
|
+ @unittest.skip("Our x86_64 asm is most probably different from the upstream one.")
|
||||||
|
@TestCase.run_test_in_subprocess(envvars={'NUMBA_BOUNDSCHECK': '0'})
|
||||||
|
def test_unsigned_refusal_to_vectorize(self):
|
||||||
|
""" This checks that if fastmath is set and the underlying hardware
|
||||||
|
Index: numba-0.59.1/numba/tests/test_parfors_passes.py
|
||||||
|
===================================================================
|
||||||
|
--- numba-0.59.1.orig/numba/tests/test_parfors_passes.py
|
||||||
|
+++ numba-0.59.1/numba/tests/test_parfors_passes.py
|
||||||
|
@@ -514,6 +514,7 @@ class TestConvertLoopPass(BaseTest):
|
||||||
|
str(raises.exception),
|
||||||
|
)
|
||||||
|
|
||||||
|
+ @unittest.skip("Fails on type check in OBS")
|
||||||
|
def test_init_prange(self):
|
||||||
|
def test_impl():
|
||||||
|
n = 20
|
||||||
|
Index: numba-0.59.1/numba/tests/test_cli.py
|
||||||
|
===================================================================
|
||||||
|
--- numba-0.59.1.orig/numba/tests/test_cli.py
|
||||||
|
+++ numba-0.59.1/numba/tests/test_cli.py
|
||||||
|
@@ -264,6 +264,7 @@ class TestGDBCLIInfoBrokenGdbs(TestCase)
|
||||||
|
self.assertIn("No such file or directory", stdout)
|
||||||
|
self.assertIn(path, stdout)
|
||||||
|
|
||||||
|
+ @unittest.skip("Fails on type check in OBS")
|
||||||
|
def test_nonsense_gdb_binary(self):
|
||||||
|
# Tests that a nonsense binary specified as gdb it picked up ok
|
||||||
|
env = os.environ.copy()
|
||||||
|
Index: numba-0.59.1/numba/tests/test_mathlib.py
|
||||||
|
===================================================================
|
||||||
|
--- numba-0.59.1.orig/numba/tests/test_mathlib.py
|
||||||
|
+++ numba-0.59.1/numba/tests/test_mathlib.py
|
||||||
|
@@ -508,6 +508,7 @@ class TestMathLib(TestCase):
|
||||||
|
float('-inf'), float('inf'), float('nan')]
|
||||||
|
self.run_unary(pyfunc, x_types, x_values, prec='exact')
|
||||||
|
|
||||||
|
+ @unittest.skip("Fails on ppc64le https://github.com/numba/numba/issues/8489")
|
||||||
|
def test_ldexp(self):
|
||||||
|
pyfunc = ldexp
|
||||||
|
cfunc = njit(pyfunc)
|
Loading…
Reference in New Issue
Block a user