2,432 questions
3
votes
1
answer
134
views
Numba CUDA code crashing due to unknown error, fixed with the addition of blank print statement in any thread
I'm writing some Hamiltonian evolution code that relies heavily on matrix multiplication, so I've been trying to learn about developing for a GPU using python.
However, when I run these lines of code ...
0
votes
1
answer
138
views
Numba cfunc factory with numpy arrays
I want to have a factory method that calls a cfunc using numpy arrays. I am trying to pass the numpy arrays by using a ctype pointer.
Since my original code is rather complicated I have made a simple ...
1
vote
1
answer
130
views
Why does keyword argument 'weights' not work when calling NumPy histogram in Numba?
This Python 3.13.5 script with numpy 2.2.6 and numba 0.61.2:
import numpy as np, numba as nb
@nb.njit(fastmath=True)
def f(a, b):
return np.histogram(a, 10, weights=b)
a = np.random.randint(0, 256,...
2
votes
1
answer
194
views
What is the reason of this performance discrepancy between NumPy and Numba?
This Python 3.12.7 script with NumPy 2.2.4 and Numba 0.61.2:
import numpy as np, timeit as ti, numba as nb
def f0(a):
p0 = a[:-2]
p1 = a[1:-1]
p2 = a[2:]
return (p0 < p1) & (p1 > p2)
...
4
votes
0
answers
232
views
Finetuning NeMo parakeet in google colab results CUDA_ERROR_UNSUPPORTED_PTX_VERSION
Aim:
I want to finetune parakeet v2 model to a different dataset. I picked LJ dataset just to make myself familiar with the finetuning process.
For doing this I ran the following notebook
This works ...
0
votes
0
answers
116
views
How can I use %%scalene in Jupyter Notebook on GitHub Codespaces?
I'm trying to use the %%scalene cell magic in a Jupyter Notebook running on GitHub Codespaces to profile a Numba-accelerated implementation of the Mandelbrot set. However, when I run the following ...
3
votes
2
answers
163
views
how to force numba to return a numpy type?
I find this behavior quite counter-intuitive although I suppose there is a reason for it - numba automatically converts my numpy integer types directly into a python int:
import numba as nb
import ...
3
votes
1
answer
279
views
Why does this fast function with Numba JIT slow down if I JIT compile another function?
So I have this function:
import numpy as np
import numba as nb
@nb.njit(cache=True, parallel=True, nogil=True)
def triangle_half_UR_LL(size: int, swap: bool = False) -> tuple[np.ndarray, np.ndarray]...
1
vote
0
answers
130
views
Howto efficiently apply a gufunc to a 2D region of a Polars DataFrame
Both Polars and Numba are fantastic libraries that complement each other pretty well. There are some limitations when using Numba-compiled functions in Polars:
Arrow columns must be converted to ...
3
votes
1
answer
198
views
Fastest way to search 5k rows inside of 100m row pair-wise dataframe
I am not sure title is well describing the problem but I will explain it step by step.
I have a correlation matrix of genes (10k x 10k)
I convert this correlation matrix to pairwise dataframe (upper ...
0
votes
1
answer
175
views
How to use Numba Cuda without Conda?
I don't use Conda. I have downloaded and installed cuda_12.8.1_572.61_windows.exe from the official link. I have installed numba 0.61.0, numba-cuda 0.8.0, llvmlite 0.44.0, numpy 2.1.3, cuda-python 12....
4
votes
0
answers
96
views
How to wrap NumPy functions in Numba-jitted code with persistent disk caching?
Numba reimplements many NumPy functions in pure Python and uses LLVM to compile them, resulting in generally efficient performance. However, some Numba implementations show slower performance compared ...
0
votes
0
answers
90
views
Numba jitclass instance array element cannot be changed based on later code
I have a numba jitclass with an instance attribute that is a 1d-array of floats, initialized to be zeros (in the MRE as [0.,0.]).
I have a jitted function that creates an instance of said class and ...
0
votes
0
answers
97
views
Numba np.linalg.eigvalsh exception raised inconsistenlty
I'm using numba to compile some expensive calcualtion for signifcant performance gains - this is wonderful! Recently I made a small change to the calcualtion to extract some additional values (...
0
votes
1
answer
66
views
Numba namedtuple & ListType weird Question
I get a weird problem against numba with namedtuple & ListType.
I defined 2 namedtuple as below. These 2 are similar. But one works well other one not work.
import numba as nb
from numba....
0
votes
0
answers
71
views
Cython GroupBy Function much slower then similar Numba Function
I have a very basic group by function that I want to use in a Cython object but it's something like 400 times slower than a similar function in Python JITed by Numba
This is my Cython function
@cython....
-1
votes
1
answer
60
views
In a numba function, replace cuda.popc() by CPU equivalent if not in CUDA
I am writing common code that supports both numba-jitting on CPU and numba.cuda-jitting on GPU.
It all works well, except that deep inside the common code, I would like to use an intrinsic instruction ...
0
votes
0
answers
34
views
How to fix time.process_time() not working when wrapped around a function run with Numba jit, with parallelisation=True
I have a function that has a numba @njit wrapper around it to make it faster, I've set parallel=True to make it run faster. And now want to measure the time it takes, using time.process_time(), ...
0
votes
0
answers
47
views
Numba, Neat, Numpy error: RuntimeError: Call parameter type does not match function signature
I am using numba with neat-python and numpy. Somehow I get the error:
RuntimeError: Call parameter type does not match function signature!
It was working well before. I have included relevant code ...
1
vote
1
answer
172
views
Is it possible to speed up my set implementation?
I am trying to make a fast and space efficient set implementation for 64 bit unsigned ints. I don't want to use set() as that converts everything into Python ints that use much more space than 8 ...
0
votes
1
answer
302
views
How to fix numba-scipy to work with scipy.special
I am trying to write a simulation that involves very large matrix multiplications and for loops. To speed up the process, I thought about using numba-scipy. After installing the package with conda, I ...
0
votes
1
answer
123
views
Numba AOT using setuptools compiles .pyd, import pyd causes recompilation. Why?
I have some code, generic numba. I'm attempting to compile it with setuptools, which I've done successfully before on this computer, in this environment, but lost my setup.py file. Code to compile ...
0
votes
1
answer
92
views
Calling Numba cfunc from njitted function with numpy array argument
I'm trying to call a cfunction inside njitted function, but Numba does not have data_as() method for its array to cast double pointer. Could anyone help me figure out how to make it work?
import ...
1
vote
0
answers
131
views
multiprocessing and shared memory
I am trying to get the basics of multiprocessing in python. I have a quite complex routine that takes a large array (c.a 1Gb) and a double as inputs and returns a double. The large array is not going ...
1
vote
1
answer
230
views
Numba cuda.jit and njit giving different results
In the following example, I have a simple CPU function:
import numpy as np
from numba import njit, cuda
@njit
def cpu_func(a, b, c, d):
for i in range(len(a)):
for l in range(d[i], 0, -1):...