2,433 questions
1 vote
0 answers
48 views
python numba calling problems
I was writing code for the simulation of the fluid dynamics of a layer of water. It has a function of solid_liquid_layer_angular_velocity_change: def solid_liquid_layer_angular_velocity_change( ...
3 votes
1 answer
138 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 ...
5 votes
2 answers
270 views
Why is Numba more efficient with 2D vs 1D version of this loop?
I'm using Python 3.12.11 with Numba 0.61.2 on Ubuntu 22.04.5 and AMD Ryzen 7 3800X CPU. This benchmark: import numpy as np, timeit as ti, numba as nb @nb.njit(fastmath=True) def f1d(img, w): fl = ...
0 votes
1 answer
146 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
172 views
How to efficiently wrap GSL functions with structs and pointers using Numba?
I'm trying to wrap some GSL (GNU Scientific Library) functions using Numba. I'd like to avoid C glue code wrappers and to be able to cache and extend the wrapped functions. Here’s a simplified ...
1 vote
1 answer
131 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
0 answers
104 views
Disable Numpy parallelization inside Numba JIT
The problem is illustrated by the following script, which works correctly if MKL is used for linear algebra operations: from numba import njit, prange from numpy import random, dot, empty from ...
2 votes
1 answer
195 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) ...
0 votes
0 answers
90 views
Filter data into binary classes on GPU
I have a ML problem where I want to leverage the power of Support Vector Classifiers (SVC) or any other 2-class classifier and compare them to my NN models. The probelm is, that binary classifiers are ...
4 votes
0 answers
238 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 ...
1 vote
1 answer
76 views
numba.njit signature for a list of jitclass objects
I am trying to pass a list of jitclass objects to a jitted function, but I've been unable to find a suitable type signature for njit. I don't understand well how Numba thinks, so I would really ...
0 votes
0 answers
118 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 ...
2 votes
2 answers
102 views
Polars and Mixed Type guvectorize Numba Function
I am attempting to write a fast numba guvectorized function to use with in Polars (see here). I've simplified things down to examples below. Immediately below is an example that works fine: import ...
3 votes
2 answers
166 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 ...
2 votes
1 answer
118 views
Why do these nearly identical functions perform very differently?
I have written four functions that modify a square 2D array in place, it reflects half of the square array delimited by two sides that meet and the corresponding 45 degree diagonal, to the other half ...