I’m trying to initialize an “empty” array with each elements containing t_list a 8×8 np.zeros array : t_list = np.zeros((8,8), dtype=np.float32) I would now want to have a np.array with multiple t_list at each indexes: result = np.array((t_list, t_list, …., tlist)) I would like to be able to control the number of time t_list is in result. I know that
Tag: numba
Why does this code fail to compile with Numba?
I have a sample code that illustrates my issue. If you run: It will fail with: argsort is supposed to argsort on the last axis. Essentially it should give me: I thought copying the arr2 array (with copy()) could solve as it would make the array contiguous in memory (instead of a view), but it fails with the same message
(JIT) Compilation of Python code with FFI library calls
I’m using Python with a library that uses cppyy to get access to a ton of C++ functions natively in Python. However, the calls to cppyy methods take a lot of time, and looping in Python with a library call means that overhead becomes a serious issue. Here’s an example of what I mean: This code would be really fast
Find minimum difference between two vectors with numba
I’ve tried to optimize searching for minimum value between two numpy vectors with numba. There is speed up and result is correct until I use prange and parallel=True option. I understand that the issue is in sharing variables min_val, tmp, min_val_idx_a, min_val_idx_b during parallel execution (maybe with parallel threads). Is there way to overcome the problem and use numba in
Is there a better way to use cython when looking to speed up Python?
I have a large numpy array with the following structure: I’m using cython to try and speed up the processing as much as possible. The argument dataset in the code below is the above array. However, when running the above code with and without cython I get the following times: without cython: 0:00:00.945872 with cython: 0:00:00.561925 Any ideas how I
Using typed dictionaries in ahead of time compilation in numba
I’m trying to use ahead of time compilation in numba on a function that takes a numba typed dictionary as its input. The file compiles without errors, but when I load the resulting module I get an error: An example function that produces the same error is: This function will be called by another function in the compiled code. Answer
Floyd-Warshall algorithm on GPU using numba
I’m writing optimised Floyd-Warshall algorithm on GPU using numba. I need it to work in a few seconds in case of 10k matricies. Right now the processing is done in around 60s. Here is my code: To be honest I’m pretty new to writing scripts on GPU, so do you have any ideas how to make this code even faster?
List of binary numbers: How many positions have a one and zero
I have a list of integers, e.g. i=[1,7,3,1,5] which I first transform to a list of the respective binary representations of length L, e.g. b=[“001″,”111″,”011″,”001″,”101”] with L=3. Now I want to compute at how many of the L positions in the binary representation there is a 1 as well as a zero 0. In my example the result would be
Numba cannot determine fingerprint of empty list even with signature
I am using the @jit signature to define the types of the incoming arguments. But in calling the function I get: I know the list is empty, but my signature defines it so am not sure why Numba does not use that signature. I have tried the different forms of signatures (string form and the tuple form) and it still
Python square brackets between function name and arguments: func[…](…)
I was learning how to accelerate python computations on GPU from this notebook, where one line confuses me: Here, mandel_kernel is a decorated (by cuda.jit) function, griddim and blockdim are tuples of length 2: griddim=(32,16), blockdim=(32,8). Is this square brackets in between function name and argument list part of python syntax, or something specific to the cuda.jit decoration? Answer This