after_merge stringlengths 28 79.6k | before_merge stringlengths 20 79.6k | url stringlengths 38 71 | full_traceback stringlengths 43 922k | traceback_type stringclasses 555
values |
|---|---|---|---|---|
def scalar_angle_kwarg(context, builder, sig, args):
deg_mult = sig.return_type(180 / numpy.pi)
def scalar_angle_impl(val, deg):
if deg:
return numpy.arctan2(val.imag, val.real) * deg_mult
else:
return numpy.arctan2(val.imag, val.real)
if len(args) == 1:
arg... | def scalar_angle_kwarg(context, builder, sig, args):
def scalar_angle_impl(val, deg=False):
if deg:
scal = 180 / numpy.pi
return numpy.arctan2(val.imag, val.real) * scal
else:
return numpy.arctan2(val.imag, val.real)
res = context.compile_internal(builder, sc... | https://github.com/numba/numba/issues/1667 | from numba import jit
@jit(nopython=True)
...: def angle(x): return np.angle(x)
...:
angle(np.complex128([1+1j]))
Traceback (most recent call last):
File "<ipython-input-6-186e6f934ae3>", line 1, in <module>
angle(np.complex128([1+1j]))
File "/home/antoine/numba/numba/dispatcher.py", line 171, in _compile_for_args
ret... | TypingError |
def scalar_angle_impl(val, deg):
if deg:
return numpy.arctan2(val.imag, val.real) * deg_mult
else:
return numpy.arctan2(val.imag, val.real)
| def scalar_angle_impl(val, deg=False):
if deg:
scal = 180 / numpy.pi
return numpy.arctan2(val.imag, val.real) * scal
else:
return numpy.arctan2(val.imag, val.real)
| https://github.com/numba/numba/issues/1667 | from numba import jit
@jit(nopython=True)
...: def angle(x): return np.angle(x)
...:
angle(np.complex128([1+1j]))
Traceback (most recent call last):
File "<ipython-input-6-186e6f934ae3>", line 1, in <module>
angle(np.complex128([1+1j]))
File "/home/antoine/numba/numba/dispatcher.py", line 171, in _compile_for_args
ret... | TypingError |
def array_angle_kwarg(context, builder, sig, args):
arg = sig.args[0]
ret_dtype = sig.return_type.dtype
def array_angle_impl(arr, deg):
out = numpy.zeros_like(arr, dtype=ret_dtype)
for index, val in numpy.ndenumerate(arr):
out[index] = numpy.angle(val, deg)
return out
... | def array_angle_kwarg(context, builder, sig, args):
arg = sig.args[0]
if isinstance(arg.dtype, types.Complex):
retty = arg.dtype.underlying_float
else:
retty = arg.dtype
def array_angle_impl(arr, deg=False):
out = numpy.zeros_like(arr, dtype=retty)
for index, val in nump... | https://github.com/numba/numba/issues/1667 | from numba import jit
@jit(nopython=True)
...: def angle(x): return np.angle(x)
...:
angle(np.complex128([1+1j]))
Traceback (most recent call last):
File "<ipython-input-6-186e6f934ae3>", line 1, in <module>
angle(np.complex128([1+1j]))
File "/home/antoine/numba/numba/dispatcher.py", line 171, in _compile_for_args
ret... | TypingError |
def array_angle_impl(arr, deg):
out = numpy.zeros_like(arr, dtype=ret_dtype)
for index, val in numpy.ndenumerate(arr):
out[index] = numpy.angle(val, deg)
return out
| def array_angle_impl(arr, deg=False):
out = numpy.zeros_like(arr, dtype=retty)
for index, val in numpy.ndenumerate(arr):
out[index] = numpy.angle(val, deg)
return out
| https://github.com/numba/numba/issues/1667 | from numba import jit
@jit(nopython=True)
...: def angle(x): return np.angle(x)
...:
angle(np.complex128([1+1j]))
Traceback (most recent call last):
File "<ipython-input-6-186e6f934ae3>", line 1, in <module>
angle(np.complex128([1+1j]))
File "/home/antoine/numba/numba/dispatcher.py", line 171, in _compile_for_args
ret... | TypingError |
def generic(self):
def typer(z, deg=False):
if isinstance(z, types.Array):
dtype = z.dtype
else:
dtype = z
if isinstance(dtype, types.Complex):
ret_dtype = dtype.underlying_float
elif isinstance(dtype, types.Float):
ret_dtype = dtype
... | def generic(self):
def typer(ref, deg=False):
if isinstance(ref, types.Array):
return ref.copy(dtype=ref.underlying_float)
else:
return types.float64
return typer
| https://github.com/numba/numba/issues/1667 | from numba import jit
@jit(nopython=True)
...: def angle(x): return np.angle(x)
...:
angle(np.complex128([1+1j]))
Traceback (most recent call last):
File "<ipython-input-6-186e6f934ae3>", line 1, in <module>
angle(np.complex128([1+1j]))
File "/home/antoine/numba/numba/dispatcher.py", line 171, in _compile_for_args
ret... | TypingError |
def typer(z, deg=False):
if isinstance(z, types.Array):
dtype = z.dtype
else:
dtype = z
if isinstance(dtype, types.Complex):
ret_dtype = dtype.underlying_float
elif isinstance(dtype, types.Float):
ret_dtype = dtype
else:
return
if isinstance(z, types.Array... | def typer(ref, deg=False):
if isinstance(ref, types.Array):
return ref.copy(dtype=ref.underlying_float)
else:
return types.float64
| https://github.com/numba/numba/issues/1667 | from numba import jit
@jit(nopython=True)
...: def angle(x): return np.angle(x)
...:
angle(np.complex128([1+1j]))
Traceback (most recent call last):
File "<ipython-input-6-186e6f934ae3>", line 1, in <module>
angle(np.complex128([1+1j]))
File "/home/antoine/numba/numba/dispatcher.py", line 171, in _compile_for_args
ret... | TypingError |
def generic(self):
def typer(ref, k=0):
if isinstance(ref, types.Array):
if ref.ndim == 1:
rdim = 2
elif ref.ndim == 2:
rdim = 1
else:
return None
return types.Array(ndim=rdim, dtype=ref.dtype, layout="C")
r... | def generic(self):
def typer(ref, k=0):
if isinstance(ref, types.Array):
if ref.ndim == 1:
rdim = 2
elif ref.ndim == 2:
rdim = 1
else:
return None
return types.Array(ndim=rdim, dtype=ref.dtype, layout="C")
r... | https://github.com/numba/numba/issues/1667 | from numba import jit
@jit(nopython=True)
...: def angle(x): return np.angle(x)
...:
angle(np.complex128([1+1j]))
Traceback (most recent call last):
File "<ipython-input-6-186e6f934ae3>", line 1, in <module>
angle(np.complex128([1+1j]))
File "/home/antoine/numba/numba/dispatcher.py", line 171, in _compile_for_args
ret... | TypingError |
def typer(ref, k=0):
if isinstance(ref, types.Array):
if ref.ndim == 1:
rdim = 2
elif ref.ndim == 2:
rdim = 1
else:
return None
return types.Array(ndim=rdim, dtype=ref.dtype, layout="C")
| def typer(ref, k=0):
if isinstance(ref, types.Array):
if ref.ndim == 1:
rdim = 2
elif ref.ndim == 2:
rdim = 1
else:
return None
return types.Array(ndim=rdim, dtype=ref.dtype, layout="C")
| https://github.com/numba/numba/issues/1667 | from numba import jit
@jit(nopython=True)
...: def angle(x): return np.angle(x)
...:
angle(np.complex128([1+1j]))
Traceback (most recent call last):
File "<ipython-input-6-186e6f934ae3>", line 1, in <module>
angle(np.complex128([1+1j]))
File "/home/antoine/numba/numba/dispatcher.py", line 171, in _compile_for_args
ret... | TypingError |
def _get_module_for_linking(self):
"""
Internal: get a LLVM module suitable for linking multiple times
into another library. Exported functions are made "linkonce_odr"
to allow for multiple definitions, inlining, and removal of
unused exports.
See discussion in https://github.com/numba/numba/p... | def _get_module_for_linking(self):
"""
Internal: get a LLVM module suitable for linking multiple times
into another library. Exported functions are made "linkonce_odr"
to allow for multiple definitions, inlining, and removal of
unused exports.
See discussion in https://github.com/numba/numba/p... | https://github.com/numba/numba/issues/1603 | $ python app.py
Traceback (most recent call last):
File "app.py", line 21, in <module>
run(N)
File "app.py", line 15, in run
res = fcalc(x)
File "/Users/userx/anaconda/lib/python2.7/site-packages/numba/dispatcher.py", line 172, in _compile_for_args
return self.compile(sig)
File "/Users/userx/anaconda/lib/python2.7/site... | RuntimeError |
def serialize_using_object_code(self):
"""
Serialize this library using its object code as the cached
representation. We also include its bitcode for further inlining
with other libraries.
"""
self._ensure_finalized()
data = (self._get_compiled_object(), self._get_module_for_linking().as_bi... | def serialize_using_object_code(self):
"""
Serialize this library using its object code as the cached
representation.
"""
self._ensure_finalized()
ll_module = self._final_module
return (self._name, "object", self._get_compiled_object())
| https://github.com/numba/numba/issues/1603 | $ python app.py
Traceback (most recent call last):
File "app.py", line 21, in <module>
run(N)
File "app.py", line 15, in run
res = fcalc(x)
File "/Users/userx/anaconda/lib/python2.7/site-packages/numba/dispatcher.py", line 172, in _compile_for_args
return self.compile(sig)
File "/Users/userx/anaconda/lib/python2.7/site... | RuntimeError |
def _unserialize(cls, codegen, state):
name, kind, data = state
self = codegen.create_library(name)
assert isinstance(self, cls)
if kind == "bitcode":
# No need to re-run optimizations, just make the module ready
self._final_module = ll.parse_bitcode(data)
self._finalize_final_mo... | def _unserialize(cls, codegen, state):
name, kind, data = state
self = codegen.create_library(name)
assert isinstance(self, cls)
if kind == "bitcode":
# No need to re-run optimizations, just make the module ready
self._final_module = ll.parse_bitcode(data)
self._finalize_final_mo... | https://github.com/numba/numba/issues/1603 | $ python app.py
Traceback (most recent call last):
File "app.py", line 21, in <module>
run(N)
File "app.py", line 15, in run
res = fcalc(x)
File "/Users/userx/anaconda/lib/python2.7/site-packages/numba/dispatcher.py", line 172, in _compile_for_args
return self.compile(sig)
File "/Users/userx/anaconda/lib/python2.7/site... | RuntimeError |
def create_struct_proxy(fe_type, kind="value"):
"""
Returns a specialized StructProxy subclass for the given fe_type.
"""
cache_key = (fe_type, kind)
res = _struct_proxy_cache.get(cache_key)
if res is None:
base = {
"value": ValueStructProxy,
"data": DataStructPro... | def create_struct_proxy(fe_type):
"""
Returns a specialized StructProxy subclass for the given fe_type.
"""
res = _struct_proxy_cache.get(fe_type)
if res is None:
clsname = StructProxy.__name__ + "_" + str(fe_type)
bases = (StructProxy,)
clsmembers = dict(_fe_type=fe_type)
... | https://github.com/numba/numba/issues/1373 | def f(): return [True]
...
ff = jit(nopython=True)(f)
ff()
Traceback (most recent call last):
File "/home/antoine/numba/numba/lowering.py", line 173, in lower_block
self.lower_inst(inst)
File "/home/antoine/numba/numba/lowering.py", line 215, in lower_inst
val = self.lower_assign(ty, inst)
File "/home/antoine/numba/num... | AssertionError |
def make_payload_cls(list_type):
"""
Return the Structure representation of the given *list_type*'s payload
(an instance of types.List).
"""
return cgutils.create_struct_proxy(types.ListPayload(list_type), kind="data")
| def make_payload_cls(list_type):
"""
Return the Structure representation of the given *list_type*'s payload
(an instance of types.List).
"""
return cgutils.create_struct_proxy(types.ListPayload(list_type))
| https://github.com/numba/numba/issues/1373 | def f(): return [True]
...
ff = jit(nopython=True)(f)
ff()
Traceback (most recent call last):
File "/home/antoine/numba/numba/lowering.py", line 173, in lower_block
self.lower_inst(inst)
File "/home/antoine/numba/numba/lowering.py", line 215, in lower_inst
val = self.lower_assign(ty, inst)
File "/home/antoine/numba/num... | AssertionError |
def getitem(self, idx):
ptr = self._gep(idx)
data_item = self._builder.load(ptr)
return self._datamodel.from_data(self._builder, data_item)
| def getitem(self, idx):
ptr = self._gep(idx)
return self._builder.load(ptr)
| https://github.com/numba/numba/issues/1373 | def f(): return [True]
...
ff = jit(nopython=True)(f)
ff()
Traceback (most recent call last):
File "/home/antoine/numba/numba/lowering.py", line 173, in lower_block
self.lower_inst(inst)
File "/home/antoine/numba/numba/lowering.py", line 215, in lower_inst
val = self.lower_assign(ty, inst)
File "/home/antoine/numba/num... | AssertionError |
def setitem(self, idx, val):
ptr = self._gep(idx)
data_item = self._datamodel.as_data(self._builder, val)
self._builder.store(data_item, ptr)
| def setitem(self, idx, val):
ptr = self._gep(idx)
self._builder.store(val, ptr)
| https://github.com/numba/numba/issues/1373 | def f(): return [True]
...
ff = jit(nopython=True)(f)
ff()
Traceback (most recent call last):
File "/home/antoine/numba/numba/lowering.py", line 173, in lower_block
self.lower_inst(inst)
File "/home/antoine/numba/numba/lowering.py", line 215, in lower_inst
val = self.lower_assign(ty, inst)
File "/home/antoine/numba/num... | AssertionError |
def inititem(self, idx, val):
ptr = self._gep(idx)
data_item = self._datamodel.as_data(self._builder, val)
self._builder.store(data_item, ptr)
| def inititem(self, idx, val):
ptr = self._gep(idx)
self._builder.store(val, ptr)
| https://github.com/numba/numba/issues/1373 | def f(): return [True]
...
ff = jit(nopython=True)(f)
ff()
Traceback (most recent call last):
File "/home/antoine/numba/numba/lowering.py", line 173, in lower_block
self.lower_inst(inst)
File "/home/antoine/numba/numba/lowering.py", line 215, in lower_inst
val = self.lower_assign(ty, inst)
File "/home/antoine/numba/num... | AssertionError |
def __init__(self, context, builder, list_type, list_val):
self._context = context
self._builder = builder
self._ty = list_type
self._list = make_list_cls(list_type)(context, builder, list_val)
self._itemsize = get_itemsize(context, list_type)
self._datamodel = context.data_model_manager[list_ty... | def __init__(self, context, builder, list_type, list_val):
self._context = context
self._builder = builder
self._ty = list_type
self._list = make_list_cls(list_type)(context, builder, list_val)
self._itemsize = get_itemsize(context, list_type)
| https://github.com/numba/numba/issues/1373 | def f(): return [True]
...
ff = jit(nopython=True)(f)
ff()
Traceback (most recent call last):
File "/home/antoine/numba/numba/lowering.py", line 173, in lower_block
self.lower_inst(inst)
File "/home/antoine/numba/numba/lowering.py", line 215, in lower_inst
val = self.lower_assign(ty, inst)
File "/home/antoine/numba/num... | AssertionError |
def __init__(self, context, builder, iter_type, iter_val):
self._context = context
self._builder = builder
self._ty = iter_type
self._iter = make_listiter_cls(iter_type)(context, builder, iter_val)
self._datamodel = context.data_model_manager[iter_type.yield_type]
| def __init__(self, context, builder, iter_type, iter_val):
self._context = context
self._builder = builder
self._ty = iter_type
self._iter = make_listiter_cls(iter_type)(context, builder, iter_val)
| https://github.com/numba/numba/issues/1373 | def f(): return [True]
...
ff = jit(nopython=True)(f)
ff()
Traceback (most recent call last):
File "/home/antoine/numba/numba/lowering.py", line 173, in lower_block
self.lower_inst(inst)
File "/home/antoine/numba/numba/lowering.py", line 215, in lower_inst
val = self.lower_assign(ty, inst)
File "/home/antoine/numba/num... | AssertionError |
def _init_casting_rules(tm):
tcr = TypeCastingRules(tm)
tcr.safe_unsafe(types.boolean, types.int8)
tcr.safe_unsafe(types.boolean, types.uint8)
tcr.promote_unsafe(types.int8, types.int16)
tcr.promote_unsafe(types.uint8, types.uint16)
tcr.promote_unsafe(types.int16, types.int32)
tcr.promote_... | def _init_casting_rules(tm):
tcr = TypeCastingRules(tm)
tcr.safe_unsafe(types.boolean, types.int8)
tcr.safe_unsafe(types.boolean, types.uint8)
tcr.promote_unsafe(types.int8, types.int16)
tcr.promote_unsafe(types.uint8, types.uint16)
tcr.promote_unsafe(types.int16, types.int32)
tcr.promote_... | https://github.com/numba/numba/issues/1373 | def f(): return [True]
...
ff = jit(nopython=True)(f)
ff()
Traceback (most recent call last):
File "/home/antoine/numba/numba/lowering.py", line 173, in lower_block
self.lower_inst(inst)
File "/home/antoine/numba/numba/lowering.py", line 215, in lower_inst
val = self.lower_assign(ty, inst)
File "/home/antoine/numba/num... | AssertionError |
def unify_types(self, *typelist):
# Sort the type list according to bit width before doing
# pairwise unification (with thanks to aterrel).
def keyfunc(obj):
"""Uses bitwidth to order numeric-types.
Fallback to stable, deterministic sort.
"""
return getattr(obj, "bitwidth", 0... | def unify_types(self, *typelist):
# Sort the type list according to bit width before doing
# pairwise unification (with thanks to aterrel).
def keyfunc(obj):
"""Uses bitwidth to order numeric-types.
Fallback to hash() for arbitary ordering.
"""
return getattr(obj, "bitwidth",... | https://github.com/numba/numba/issues/1373 | def f(): return [True]
...
ff = jit(nopython=True)(f)
ff()
Traceback (most recent call last):
File "/home/antoine/numba/numba/lowering.py", line 173, in lower_block
self.lower_inst(inst)
File "/home/antoine/numba/numba/lowering.py", line 215, in lower_inst
val = self.lower_assign(ty, inst)
File "/home/antoine/numba/num... | AssertionError |
def keyfunc(obj):
"""Uses bitwidth to order numeric-types.
Fallback to stable, deterministic sort.
"""
return getattr(obj, "bitwidth", 0)
| def keyfunc(obj):
"""Uses bitwidth to order numeric-types.
Fallback to hash() for arbitary ordering.
"""
return getattr(obj, "bitwidth", hash(obj))
| https://github.com/numba/numba/issues/1373 | def f(): return [True]
...
ff = jit(nopython=True)(f)
ff()
Traceback (most recent call last):
File "/home/antoine/numba/numba/lowering.py", line 173, in lower_block
self.lower_inst(inst)
File "/home/antoine/numba/numba/lowering.py", line 215, in lower_inst
val = self.lower_assign(ty, inst)
File "/home/antoine/numba/num... | AssertionError |
def unify_pairs(self, first, second):
"""
Try to unify the two given types. A third type is returned,
or pyobject in case of failure.
"""
if first == second:
return first
if first is types.undefined:
return second
elif second is types.undefined:
return first
# ... | def unify_pairs(self, first, second):
"""
Try to unify the two given types. A third type is returned,
or None in case of failure.
"""
if first == second:
return first
if first is types.undefined:
return second
elif second is types.undefined:
return first
# Type... | https://github.com/numba/numba/issues/1373 | def f(): return [True]
...
ff = jit(nopython=True)(f)
ff()
Traceback (most recent call last):
File "/home/antoine/numba/numba/lowering.py", line 173, in lower_block
self.lower_inst(inst)
File "/home/antoine/numba/numba/lowering.py", line 215, in lower_inst
val = self.lower_assign(ty, inst)
File "/home/antoine/numba/num... | AssertionError |
def get_data_type(self, ty):
"""
Get a LLVM data representation of the Numba type *ty* that is safe
for storage. Record data are stored as byte array.
The return value is a llvmlite.ir.Type object, or None if the type
is an opaque pointer (???).
"""
return self.data_model_manager[ty].get_d... | def get_data_type(self, ty):
"""
Get a LLVM data representation of the Numba type *ty* that is safe
for storage. Record data are stored as byte array.
The return value is a llvmlite.ir.Type object, or None if the type
is an opaque pointer (???).
"""
try:
fac = type_registry.match(t... | https://github.com/numba/numba/issues/1373 | def f(): return [True]
...
ff = jit(nopython=True)(f)
ff()
Traceback (most recent call last):
File "/home/antoine/numba/numba/lowering.py", line 173, in lower_block
self.lower_inst(inst)
File "/home/antoine/numba/numba/lowering.py", line 215, in lower_inst
val = self.lower_assign(ty, inst)
File "/home/antoine/numba/num... | AssertionError |
def __init__(self):
self.functions = []
self.attributes = []
| def __init__(self):
self.factories = {}
| https://github.com/numba/numba/issues/1373 | def f(): return [True]
...
ff = jit(nopython=True)(f)
ff()
Traceback (most recent call last):
File "/home/antoine/numba/numba/lowering.py", line 173, in lower_block
self.lower_inst(inst)
File "/home/antoine/numba/numba/lowering.py", line 215, in lower_inst
val = self.lower_assign(ty, inst)
File "/home/antoine/numba/num... | AssertionError |
def register(self, impl):
sigs = impl.function_signatures
impl.function_signatures = []
self.functions.append((impl, sigs))
return impl
| def register(self, type_class):
"""
Register a LLVM type factory function for the given *type_class*
(i.e. a subclass of numba.types.Type).
"""
assert issubclass(type_class, types.Type)
def decorator(func):
self.factories[type_class] = func
return func
return decorator
| https://github.com/numba/numba/issues/1373 | def f(): return [True]
...
ff = jit(nopython=True)(f)
ff()
Traceback (most recent call last):
File "/home/antoine/numba/numba/lowering.py", line 173, in lower_block
self.lower_inst(inst)
File "/home/antoine/numba/numba/lowering.py", line 215, in lower_inst
val = self.lower_assign(ty, inst)
File "/home/antoine/numba/num... | AssertionError |
def __init__(self, device, handle, finalizer=None):
self.device = device
self.handle = handle
self.external_finalizer = finalizer
self.trashing = TrashService(
"cuda.device%d.context%x.trash" % (self.device.id, self.handle.value)
)
self.allocations = utils.UniqueDict()
self.modules =... | def __init__(self, device, handle, finalizer=None):
self.device = device
self.handle = handle
self.finalizer = finalizer
self.trashing = TrashService(
"cuda.device%d.context%x.trash" % (self.device.id, self.handle.value)
)
self.is_managed = finalizer is not None
self.allocations = ut... | https://github.com/numba/numba/issues/1164 | Exception ignored in: <bound method Context.__del__ of <CUDA context c_void_p(36426160) of device 0>>
Traceback (most recent call last):
File "/home/antoine/numba/numba/cuda/cudadrv/driver.py", line 467, in __del__
AttributeError: 'NoneType' object has no attribute 'print_exc' | AttributeError |
def lower_expr(self, resty, expr):
if expr.op == "binop":
return self.lower_binop(resty, expr)
elif expr.op == "inplace_binop":
lty = self.typeof(expr.lhs.name)
if not lty.mutable:
# inplace operators on non-mutable types reuse the same
# definition as the corresp... | def lower_expr(self, resty, expr):
if expr.op == "binop":
return self.lower_binop(resty, expr)
elif expr.op == "inplace_binop":
lty = self.typeof(expr.lhs.name)
if not lty.mutable:
# inplace operators on non-mutable types reuse the same
# definition as the corresp... | https://github.com/numba/numba/issues/1151 | ff = jit(f, nopython=True)
ff((4,5,6,7))
(4, 5, 6)
ff((4,5))
Traceback (most recent call last):
[...]
numba.lowering.LoweringError: Failed at nopython (nopython mode backend)
Internal error:
TypeError: Can't index at [2] in [2 x i32]
File "<stdin>", line 2 | numba.lowering.LoweringError |
def __call__(self, context, typevars):
oset = typevars[self.target]
for tp in typevars[self.iterator.name].get():
if isinstance(tp, types.BaseTuple):
if len(tp) == self.count:
oset.add_types(tp)
elif isinstance(tp, types.IterableType):
oset.add_types(
... | def __call__(self, context, typevars):
oset = typevars[self.target]
for tp in typevars[self.iterator.name].get():
if isinstance(tp, types.IterableType):
oset.add_types(
types.UniTuple(dtype=tp.iterator_type.yield_type, count=self.count)
)
elif isinstance(t... | https://github.com/numba/numba/issues/1151 | ff = jit(f, nopython=True)
ff((4,5,6,7))
(4, 5, 6)
ff((4,5))
Traceback (most recent call last):
[...]
numba.lowering.LoweringError: Failed at nopython (nopython mode backend)
Internal error:
TypeError: Can't index at [2] in [2 x i32]
File "<stdin>", line 2 | numba.lowering.LoweringError |
def __init__(self, arg_count, py_func):
self.tm = default_type_manager
_dispatcher.Dispatcher.__init__(self, self.tm.get_pointer(), arg_count)
# A mapping of signatures to entry points
self.overloads = {}
# A mapping of signatures to compile results
self._compileinfos = {}
# A list of nopyt... | def __init__(self, arg_count, py_func):
self.tm = default_type_manager
_dispatcher.Dispatcher.__init__(self, self.tm.get_pointer(), arg_count)
# A mapping of signatures to entry points
self.overloads = {}
# A mapping of signatures to compile results
self._compileinfos = {}
# A list of nopyt... | https://github.com/numba/numba/issues/908 | Exception in thread Thread-14:
Traceback (most recent call last):
File "/home/antoine/34/lib/python3.4/threading.py", line 921, in _bootstrap_inner
self.run()
File "/home/antoine/34/lib/python3.4/threading.py", line 869, in run
self._target(*self._args, **self._kwargs)
File "/home/antoine/numba/numba/dispatcher.py", li... | RuntimeError |
def is_compiling(self):
"""
Whether a specialization is currently being compiled.
"""
return self._compile_lock.is_owned()
| def is_compiling(self):
return self._compiling
| https://github.com/numba/numba/issues/908 | Exception in thread Thread-14:
Traceback (most recent call last):
File "/home/antoine/34/lib/python3.4/threading.py", line 921, in _bootstrap_inner
self.run()
File "/home/antoine/34/lib/python3.4/threading.py", line 869, in run
self._target(*self._args, **self._kwargs)
File "/home/antoine/numba/numba/dispatcher.py", li... | RuntimeError |
def compile(self, sig, locals={}, **targetoptions):
with self._compile_lock:
locs = self.locals.copy()
locs.update(locals)
topt = self.targetoptions.copy()
topt.update(targetoptions)
flags = compiler.Flags()
self.targetdescr.options.parse_as_flags(flags, topt)
... | def compile(self, sig, locals={}, **targetoptions):
with self._compile_lock():
locs = self.locals.copy()
locs.update(locals)
topt = self.targetoptions.copy()
topt.update(targetoptions)
flags = compiler.Flags()
self.targetdescr.options.parse_as_flags(flags, topt)
... | https://github.com/numba/numba/issues/908 | Exception in thread Thread-14:
Traceback (most recent call last):
File "/home/antoine/34/lib/python3.4/threading.py", line 921, in _bootstrap_inner
self.run()
File "/home/antoine/34/lib/python3.4/threading.py", line 869, in run
self._target(*self._args, **self._kwargs)
File "/home/antoine/numba/numba/dispatcher.py", li... | RuntimeError |
def compile(self, sig):
with self._compile_lock:
# FIXME this is mostly duplicated from Overloaded
flags = self.flags
args, return_type = sigutils.normalize_signature(sig)
# Don't recompile if signature already exist.
existing = self.overloads.get(tuple(args))
if exi... | def compile(self, sig):
with self._compile_lock():
# FIXME this is mostly duplicated from Overloaded
flags = self.flags
args, return_type = sigutils.normalize_signature(sig)
# Don't recompile if signature already exist.
existing = self.overloads.get(tuple(args))
if e... | https://github.com/numba/numba/issues/908 | Exception in thread Thread-14:
Traceback (most recent call last):
File "/home/antoine/34/lib/python3.4/threading.py", line 921, in _bootstrap_inner
self.run()
File "/home/antoine/34/lib/python3.4/threading.py", line 869, in run
self._target(*self._args, **self._kwargs)
File "/home/antoine/numba/numba/dispatcher.py", li... | RuntimeError |
def _compile_for_args(self, *args, **kws):
"""
For internal use. Compile a specialized version of the function
for the given *args* and *kws*, and return the resulting callable.
"""
assert not kws
sig = tuple([self.typeof_pyval(a) for a in args])
return self.compile(sig)
| def _compile_for_args(self, *args, **kws):
"""
For internal use. Compile a specialized version of the function
for the given *args* and *kws*, and return the resulting callable.
"""
assert not kws
sig = tuple([self.typeof_pyval(a) for a in args])
return self.jit(sig)
| https://github.com/numba/numba/issues/908 | Exception in thread Thread-14:
Traceback (most recent call last):
File "/home/antoine/34/lib/python3.4/threading.py", line 921, in _bootstrap_inner
self.run()
File "/home/antoine/34/lib/python3.4/threading.py", line 869, in run
self._target(*self._args, **self._kwargs)
File "/home/antoine/numba/numba/dispatcher.py", li... | RuntimeError |
def make_multithread(inner_func, numthreads):
"""
Run the given function inside *numthreads* threads, splitting its
arguments into equal-sized chunks.
"""
def func_mt(*args):
length = len(args[0])
result = np.empty(length, dtype=np.float64)
args = (result,) + args
ch... | def make_multithread(inner_func, numthreads):
"""
Run the given function inside *numthreads* threads, splitting its
arguments into equal-sized chunks.
"""
def func_mt(*args):
length = len(args[0])
result = np.empty(length, dtype=np.float64)
args = (result,) + args
ch... | https://github.com/numba/numba/issues/908 | Exception in thread Thread-14:
Traceback (most recent call last):
File "/home/antoine/34/lib/python3.4/threading.py", line 921, in _bootstrap_inner
self.run()
File "/home/antoine/34/lib/python3.4/threading.py", line 869, in run
self._target(*self._args, **self._kwargs)
File "/home/antoine/numba/numba/dispatcher.py", li... | RuntimeError |
def func_mt(*args):
length = len(args[0])
result = np.empty(length, dtype=np.float64)
args = (result,) + args
chunklen = (length + 1) // numthreads
# Create argument tuples for each input chunk
chunks = [
[arg[i * chunklen : (i + 1) * chunklen] for arg in args]
for i in range(num... | def func_mt(*args):
length = len(args[0])
result = np.empty(length, dtype=np.float64)
args = (result,) + args
chunklen = (length + 1) // numthreads
# Create argument tuples for each chunk
chunks = [
[arg[i * chunklen : (i + 1) * chunklen] for arg in args]
for i in range(numthread... | https://github.com/numba/numba/issues/908 | Exception in thread Thread-14:
Traceback (most recent call last):
File "/home/antoine/34/lib/python3.4/threading.py", line 921, in _bootstrap_inner
self.run()
File "/home/antoine/34/lib/python3.4/threading.py", line 869, in run
self._target(*self._args, **self._kwargs)
File "/home/antoine/numba/numba/dispatcher.py", li... | RuntimeError |
def lower_expr(self, resty, expr):
if expr.op == "binop":
return self.lower_binop(resty, expr)
elif expr.op == "inplace_binop":
lty = self.typeof(expr.lhs.name)
if not lty.mutable:
# inplace operators on non-mutable types reuse the same
# definition as the corresp... | def lower_expr(self, resty, expr):
if expr.op == "binop":
return self.lower_binop(resty, expr)
elif expr.op == "inplace_binop":
lty = self.typeof(expr.lhs.name)
if not lty.mutable:
# inplace operators on non-mutable types reuse the same
# definition as the corresp... | https://github.com/numba/numba/issues/903 | ctypes.windll.kernel32.Sleep(100)
0
ctypes.cdll.kernel32.Sleep(100)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ValueError: Procedure called with not enough arguments (4 bytes missing) or wron
g calling convention | ValueError |
def call_function_pointer(self, builder, funcptr, signature, args, cconv=None):
retty = self.get_value_type(signature.return_type)
fnty = Type.function(retty, [a.type for a in args])
fnptrty = Type.pointer(fnty)
addr = self.get_constant(types.intp, funcptr)
ptr = builder.inttoptr(addr, fnptrty)
... | def call_function_pointer(self, builder, funcptr, signature, args):
retty = self.get_value_type(signature.return_type)
fnty = Type.function(retty, [a.type for a in args])
fnptrty = Type.pointer(fnty)
addr = self.get_constant(types.intp, funcptr)
ptr = builder.inttoptr(addr, fnptrty)
return build... | https://github.com/numba/numba/issues/903 | ctypes.windll.kernel32.Sleep(100)
0
ctypes.cdll.kernel32.Sleep(100)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ValueError: Procedure called with not enough arguments (4 bytes missing) or wron
g calling convention | ValueError |
def __init__(self, template, funcptr, cconv=None):
self.funcptr = funcptr
self.cconv = cconv
super(FunctionPointer, self).__init__(template)
| def __init__(self, template, funcptr):
self.funcptr = funcptr
super(FunctionPointer, self).__init__(template)
| https://github.com/numba/numba/issues/903 | ctypes.windll.kernel32.Sleep(100)
0
ctypes.cdll.kernel32.Sleep(100)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ValueError: Procedure called with not enough arguments (4 bytes missing) or wron
g calling convention | ValueError |
def make_function_type(cfnptr):
if cfnptr.argtypes is None:
raise TypeError(
"ctypes function %r doesn't define its argument types; "
"consider setting the `argtypes` attribute" % (cfnptr.__name__,)
)
cargs = [convert_ctypes(a) for a in cfnptr.argtypes]
cret = convert... | def make_function_type(cfnptr):
cargs = [convert_ctypes(a) for a in cfnptr.argtypes]
cret = convert_ctypes(cfnptr.restype)
cases = [templates.signature(cret, *cargs)]
template = templates.make_concrete_template("CFuncPtr", cfnptr, cases)
pointer = ctypes.cast(cfnptr, ctypes.c_void_p).value
ret... | https://github.com/numba/numba/issues/903 | ctypes.windll.kernel32.Sleep(100)
0
ctypes.cdll.kernel32.Sleep(100)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ValueError: Procedure called with not enough arguments (4 bytes missing) or wron
g calling convention | ValueError |
def _explain_ambiguous(self, *args, **kws):
assert not kws, "kwargs not handled"
args = tuple([self.typeof_pyval(a) for a in args])
sigs = [cr.signature for cr in self._compileinfos.values()]
resolve_overload(self.typingctx, self.py_func, sigs, args, kws)
| def _explain_ambiguous(self, *args, **kws):
assert not kws, "kwargs not handled"
args = tuple([self.typeof_pyval(a) for a in args])
resolve_overload(
self.typingctx, self.py_func, tuple(self.overloads.keys()), args, kws
)
| https://github.com/numba/numba/issues/776 | Traceback (most recent call last):
File "test_disp.py", line 15, in <module>
foo(1, 1)
File "/Users/sklam/dev/numba/numba/dispatcher.py", line 161, in _explain_ambiguous
tuple(self.overloads.keys()), args, kws)
File "/Users/sklam/dev/numba/numba/typing/templates.py", line 84, in resolve_overload
if len(args) == len(cas... | AttributeError |
def __init__(self, variable, context, types, assignment=False, **kwds):
super(PromotionType, self).__init__(variable, **kwds)
self.context = context
self.types = oset.OrderedSet(types)
self.assignment = assignment
variable.type = self
self.add_parents(type for type in types if type.is_unresolve... | def __init__(self, variable, context, types, assignment=False, **kwds):
super(PromotionType, self).__init__(variable, **kwds)
self.context = context
self.types = types
self.assignment = assignment
variable.type = self
self.add_parents(type for type in types if type.is_unresolved)
self.coun... | https://github.com/numba/numba/issues/117 | Traceback (most recent call last):
File "./test_typeinfer_bug.py", line 26, in <module>
test()
File "./test_typeinfer_bug.py", line 23, in test
jenks_matrices(data)
File "numbawrapper.pyx", line 93, in numba.numbawrapper.NumbaSpecializingWrapper.__call__ (numba/numbawrapper.c:2827)
File "/Users/sklam/dev/numba/numba/de... | AssertionError |
def find_types(self, seen):
types = oset.OrderedSet([self])
seen.add(self)
seen.add(self.variable.deferred_type)
self.dfs(types, seen)
types.remove(self)
return types
| def find_types(self, seen):
types = set([self])
seen.add(self)
seen.add(self.variable.deferred_type)
self.dfs(types, seen)
types.remove(self)
return types
| https://github.com/numba/numba/issues/117 | Traceback (most recent call last):
File "./test_typeinfer_bug.py", line 26, in <module>
test()
File "./test_typeinfer_bug.py", line 23, in test
jenks_matrices(data)
File "numbawrapper.pyx", line 93, in numba.numbawrapper.NumbaSpecializingWrapper.__call__ (numba/numbawrapper.c:2827)
File "/Users/sklam/dev/numba/numba/de... | AssertionError |
def find_simple(self, seen):
types = oset.OrderedSet()
for type in self.types:
if type.is_promotion:
types.add(type.types)
else:
type.add(type)
return types
| def find_simple(self, seen):
types = set()
for type in self.types:
if type.is_promotion:
types.add(type.types)
else:
type.add(type)
return types
| https://github.com/numba/numba/issues/117 | Traceback (most recent call last):
File "./test_typeinfer_bug.py", line 26, in <module>
test()
File "./test_typeinfer_bug.py", line 23, in test
jenks_matrices(data)
File "numbawrapper.pyx", line 93, in numba.numbawrapper.NumbaSpecializingWrapper.__call__ (numba/numbawrapper.c:2827)
File "/Users/sklam/dev/numba/numba/de... | AssertionError |
def _simplify(self, seen=None):
"""
Simplify a promotion type tree:
promote(int_, float_)
-> float_
promote(deferred(x), promote(float_, double), int_, promote(<self>))
-> promote(deferred(x), double)
promote(deferred(x), deferred(y))
-> promote(def... | def _simplify(self, seen=None):
"""
Simplify a promotion type tree:
promote(int_, float_)
-> float_
promote(deferred(x), promote(float_, double), int_, promote(<self>))
-> promote(deferred(x), double)
promote(deferred(x), deferred(y))
-> promote(def... | https://github.com/numba/numba/issues/117 | Traceback (most recent call last):
File "./test_typeinfer_bug.py", line 26, in <module>
test()
File "./test_typeinfer_bug.py", line 23, in test
jenks_matrices(data)
File "numbawrapper.pyx", line 93, in numba.numbawrapper.NumbaSpecializingWrapper.__call__ (numba/numbawrapper.c:2827)
File "/Users/sklam/dev/numba/numba/de... | AssertionError |
def __init__(self, scc, **kwds):
super(StronglyConnectedCircularType, self).__init__(None, **kwds)
self.scc = scc
types = oset.OrderedSet(scc)
for type in scc:
self.add_children(type.children - types)
self.add_parents(type.parents - types)
self.types = scc
self.promotions = ose... | def __init__(self, scc, **kwds):
super(StronglyConnectedCircularType, self).__init__(None, **kwds)
self.scc = scc
types = set(scc)
for type in scc:
self.add_children(type.children - types)
self.add_parents(type.parents - types)
self.types = scc
self.promotions = set(type for ty... | https://github.com/numba/numba/issues/117 | Traceback (most recent call last):
File "./test_typeinfer_bug.py", line 26, in <module>
test()
File "./test_typeinfer_bug.py", line 23, in test
jenks_matrices(data)
File "numbawrapper.pyx", line 93, in numba.numbawrapper.NumbaSpecializingWrapper.__call__ (numba/numbawrapper.c:2827)
File "/Users/sklam/dev/numba/numba/de... | AssertionError |
def simplify(self):
if self.reanalyzeable:
self.retry_infer()
elif self.promotions:
self.resolve_promotion_cycles()
else:
# All dependencies are resolved, we are done
pass
self.is_resolved = True
| def simplify(self):
if self.reanalyzeable:
self.retry_infer()
elif self.promotions:
self.resolve_promotion_cycles()
else:
assert False
self.is_resolved = True
| https://github.com/numba/numba/issues/117 | Traceback (most recent call last):
File "./test_typeinfer_bug.py", line 26, in <module>
test()
File "./test_typeinfer_bug.py", line 23, in test
jenks_matrices(data)
File "numbawrapper.pyx", line 93, in numba.numbawrapper.NumbaSpecializingWrapper.__call__ (numba/numbawrapper.c:2827)
File "/Users/sklam/dev/numba/numba/de... | AssertionError |
def pprint(self, *args, **kws):
pprint.pprint(self.__dict__, *args, **kws)
| def pprint(self, *args, **kws):
pprint.pprint(self.__dict__)
| https://github.com/numba/numba/issues/25 | ---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-15-3b23f7331ceb> in <module>()
----> 1 @jit(arg_types=[numba.double], ret_type=numba.double)
2 def is_REALLY_five(some_value):
3 for i in range(5):
4... | TypeError |
def build_cfg(cls, code_obj, *args, **kws):
ret_val = cls(*args, **kws)
opmap = opcode.opname
ret_val.crnt_block = 0
ret_val.code_len = len(code_obj.co_code)
ret_val.add_block(0)
ret_val.blocks_writes[0] = set(range(code_obj.co_argcount))
last_was_jump = True # At start there is no prior ba... | def build_cfg(cls, code_obj, *args, **kws):
ret_val = cls(*args, **kws)
opmap = opcode.opname
ret_val.crnt_block = 0
ret_val.code_len = len(code_obj.co_code)
ret_val.add_block(0)
ret_val.blocks_writes[0] = set(range(code_obj.co_argcount))
last_was_jump = True # At start there is no prior ba... | https://github.com/numba/numba/issues/25 | ---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-15-3b23f7331ceb> in <module>()
----> 1 @jit(arg_types=[numba.double], ret_type=numba.double)
2 def is_REALLY_five(some_value):
3 for i in range(5):
4... | TypeError |
def compute_use_defs(blocks):
"""
Find variable use/def per block.
"""
var_use_map = {} # { block offset -> set of vars }
var_def_map = {} # { block offset -> set of vars }
for offset, ir_block in blocks.items():
var_use_map[offset] = use_set = set()
var_def_map[offset] = def_... | def compute_use_defs(blocks):
"""
Find variable use/def per block.
"""
var_use_map = {} # { block offset -> set of vars }
var_def_map = {} # { block offset -> set of vars }
for offset, ir_block in blocks.items():
var_use_map[offset] = use_set = set()
var_def_map[offset] = def_... | https://github.com/numba/numba/issues/25 | ---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-15-3b23f7331ceb> in <module>()
----> 1 @jit(arg_types=[numba.double], ret_type=numba.double)
2 def is_REALLY_five(some_value):
3 for i in range(5):
4... | TypeError |
def _analyze_inst(self, inst):
if isinstance(inst, ir.Assign):
return self._analyze_assign(inst)
elif type(inst) in array_analysis_extensions:
# let external calls handle stmt if type matches
f = array_analysis_extensions[type(inst)]
return f(inst, self)
return []
| def _analyze_inst(self, inst):
if isinstance(inst, ir.Assign):
return self._analyze_assign(inst)
return []
| https://github.com/numba/numba/issues/25 | ---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-15-3b23f7331ceb> in <module>()
----> 1 @jit(arg_types=[numba.double], ret_type=numba.double)
2 def is_REALLY_five(some_value):
3 for i in range(5):
4... | TypeError |
def _analyze_assign(self, assign):
lhs = assign.target.name
rhs = assign.value
if isinstance(rhs, ir.Global):
for T in MAP_TYPES:
if isinstance(rhs.value, T):
self.map_calls.append(lhs)
if isinstance(rhs.value, pytypes.ModuleType) and rhs.value == numpy:
... | def _analyze_assign(self, assign):
lhs = assign.target.name
rhs = assign.value
if isinstance(rhs, ir.Global):
for T in MAP_TYPES:
if isinstance(rhs.value, T):
self.map_calls.append(lhs)
if isinstance(rhs.value, pytypes.ModuleType) and rhs.value == numpy:
... | https://github.com/numba/numba/issues/25 | ---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-15-3b23f7331ceb> in <module>()
----> 1 @jit(arg_types=[numba.double], ret_type=numba.double)
2 def is_REALLY_five(some_value):
3 for i in range(5):
4... | TypeError |
def _analyze_rhs_classes(self, node):
"""analysis of rhs when lhs is array so rhs has to return array"""
if isinstance(node, ir.Arg):
return None
# can't assume node.name is valid variable
# assert self._isarray(node.name)
# return self._add_array_corr(node.name)
elif isinsta... | def _analyze_rhs_classes(self, node):
if isinstance(node, ir.Arg):
assert self._isarray(node.name)
return self._add_array_corr(node.name)
elif isinstance(node, ir.Var):
return copy.copy(self.array_shape_classes[node.name])
elif isinstance(node, (ir.Global, ir.FreeVar)):
# XXX... | https://github.com/numba/numba/issues/25 | ---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-15-3b23f7331ceb> in <module>()
----> 1 @jit(arg_types=[numba.double], ret_type=numba.double)
2 def is_REALLY_five(some_value):
3 for i in range(5):
4... | TypeError |
def _analyze_np_call(self, call_name, args, kws):
# print("numpy call ",call_name,args)
if call_name == "transpose":
out_eqs = copy.copy(self.array_shape_classes[args[0].name])
out_eqs.reverse()
return out_eqs
elif call_name in array_creation:
# these calls (e.g. empty) have ... | def _analyze_np_call(self, call_name, args, kws):
# print("numpy call ",call_name,args)
if call_name == "transpose":
out_eqs = copy.copy(self.array_shape_classes[args[0].name])
out_eqs.reverse()
return out_eqs
elif call_name in [
"empty",
"zeros",
"ones",
... | https://github.com/numba/numba/issues/25 | ---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-15-3b23f7331ceb> in <module>()
----> 1 @jit(arg_types=[numba.double], ret_type=numba.double)
2 def is_REALLY_five(some_value):
3 for i in range(5):
4... | TypeError |
def copy_propagate_update_analysis(stmt, var_dict, array_analysis):
"""update array analysis data during copy propagation.
If an array is in defs of a statement, we update its size variables.
"""
array_shape_classes = array_analysis.array_shape_classes
class_sizes = array_analysis.class_sizes
ar... | def copy_propagate_update_analysis(stmt, var_dict, array_analysis):
"""update array analysis data during copy propagation.
If an array is in defs of a statement, we update its size variables.
"""
array_shape_classes = array_analysis.array_shape_classes
class_sizes = array_analysis.class_sizes
ar... | https://github.com/numba/numba/issues/25 | ---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-15-3b23f7331ceb> in <module>()
----> 1 @jit(arg_types=[numba.double], ret_type=numba.double)
2 def is_REALLY_five(some_value):
3 for i in range(5):
4... | TypeError |
def stage_parfor_pass(self):
"""
Convert data-parallel computations into Parfor nodes
"""
# Ensure we have an IR and type information.
assert self.func_ir
parfor_pass = ParforPass(
self.func_ir,
self.type_annotation.typemap,
self.type_annotation.calltypes,
self.re... | def stage_parfor_pass(self):
"""
Convert data-parallel computations into Parfor nodes
"""
# Ensure we have an IR and type information.
assert self.func_ir
parfor_pass = ParforPass(
self.func_ir,
self.type_annotation.typemap,
self.type_annotation.calltypes,
self.re... | https://github.com/numba/numba/issues/25 | ---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-15-3b23f7331ceb> in <module>()
----> 1 @jit(arg_types=[numba.double], ret_type=numba.double)
2 def is_REALLY_five(some_value):
3 for i in range(5):
4... | TypeError |
def stage_inline_pass(self):
"""
Inline calls to locally defined closures.
"""
# Ensure we have an IR and type information.
assert self.func_ir
inline_pass = InlineClosureCallPass(self.func_ir, self.flags, run_frontend)
inline_pass.run()
# Remove all Dels, and re-run postproc
post_pr... | def stage_inline_pass(self):
"""
Inline calls to locally defined closures.
"""
# Ensure we have an IR and type information.
assert self.func_ir
inline_pass = InlineClosureCallPass(self.func_ir, run_frontend)
inline_pass.run()
# Remove all Dels, and re-run postproc
post_proc = postpro... | https://github.com/numba/numba/issues/25 | ---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-15-3b23f7331ceb> in <module>()
----> 1 @jit(arg_types=[numba.double], ret_type=numba.double)
2 def is_REALLY_five(some_value):
3 for i in range(5):
4... | TypeError |
def legalize_return_type(return_type, interp, targetctx):
"""
Only accept array return type iff it is passed into the function.
Reject function object return types if in nopython mode.
"""
if not targetctx.enable_nrt and isinstance(return_type, types.Array):
# Walk IR to discover all argumen... | def legalize_return_type(return_type, interp, targetctx):
"""
Only accept array return type iff it is passed into the function.
Reject function object return types if in nopython mode.
"""
if not targetctx.enable_nrt and isinstance(return_type, types.Array):
# Walk IR to discover all argumen... | https://github.com/numba/numba/issues/25 | ---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-15-3b23f7331ceb> in <module>()
----> 1 @jit(arg_types=[numba.double], ret_type=numba.double)
2 def is_REALLY_five(some_value):
3 for i in range(5):
4... | TypeError |
def __init__(self, shape, strides, dtype, stream=0, writeback=None, gpu_data=None):
"""
Args
----
shape
array shape.
strides
array strides.
dtype
data type as np.dtype.
stream
cuda stream.
writeback
Deprecated.
gpu_data
user provided d... | def __init__(self, shape, strides, dtype, stream=0, writeback=None, gpu_data=None):
"""
Args
----
shape
array shape.
strides
array strides.
dtype
data type as np.dtype.
stream
cuda stream.
writeback
Deprecated.
gpu_data
user provided d... | https://github.com/numba/numba/issues/25 | ---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-15-3b23f7331ceb> in <module>()
----> 1 @jit(arg_types=[numba.double], ret_type=numba.double)
2 def is_REALLY_five(some_value):
3 for i in range(5):
4... | TypeError |
def view(self, start, stop=None):
if stop is None:
size = self.size - start
else:
size = stop - start
# Handle NULL/empty memory buffer
if self.device_pointer.value is None:
if size != 0:
raise RuntimeError("non-empty slice into empty slice")
view = self # n... | def view(self, start, stop=None):
base = self.device_pointer.value + start
if stop is None:
size = self.size - start
else:
size = stop - start
assert size > 0, "zero or negative memory size"
pointer = drvapi.cu_device_ptr(base)
view = MemoryPointer(self.context, pointer, size, ow... | https://github.com/numba/numba/issues/25 | ---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-15-3b23f7331ceb> in <module>()
----> 1 @jit(arg_types=[numba.double], ret_type=numba.double)
2 def is_REALLY_five(some_value):
3 for i in range(5):
4... | TypeError |
def jit(signature_or_function=None, locals={}, target="cpu", cache=False, **options):
"""
This decorator is used to compile a Python function into native code.
Args
-----
signature:
The (optional) signature or list of signatures to be compiled.
If not passed, required signatures wil... | def jit(signature_or_function=None, locals={}, target="cpu", cache=False, **options):
"""
This decorator is used to compile a Python function into native code.
Args
-----
signature:
The (optional) signature or list of signatures to be compiled.
If not passed, required signatures wil... | https://github.com/numba/numba/issues/25 | ---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-15-3b23f7331ceb> in <module>()
----> 1 @jit(arg_types=[numba.double], ret_type=numba.double)
2 def is_REALLY_five(some_value):
3 for i in range(5):
4... | TypeError |
def __getitem__(self, item):
if isinstance(item, slice):
start, stop, step = item.start, item.stop, item.step
single = False
else:
single = True
start = item
stop = start + 1
step = None
# Default values
# Start value is default to zero
if start is ... | def __getitem__(self, item):
if isinstance(item, slice):
start, stop, step = item.start, item.stop, item.step
single = False
else:
single = True
start = item
stop = start + 1
step = None
if start is None:
start = 0
if stop is None:
stop = ... | https://github.com/numba/numba/issues/25 | ---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-15-3b23f7331ceb> in <module>()
----> 1 @jit(arg_types=[numba.double], ret_type=numba.double)
2 def is_REALLY_five(some_value):
3 for i in range(5):
4... | TypeError |
def _compute_extent(self):
firstidx = [0] * self.ndim
lastidx = [s - 1 for s in self.shape]
start = compute_index(firstidx, self.dims)
stop = compute_index(lastidx, self.dims) + self.itemsize
stop = max(stop, start) # ensure postive extent
return Extent(start, stop)
| def _compute_extent(self):
firstidx = [0] * self.ndim
lastidx = [s - 1 for s in self.shape]
start = compute_index(firstidx, self.dims)
stop = compute_index(lastidx, self.dims) + self.itemsize
return Extent(start, stop)
| https://github.com/numba/numba/issues/25 | ---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-15-3b23f7331ceb> in <module>()
----> 1 @jit(arg_types=[numba.double], ret_type=numba.double)
2 def is_REALLY_five(some_value):
3 for i in range(5):
4... | TypeError |
def new_error_context(fmt_, *args, **kwargs):
"""
A contextmanager that prepend contextual information to any exception
raised within. If the exception type is not an instance of NumbaError,
it will be wrapped into a InternalError. The exception class can be
changed by providing a "errcls_" keywo... | def new_error_context(fmt_, *args, **kwargs):
"""
A contextmanager that prepend contextual information to any exception
raised within. If the exception type is not an instance of NumbaError,
it will be wrapped into a InternalError. The exception class can be
changed by providing a "errcls_" keywo... | https://github.com/numba/numba/issues/25 | ---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-15-3b23f7331ceb> in <module>()
----> 1 @jit(arg_types=[numba.double], ret_type=numba.double)
2 def is_REALLY_five(some_value):
3 for i in range(5):
4... | TypeError |
def __init__(self, func_ir, flags, run_frontend):
self.func_ir = func_ir
self.flags = flags
self.run_frontend = run_frontend
| def __init__(self, func_ir, run_frontend):
self.func_ir = func_ir
self.run_frontend = run_frontend
| https://github.com/numba/numba/issues/25 | ---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-15-3b23f7331ceb> in <module>()
----> 1 @jit(arg_types=[numba.double], ret_type=numba.double)
2 def is_REALLY_five(some_value):
3 for i in range(5):
4... | TypeError |
def run(self):
"""Run inline closure call pass."""
modified = False
work_list = list(self.func_ir.blocks.items())
debug_print = _make_debug_print("InlineClosureCallPass")
debug_print("START")
while work_list:
label, block = work_list.pop()
for i in range(len(block.body)):
... | def run(self):
"""Run inline closure call pass."""
modified = False
work_list = list(self.func_ir.blocks.items())
_debug_print("START InlineClosureCall")
while work_list:
label, block = work_list.pop()
for i in range(len(block.body)):
instr = block.body[i]
if ... | https://github.com/numba/numba/issues/25 | ---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-15-3b23f7331ceb> in <module>()
----> 1 @jit(arg_types=[numba.double], ret_type=numba.double)
2 def is_REALLY_five(some_value):
3 for i in range(5):
4... | TypeError |
def inline_closure_call(self, block, i, callee):
"""Inline the body of `callee` at its callsite (`i`-th instruction of `block`)"""
scope = block.scope
instr = block.body[i]
call_expr = instr.value
debug_print = _make_debug_print("inline_closure_call")
debug_print("Found closure call: ", instr, "... | def inline_closure_call(self, block, i, callee):
"""Inline the body of `callee` at its callsite (`i`-th instruction of `block`)"""
scope = block.scope
instr = block.body[i]
call_expr = instr.value
_debug_print("Found closure call: ", instr, " with callee = ", callee)
func_ir = self.func_ir
#... | https://github.com/numba/numba/issues/25 | ---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-15-3b23f7331ceb> in <module>()
----> 1 @jit(arg_types=[numba.double], ret_type=numba.double)
2 def is_REALLY_five(some_value):
3 for i in range(5):
4... | TypeError |
def _replace_returns(blocks, target, return_label):
"""
Return return statement by assigning directly to target, and a jump.
"""
for label, block in blocks.items():
casts = []
for i in range(len(block.body)):
stmt = block.body[i]
if isinstance(stmt, ir.Return):
... | def _replace_returns(blocks, target, return_label):
"""
Return return statement by assigning directly to target, and a jump.
"""
for label, block in blocks.items():
for i in range(len(block.body)):
stmt = block.body[i]
if isinstance(stmt, ir.Return):
asser... | https://github.com/numba/numba/issues/25 | ---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-15-3b23f7331ceb> in <module>()
----> 1 @jit(arg_types=[numba.double], ret_type=numba.double)
2 def is_REALLY_five(some_value):
3 for i in range(5):
4... | TypeError |
def get_definition(self, value, lhs_only=False):
"""
Get the definition site for the given variable name or instance.
A Expr instance is returned by default, but if lhs_only is set
to True, the left-hand-side variable is returned instead.
"""
lhs = value
while True:
if isinstance(val... | def get_definition(self, value):
"""
Get the definition site for the given variable name or instance.
A Expr instance is returned.
"""
while True:
if isinstance(value, Var):
name = value.name
elif isinstance(value, str):
name = value
else:
... | https://github.com/numba/numba/issues/25 | ---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-15-3b23f7331ceb> in <module>()
----> 1 @jit(arg_types=[numba.double], ret_type=numba.double)
2 def is_REALLY_five(some_value):
3 for i in range(5):
4... | TypeError |
def mk_alloc(typemap, calltypes, lhs, size_var, dtype, scope, loc):
"""generate an array allocation with np.empty() and return list of nodes.
size_var can be an int variable or tuple of int variables.
"""
out = []
ndims = 1
size_typ = types.intp
if isinstance(size_var, tuple):
if len... | def mk_alloc(typemap, calltypes, lhs, size_var, dtype, scope, loc):
"""generate an array allocation with np.empty() and return list of nodes.
size_var can be an int variable or tuple of int variables.
"""
out = []
ndims = 1
size_typ = types.intp
if isinstance(size_var, tuple):
if len... | https://github.com/numba/numba/issues/25 | ---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-15-3b23f7331ceb> in <module>()
----> 1 @jit(arg_types=[numba.double], ret_type=numba.double)
2 def is_REALLY_five(some_value):
3 for i in range(5):
4... | TypeError |
def visit_vars_stmt(stmt, callback, cbdata):
# let external calls handle stmt if type matches
for t, f in visit_vars_extensions.items():
if isinstance(stmt, t):
f(stmt, callback, cbdata)
return
if isinstance(stmt, ir.Assign):
stmt.target = visit_vars_inner(stmt.target... | def visit_vars_stmt(stmt, callback, cbdata):
# let external calls handle stmt if type matches
for t, f in visit_vars_extensions.items():
if isinstance(stmt, t):
f(stmt, callback, cbdata)
return
if isinstance(stmt, ir.Assign):
stmt.target = visit_vars_inner(stmt.target... | https://github.com/numba/numba/issues/25 | ---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-15-3b23f7331ceb> in <module>()
----> 1 @jit(arg_types=[numba.double], ret_type=numba.double)
2 def is_REALLY_five(some_value):
3 for i in range(5):
4... | TypeError |
def add_offset_to_labels(blocks, offset):
"""add an offset to all block labels and jump/branch targets"""
new_blocks = {}
for l, b in blocks.items():
# some parfor last blocks might be empty
term = None
if b.body:
term = b.body[-1]
for inst in b.body:
... | def add_offset_to_labels(blocks, offset):
"""add an offset to all block labels and jump/branch targets"""
new_blocks = {}
for l, b in blocks.items():
term = b.body[-1]
if isinstance(term, ir.Jump):
term.target += offset
if isinstance(term, ir.Branch):
term.tru... | https://github.com/numba/numba/issues/25 | ---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-15-3b23f7331ceb> in <module>()
----> 1 @jit(arg_types=[numba.double], ret_type=numba.double)
2 def is_REALLY_five(some_value):
3 for i in range(5):
4... | TypeError |
def remove_dead(blocks, args, typemap=None, alias_map=None, arg_aliases=None):
"""dead code elimination using liveness and CFG info.
Returns True if something has been removed, or False if nothing is removed.
"""
cfg = compute_cfg_from_blocks(blocks)
usedefs = compute_use_defs(blocks)
live_map =... | def remove_dead(blocks, args):
"""dead code elimination using liveness and CFG info.
Returns True if something has been removed, or False if nothing is removed."""
cfg = compute_cfg_from_blocks(blocks)
usedefs = compute_use_defs(blocks)
live_map = compute_live_map(cfg, blocks, usedefs.usemap, usedef... | https://github.com/numba/numba/issues/25 | ---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-15-3b23f7331ceb> in <module>()
----> 1 @jit(arg_types=[numba.double], ret_type=numba.double)
2 def is_REALLY_five(some_value):
3 for i in range(5):
4... | TypeError |
def remove_dead_block(
block, lives, call_table, arg_aliases, alias_map, alias_set, typemap
):
"""remove dead code using liveness info.
Mutable arguments (e.g. arrays) that are not definitely assigned are live
after return of function.
"""
# TODO: find mutable args that are not definitely assign... | def remove_dead_block(block, lives, call_table, args):
"""remove dead code using liveness info.
Mutable arguments (e.g. arrays) that are not definitely assigned are live
after return of function.
"""
# TODO: find mutable args that are not definitely assigned instead of
# assuming all args are li... | https://github.com/numba/numba/issues/25 | ---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-15-3b23f7331ceb> in <module>()
----> 1 @jit(arg_types=[numba.double], ret_type=numba.double)
2 def is_REALLY_five(some_value):
3 for i in range(5):
4... | TypeError |
def has_no_side_effect(rhs, lives, call_table):
# TODO: find side-effect free calls like Numpy calls
if isinstance(rhs, ir.Expr) and rhs.op == "call":
func_name = rhs.func.name
if func_name not in call_table or call_table[func_name] == []:
return False
call_list = call_table[... | def has_no_side_effect(rhs, lives, call_table):
# TODO: find side-effect free calls like Numpy calls
if isinstance(rhs, ir.Expr) and rhs.op == "call":
func_name = rhs.func.name
if func_name not in call_table:
return False
call_list = call_table[func_name]
if call_list... | https://github.com/numba/numba/issues/25 | ---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-15-3b23f7331ceb> in <module>()
----> 1 @jit(arg_types=[numba.double], ret_type=numba.double)
2 def is_REALLY_five(some_value):
3 for i in range(5):
4... | TypeError |
def find_potential_aliases(blocks, args, typemap, alias_map=None, arg_aliases=None):
"find all array aliases and argument aliases to avoid remove as dead"
if alias_map is None:
alias_map = {}
if arg_aliases is None:
arg_aliases = set(a for a in args if not is_immutable_type(a, typemap))
... | def find_potential_aliases(blocks, args):
aliases = set(args)
for bl in blocks.values():
for instr in bl.body:
if isinstance(instr, ir.Assign):
expr = instr.value
lhs = instr.target.name
if isinstance(expr, ir.Var) and expr.name in aliases:
... | https://github.com/numba/numba/issues/25 | ---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-15-3b23f7331ceb> in <module>()
----> 1 @jit(arg_types=[numba.double], ret_type=numba.double)
2 def is_REALLY_five(some_value):
3 for i in range(5):
4... | TypeError |
def get_block_copies(blocks, typemap):
"""get copies generated and killed by each block"""
block_copies = {}
extra_kill = {}
for label, block in blocks.items():
assign_dict = {}
extra_kill[label] = set()
# assignments as dict to replace with latest value
for stmt in block... | def get_block_copies(blocks, typemap):
"""get copies generated and killed by each block"""
block_copies = {}
extra_kill = {}
for label, block in blocks.items():
assign_dict = {}
extra_kill[label] = set()
# assignments as dict to replace with latest value
for stmt in block... | https://github.com/numba/numba/issues/25 | ---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-15-3b23f7331ceb> in <module>()
----> 1 @jit(arg_types=[numba.double], ret_type=numba.double)
2 def is_REALLY_five(some_value):
3 for i in range(5):
4... | TypeError |
def apply_copy_propagate(
blocks, in_copies, name_var_table, ext_func, ext_data, typemap, calltypes
):
"""apply copy propagation to IR: replace variables when copies available"""
for label, block in blocks.items():
var_dict = {l: name_var_table[r] for l, r in in_copies[label]}
# assignments ... | def apply_copy_propagate(
blocks, in_copies, name_var_table, ext_func, ext_data, typemap, calltypes
):
"""apply copy propagation to IR: replace variables when copies available"""
for label, block in blocks.items():
var_dict = {l: name_var_table[r] for l, r in in_copies[label]}
# assignments ... | https://github.com/numba/numba/issues/25 | ---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-15-3b23f7331ceb> in <module>()
----> 1 @jit(arg_types=[numba.double], ret_type=numba.double)
2 def is_REALLY_five(some_value):
3 for i in range(5):
4... | TypeError |
def get_call_table(blocks, call_table=None, reverse_call_table=None):
"""returns a dictionary of call variables and their references."""
# call_table example: c = np.zeros becomes c:["zeroes", np]
# reverse_call_table example: c = np.zeros becomes np_var:c
if call_table is None:
call_table = {}
... | def get_call_table(blocks, call_table={}, reverse_call_table={}):
"""returns a dictionary of call variables and their references."""
# call_table example: c = np.zeros becomes c:["zeroes", np]
# reverse_call_table example: c = np.zeros becomes np_var:c
topo_order = find_topo_order(blocks)
for label... | https://github.com/numba/numba/issues/25 | ---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-15-3b23f7331ceb> in <module>()
----> 1 @jit(arg_types=[numba.double], ret_type=numba.double)
2 def is_REALLY_five(some_value):
3 for i in range(5):
4... | TypeError |
def get_tuple_table(blocks, tuple_table=None):
"""returns a dictionary of tuple variables and their values."""
if tuple_table is None:
tuple_table = {}
for block in blocks.values():
for inst in block.body:
if isinstance(inst, ir.Assign):
lhs = inst.target.name
... | def get_tuple_table(blocks, tuple_table={}):
"""returns a dictionary of tuple variables and their values."""
for block in blocks.values():
for inst in block.body:
if isinstance(inst, ir.Assign):
lhs = inst.target.name
rhs = inst.value
if isinst... | https://github.com/numba/numba/issues/25 | ---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-15-3b23f7331ceb> in <module>()
----> 1 @jit(arg_types=[numba.double], ret_type=numba.double)
2 def is_REALLY_five(some_value):
3 for i in range(5):
4... | TypeError |
def get_array_accesses(blocks, accesses=None):
"""returns a dictionary of arrays accessed and their indices."""
if accesses is None:
accesses = {}
for block in blocks.values():
for inst in block.body:
if isinstance(inst, ir.SetItem):
accesses[inst.target.name] = ... | def get_array_accesses(blocks, accesses={}):
"""returns a dictionary of arrays accessed and their indices."""
for block in blocks.values():
for inst in block.body:
if isinstance(inst, ir.SetItem):
accesses[inst.target.name] = inst.index.name
if isinstance(inst, ir... | https://github.com/numba/numba/issues/25 | ---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-15-3b23f7331ceb> in <module>()
----> 1 @jit(arg_types=[numba.double], ret_type=numba.double)
2 def is_REALLY_five(some_value):
3 for i in range(5):
4... | TypeError |
def match(self, func_ir, block, typemap, calltypes):
"""
Using typing and a basic block, search the basic block for array
expressions.
Return True when one or more matches were found, False otherwise.
"""
# We can trivially reject everything if there are no
# calls in the type results.
i... | def match(self, interp, block, typemap, calltypes):
"""
Using typing and a basic block, search the basic block for array
expressions.
Return True when one or more matches were found, False otherwise.
"""
# We can trivially reject everything if there are no
# calls in the type results.
if... | https://github.com/numba/numba/issues/25 | ---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-15-3b23f7331ceb> in <module>()
----> 1 @jit(arg_types=[numba.double], ret_type=numba.double)
2 def is_REALLY_five(some_value):
3 for i in range(5):
4... | TypeError |
def _lower_parfor_parallel(lowerer, parfor):
"""Lowerer that handles LLVM code generation for parfor.
This function lowers a parfor IR node to LLVM.
The general approach is as follows:
1) The code from the parfor's init block is lowered normally
in the context of the current function.
2) The ... | def _lower_parfor_parallel(lowerer, parfor):
"""Lowerer that handles LLVM code generation for parfor.
This function lowers a parfor IR node to LLVM.
The general approach is as follows:
1) The code from the parfor's init block is lowered normally
in the context of the current function.
2) The ... | https://github.com/numba/numba/issues/25 | ---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-15-3b23f7331ceb> in <module>()
----> 1 @jit(arg_types=[numba.double], ret_type=numba.double)
2 def is_REALLY_five(some_value):
3 for i in range(5):
4... | TypeError |
def _create_shape_signature(classes, num_inputs, num_reductions, args, func_sig):
"""Create shape signature for GUFunc"""
num_inouts = len(args) - num_reductions
# maximum class number for array shapes
max_shape_num = max(sum([list(x) for x in classes.values()], [1]))
if config.DEBUG_ARRAY_OPT:
... | def _create_shape_signature(classes, num_inputs, num_reductions, args, func_sig):
"""Create shape signature for GUFunc"""
num_inouts = len(args) - num_reductions
# maximum class number for array shapes
max_shape_num = max(sum([list(x) for x in classes.values()], []))
if config.DEBUG_ARRAY_OPT:
... | https://github.com/numba/numba/issues/25 | ---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-15-3b23f7331ceb> in <module>()
----> 1 @jit(arg_types=[numba.double], ret_type=numba.double)
2 def is_REALLY_five(some_value):
3 for i in range(5):
4... | TypeError |
def _create_gufunc_for_parfor_body(
lowerer, parfor, typemap, typingctx, targetctx, flags, locals
):
"""
Takes a parfor and creates a gufunc function for its body.
There are two parts to this function.
1) Code to iterate across the iteration space as defined by the schedule.
2) The parfor body t... | def _create_gufunc_for_parfor_body(
lowerer, parfor, typemap, typingctx, targetctx, flags, locals
):
"""
Takes a parfor and creates a gufunc function for its body.
There are two parts to this function.
1) Code to iterate across the iteration space as defined by the schedule.
2) The parfor body t... | https://github.com/numba/numba/issues/25 | ---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-15-3b23f7331ceb> in <module>()
----> 1 @jit(arg_types=[numba.double], ret_type=numba.double)
2 def is_REALLY_five(some_value):
3 for i in range(5):
4... | TypeError |
def call_parallel_gufunc(
lowerer,
cres,
gu_signature,
outer_sig,
expr_args,
loop_ranges,
redvars,
reddict,
init_block,
):
"""
Adds the call to the gufunc function from the main function.
"""
context = lowerer.context
builder = lowerer.builder
library = lowere... | def call_parallel_gufunc(
lowerer,
cres,
gu_signature,
outer_sig,
expr_args,
loop_ranges,
array_size_vars,
redvars,
reddict,
init_block,
):
"""
Adds the call to the gufunc function from the main function.
"""
context = lowerer.context
builder = lowerer.builder... | https://github.com/numba/numba/issues/25 | ---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-15-3b23f7331ceb> in <module>()
----> 1 @jit(arg_types=[numba.double], ret_type=numba.double)
2 def is_REALLY_five(some_value):
3 for i in range(5):
4... | TypeError |
def _build_element_wise_ufunc_wrapper(cres, signature):
"""Build a wrapper for the ufunc loop entry point given by the
compilation result object, using the element-wise signature.
"""
ctx = cres.target_context
library = cres.library
fname = cres.fndesc.llvm_func_name
env = cres.environment
... | def _build_element_wise_ufunc_wrapper(cres, signature):
"""Build a wrapper for the ufunc loop entry point given by the
compilation result object, using the element-wise signature.
"""
ctx = cres.target_context
library = cres.library
fname = cres.fndesc.llvm_func_name
env = cres.environment
... | https://github.com/numba/numba/issues/25 | ---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-15-3b23f7331ceb> in <module>()
----> 1 @jit(arg_types=[numba.double], ret_type=numba.double)
2 def is_REALLY_five(some_value):
3 for i in range(5):
4... | TypeError |
def build(self, cres):
"""
Returns (dtype numbers, function ptr, EnvironmentObject)
"""
# Buider wrapper for ufunc entry point
signature = cres.signature
with compiler.lock_compiler:
ptr, env, wrapper_name = build_gufunc_wrapper(
self.py_func, cres, self.sin, self.sout, cache... | def build(self, cres):
"""
Returns (dtype numbers, function ptr, EnvironmentObject)
"""
# Buider wrapper for ufunc entry point
signature = cres.signature
ptr, env, wrapper_name = build_gufunc_wrapper(
self.py_func, cres, self.sin, self.sout, cache=self.cache
)
# Get dtypes
d... | https://github.com/numba/numba/issues/25 | ---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-15-3b23f7331ceb> in <module>()
----> 1 @jit(arg_types=[numba.double], ret_type=numba.double)
2 def is_REALLY_five(some_value):
3 for i in range(5):
4... | TypeError |
def as_dtype(nbtype):
"""
Return a numpy dtype instance corresponding to the given Numba type.
NotImplementedError is if no correspondence is known.
"""
if isinstance(nbtype, (types.Complex, types.Integer, types.Float)):
return np.dtype(str(nbtype))
if nbtype is types.bool_:
retu... | def as_dtype(nbtype):
"""
Return a numpy dtype instance corresponding to the given Numba type.
NotImplementedError is if no correspondence is known.
"""
if isinstance(nbtype, (types.Complex, types.Integer, types.Float)):
return np.dtype(str(nbtype))
if nbtype is types.bool_:
retu... | https://github.com/numba/numba/issues/25 | ---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-15-3b23f7331ceb> in <module>()
----> 1 @jit(arg_types=[numba.double], ret_type=numba.double)
2 def is_REALLY_five(some_value):
3 for i in range(5):
4... | TypeError |
def __init__(self, loop_nests, init_block, loop_body, loc, array_analysis, index_var):
super(Parfor, self).__init__(op="parfor", loc=loc)
self.id = type(self).id_counter
type(self).id_counter += 1
# self.input_info = input_info
# self.output_info = output_info
self.loop_nests = loop_nests
... | def __init__(self, loop_nests, init_block, loop_body, loc, array_analysis, index_var):
super(Parfor, self).__init__(op="parfor", loc=loc)
self.id = type(self).id_counter
type(self).id_counter = +1
# self.input_info = input_info
# self.output_info = output_info
self.loop_nests = loop_nests
... | https://github.com/numba/numba/issues/25 | ---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-15-3b23f7331ceb> in <module>()
----> 1 @jit(arg_types=[numba.double], ret_type=numba.double)
2 def is_REALLY_five(some_value):
3 for i in range(5):
4... | TypeError |
def __repr__(self):
return repr(self.loop_nests) + repr(self.loop_body) + repr(self.index_var)
| def __repr__(self):
return repr(self.loop_nests) + repr(self.loop_body) + repr(self.index_var)
| https://github.com/numba/numba/issues/25 | ---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-15-3b23f7331ceb> in <module>()
----> 1 @jit(arg_types=[numba.double], ret_type=numba.double)
2 def is_REALLY_five(some_value):
3 for i in range(5):
4... | TypeError |
def dump(self, file=None):
file = file or sys.stdout
print(("begin parfor {}".format(self.id)).center(20, "-"), file=file)
print("index_var = ", self.index_var)
for loopnest in self.loop_nests:
print(loopnest, file=file)
print("init block:", file=file)
self.init_block.dump()
for offs... | def dump(self, file=None):
file = file or sys.stdout
print(("begin parfor {}".format(self.id)).center(20, "-"), file=file)
print("index_var = ", self.index_var)
for loopnest in self.loop_nests:
print(loopnest, file=file)
print("init block:", file=file)
self.init_block.dump()
for offs... | https://github.com/numba/numba/issues/25 | ---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-15-3b23f7331ceb> in <module>()
----> 1 @jit(arg_types=[numba.double], ret_type=numba.double)
2 def is_REALLY_five(some_value):
3 for i in range(5):
4... | TypeError |
def __init__(self, func_ir, typemap, calltypes, return_type, typingctx):
self.func_ir = func_ir
self.typemap = typemap
self.calltypes = calltypes
self.typingctx = typingctx
self.return_type = return_type
self.array_analysis = array_analysis.ArrayAnalysis(func_ir, typemap, calltypes)
ir_utils... | def __init__(self, func_ir, typemap, calltypes, return_type):
self.func_ir = func_ir
self.typemap = typemap
self.calltypes = calltypes
self.return_type = return_type
self.array_analysis = array_analysis.ArrayAnalysis(func_ir, typemap, calltypes)
ir_utils._max_label = max(func_ir.blocks.keys())
| https://github.com/numba/numba/issues/25 | ---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-15-3b23f7331ceb> in <module>()
----> 1 @jit(arg_types=[numba.double], ret_type=numba.double)
2 def is_REALLY_five(some_value):
3 for i in range(5):
4... | TypeError |
def run(self):
"""run parfor conversion pass: replace Numpy calls
with Parfors when possible and optimize the IR."""
self.func_ir.blocks = simplify_CFG(self.func_ir.blocks)
# remove Del statements for easier optimization
remove_dels(self.func_ir.blocks)
# e.g. convert A.sum() to np.sum(A) for ea... | def run(self):
"""run parfor conversion pass: replace Numpy calls
with Parfors when possible and optimize the IR."""
self.array_analysis.run()
topo_order = find_topo_order(self.func_ir.blocks)
# variables available in the program so far (used for finding map
# functions in array_expr lowering)
... | https://github.com/numba/numba/issues/25 | ---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-15-3b23f7331ceb> in <module>()
----> 1 @jit(arg_types=[numba.double], ret_type=numba.double)
2 def is_REALLY_five(some_value):
3 for i in range(5):
4... | TypeError |
def _is_supported_npycall(self, expr):
"""check if we support parfor translation for
this Numpy call.
"""
# return False # turn off for now
if not (isinstance(expr, ir.Expr) and expr.op == "call"):
return False
if expr.func.name not in self.array_analysis.numpy_calls.keys():
retu... | def _is_supported_npycall(self, expr):
"""check if we support parfor translation for
this Numpy call.
"""
# return False # turn off for now
if not (isinstance(expr, ir.Expr) and expr.op == "call"):
return False
if expr.func.name not in self.array_analysis.numpy_calls.keys():
retu... | https://github.com/numba/numba/issues/25 | ---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-15-3b23f7331ceb> in <module>()
----> 1 @jit(arg_types=[numba.double], ret_type=numba.double)
2 def is_REALLY_five(some_value):
3 for i in range(5):
4... | TypeError |
def _numpy_to_parfor(self, lhs, expr):
assert isinstance(expr, ir.Expr) and expr.op == "call"
call_name = self.array_analysis.numpy_calls[expr.func.name]
args = expr.args
kws = dict(expr.kws)
if call_name in ["zeros", "ones"] or call_name.startswith("random."):
return self._numpy_map_to_parf... | def _numpy_to_parfor(self, lhs, expr):
assert isinstance(expr, ir.Expr) and expr.op == "call"
call_name = self.array_analysis.numpy_calls[expr.func.name]
args = expr.args
kws = dict(expr.kws)
if call_name in ["zeros", "ones", "random.ranf"]:
return self._numpy_map_to_parfor(call_name, lhs, a... | https://github.com/numba/numba/issues/25 | ---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-15-3b23f7331ceb> in <module>()
----> 1 @jit(arg_types=[numba.double], ret_type=numba.double)
2 def is_REALLY_five(some_value):
3 for i in range(5):
4... | TypeError |
def _numpy_map_to_parfor(self, call_name, lhs, args, kws, expr):
"""generate parfor from Numpy calls that are maps."""
scope = lhs.scope
loc = lhs.loc
arr_typ = self.typemap[lhs.name]
el_typ = arr_typ.dtype
# generate loopnests and size variables from lhs correlations
loopnests = []
siz... | def _numpy_map_to_parfor(self, call_name, lhs, args, kws, expr):
"""generate parfor from Numpy calls that are maps."""
scope = lhs.scope
loc = lhs.loc
arr_typ = self.typemap[lhs.name]
el_typ = arr_typ.dtype
# generate loopnests and size variables from lhs correlations
loopnests = []
siz... | https://github.com/numba/numba/issues/25 | ---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-15-3b23f7331ceb> in <module>()
----> 1 @jit(arg_types=[numba.double], ret_type=numba.double)
2 def is_REALLY_five(some_value):
3 for i in range(5):
4... | TypeError |
def _reduction_to_parfor(self, lhs, expr):
assert isinstance(expr, ir.Expr) and expr.op == "call"
call_name = self.array_analysis.numpy_calls[expr.func.name]
args = expr.args
kws = dict(expr.kws)
if call_name in _reduction_ops:
acc_op, im_op, init_val = _reduction_ops[call_name]
asse... | def _reduction_to_parfor(self, lhs, expr):
assert isinstance(expr, ir.Expr) and expr.op == "call"
call_name = self.array_analysis.numpy_calls[expr.func.name]
args = expr.args
kws = dict(expr.kws)
if call_name in _reduction_ops:
acc_op, im_op, init_val = _reduction_ops[call_name]
asse... | https://github.com/numba/numba/issues/25 | ---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-15-3b23f7331ceb> in <module>()
----> 1 @jit(arg_types=[numba.double], ret_type=numba.double)
2 def is_REALLY_five(some_value):
3 for i in range(5):
4... | TypeError |
def lower_parfor_sequential(func_ir, typemap, calltypes):
ir_utils._max_label = ir_utils.find_max_label(func_ir.blocks) + 1
parfor_found = False
new_blocks = {}
for block_label, block in func_ir.blocks.items():
block_label, parfor_found = _lower_parfor_sequential_block(
block_label,... | def lower_parfor_sequential(func_ir, typemap, calltypes):
parfor_found = False
new_blocks = {}
for block_label, block in func_ir.blocks.items():
scope = block.scope
i = _find_first_parfor(block.body)
while i != -1:
parfor_found = True
inst = block.body[i]
... | https://github.com/numba/numba/issues/25 | ---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-15-3b23f7331ceb> in <module>()
----> 1 @jit(arg_types=[numba.double], ret_type=numba.double)
2 def is_REALLY_five(some_value):
3 for i in range(5):
4... | TypeError |
def get_parfor_params(blocks):
"""find variables used in body of parfors from outside and save them.
computed as live variables at entry of first block.
"""
# since parfor wrap creates a back-edge to first non-init basic block,
# live_map[first_non_init_block] contains variables defined in parfor b... | def get_parfor_params(parfor):
"""find variables used in body of parfor from outside.
computed as live variables at entry of first block.
"""
blocks = wrap_parfor_blocks(parfor)
cfg = compute_cfg_from_blocks(blocks)
usedefs = compute_use_defs(blocks)
live_map = compute_live_map(cfg, blocks, ... | https://github.com/numba/numba/issues/25 | ---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-15-3b23f7331ceb> in <module>()
----> 1 @jit(arg_types=[numba.double], ret_type=numba.double)
2 def is_REALLY_five(some_value):
3 for i in range(5):
4... | TypeError |
def get_parfor_outputs(parfor, parfor_params):
"""get arrays that are written to inside the parfor and need to be passed
as parameters to gufunc.
"""
# FIXME: The following assumes the target of all SetItem are outputs,
# which is wrong!
last_label = max(parfor.loop_body.keys())
outputs = []... | def get_parfor_outputs(parfor):
"""get arrays that are written to inside the parfor and need to be passed
as parameters to gufunc.
"""
# FIXME: The following assumes the target of all SetItem are outputs, which is wrong!
last_label = max(parfor.loop_body.keys())
outputs = []
for blk in parfo... | https://github.com/numba/numba/issues/25 | ---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-15-3b23f7331ceb> in <module>()
----> 1 @jit(arg_types=[numba.double], ret_type=numba.double)
2 def is_REALLY_five(some_value):
3 for i in range(5):
4... | TypeError |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.