Questions tagged [numba]

Numba is an open source NumPy-aware optimizing compiler for Python.

Numba is an Open Source NumPy-aware optimizing compiler for Python sponsored by Continuum Analytics, Inc. It uses the remarkable 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.

Source: README.rst of the Numba project (GitHub).

More informations about the package can be found on the Numba homepage and documentation.

2244 questions
0
votes
0 answers

Numba Typed Dict: Specify default value

I am currently trying to use numba to speed up a calculation for me where a TypedDict stores either 1 tuple w/ 2 float64 or array w/ 2 float64. At some point, I look up in the typedDict to see if a key exists - if it does not, I have it return the…
Deftness
  • 265
  • 1
  • 4
  • 21
0
votes
0 answers

Numba how to initialize a decorator properly

Context: I have a large 3D array input_array (size: 1000 x 100 x 50) for which I want to do an operation on specific pixels (their indices are gathered in array idx_valid). Everytime I do an operation on one of the pixels, I grab the output and put…
Nihilum
  • 549
  • 3
  • 11
0
votes
1 answer

ModuleNotFoundError: No module named 'numba.decorators'

While importing librosa, I am facing this error, even after installing numba distinctively. Can anyone solve this error quickly??? I have tried uninstalling librosa and then reinstalling it again 5 times. Also tried installing numba but it just…
y_soul
  • 1
0
votes
1 answer

Use numba with dask dataframe

I have a dataframe that contains a string and 3 other columns that are numpy arrays, and I do the following: def calculate_hash_chunk(chunk, modalities): num_modalities = len(modalities) def _calculate_hash(chunk): if…
Norhther
  • 545
  • 3
  • 15
  • 35
0
votes
0 answers

How to install Numba

I have trouble installing Numba. from numba import jit, cuda I have anaconda I installed Numba doing conda install numba and i get the following error [Running] python -u…
Eric Velez
  • 11
  • 2
0
votes
1 answer

Lookup data structures for usage in numba?

I would like to use Just-In-Time-Compiling with numba of a Python function, however my code contains a too complex dictionary for that. Its key data type is int, and its values are lists of int with different lengths. I have a network graph with…
cakelover
  • 177
  • 5
0
votes
0 answers

Running multiple Numba (Python)

Anyone has an idea on how to run multiple .py files with the jit decorator? i.e. call the function with numba (also cache == True), but with different input values. Is it possible to use YAWL (Yet Another Workload)? Many thanks !
0
votes
1 answer

pandas rolling window parallelize problem while using numba engine

I have huge dataframe and I need to calculate slope using rolling windows in pandas. The code below works fine but looks like numba is not able to parallelize it. Any other way to parallelize it or make it more efficient? def slope(x): length =…
learner
  • 2,582
  • 9
  • 43
  • 54
0
votes
0 answers

Create a fast rolling sum over a 2D array with different windows per item

I need to compute the rolling sum on a 2D array with different windows for each element. (The sum can also go forward or backward.) I made a function, but it is too slow (I need to call it hundreds or even thousands of times). Here is my current…
Nicolas
  • 392
  • 5
  • 14
0
votes
1 answer

String Manipulation in Numba Cuda: Clip first k characters from a string array, k comes from another array

We have two arrays arr1 (which has string elements) and arr2 (which has integers). I want to clip first arr2[i] characters from arr[i]. These arrays are very large and so I want to implement this in Numba cuda. Pythonic implementation is as…
lasso45
  • 1
  • 1
0
votes
0 answers

Numba compiler fails with np.sum?

I have a function that I want to accelerate using Numba (it computes the log-likelihood sum of residual given cov-var matrices, just for the context but this is not important for the question) @jit(nopython=True) def log_ll_norm_multivar(sigma,…
Jerem Lachkar
  • 1,008
  • 11
  • 24
0
votes
1 answer

Can numba use long doubles?

In numpy float128 is typically a long double (not a 128 bit float). But I can’t tell if numba has support for this. The docs don’t seem to mention long doubles or the numpy type float128.
Simd
  • 19,447
  • 42
  • 136
  • 271
0
votes
1 answer

Trying to clear GPU memory and reuse the GPU (torch and numba)

I noticed a memory leak in torch, but couldn't solve it, so I decided to try and force clear video card memory with numba. I've tried different memory cleanup options with numba, such as: from numba import…
KlayMen TV
  • 11
  • 4
0
votes
0 answers

Parallel sorting a dictionary and returning the first k items

One approach to returning the first k items of a sorted dictionary is shown in the code snippet below: dict(sorted(dictionary.items(), key=lambda item: item[1], reverse=True)[:k]) Therefore, is there a more efficient approach (for instance, using…
Celso França
  • 653
  • 8
  • 31
0
votes
0 answers

Spleeter and BeatNet incompatible numpy/numba libraries, any solutions?

I want to use two Python libraries, but they seem to be incompatible due to conflicting Numba requirements. I have found a workaround, but it's quite convoluted. I'm currently working in Google's Colab environment, but I don't think this is related…
user3735204
  • 81
  • 1
  • 8