numba

How to make numba @jit use all cpu cores (parallelize numba @jit)

微笑、不失礼 提交于 2019-12-30 00:56:07
问题 I am using numbas @jit decorator for adding two numpy arrays in python. The performance is so high if I use @jit compared with python . However it is not utilizing all CPU cores even if I pass in @numba.jit(nopython = True, parallel = True, nogil = True) . Is there any way to to make use of all CPU cores with numba @jit . Here is my code: import time import numpy as np import numba SIZE = 2147483648 * 6 a = np.full(SIZE, 1, dtype = np.int32) b = np.full(SIZE, 1, dtype = np.int32) c = np

Speeding up element-wise array multiplication in python

核能气质少年 提交于 2019-12-29 04:00:07
问题 I have been playing around with numba and numexpr trying to speed up a simple element-wise matrix multiplication. I have not been able to get better results, they both are basically (speedwise) equivalent to numpys multiply function. Has anyone had any luck in this area? Am I using numba and numexpr wrong (I'm quite new to this) or is this altogether a bad approach to try and speed this up. Here is a reproducible code, thank you in advanced: import numpy as np from numba import autojit import

Debugging Numba in MacOS

烂漫一生 提交于 2019-12-25 18:46:10
问题 The problem I get a segmentation error when using numba to run some simulations (Process finished with exit code 139 (interrupted by signal 11: SIGSEGV)). I am trying to follow the instructions on the numba docs (https://numba.pydata.org/numba-doc/dev/user/troubleshoot.html#example-debug-usage) but I cannot install GDB on my MacOS. GDB on MacOS I have followed the instructions on this site to install GDB on MacOS https://www.thomasvitale.com/how-to-setup-gdb-and-eclipse-to-debug-c-files-on

How to limit the number of registers used by each thread in Numba (CUDA)

霸气de小男生 提交于 2019-12-25 09:58:06
问题 as the title says I would like to know if there is a way to limit the number of registers used by each thread when I launch a kernel. I'm performing a lot of computation on each thread and so the number of registers used is too high and then the occupancy is low. I would like to try to reduce the number of registers used in order to try to improve parallel thread execution, maybe at the cost of more memory accesses. I searched for the answer but I didn't find a solution. I think that is

How to limit the number of registers used by each thread in Numba (CUDA)

拈花ヽ惹草 提交于 2019-12-25 09:56:15
问题 as the title says I would like to know if there is a way to limit the number of registers used by each thread when I launch a kernel. I'm performing a lot of computation on each thread and so the number of registers used is too high and then the occupancy is low. I would like to try to reduce the number of registers used in order to try to improve parallel thread execution, maybe at the cost of more memory accesses. I searched for the answer but I didn't find a solution. I think that is

Lowering error using pyDEM dem processor

送分小仙女□ 提交于 2019-12-25 08:01:28
问题 Executing this script in Spyder : import os from pydem.dem_processing import DEMProcessor filename__geotiff = 'D:\temp\CH_DTED_l0.tif' if os.path.exists(filename__geotiff): dem_proc = DEMProcessor(filename__geotiff) mag, aspect = dem_proc.calc_slopes_directions() Gets me the following error : Failed at object (object mode backend) slc0.8 File "........\Programs\Anaconda\lib\site-packages\pydem\dem_processing.py", line 2176 [1] During: lowering "$1309 = call $1308(ang_adj, dX, dY, data,

Numba environment variable not set through .numba_config.yaml [duplicate]

倾然丶 夕夏残阳落幕 提交于 2019-12-25 03:37:36
问题 This question already has answers here : How to access environment variable values? (10 answers) Closed 12 months ago . Some environment variables can be set for numba, as specified in the doc: https://numba.pydata.org/numba-doc/dev/reference/envvars.html However, launching a python shell in the same folder, I cannot see the variable in os.environ : In [1]: !cat .numba_config.yaml warnings: 1 In [2]: import os; os.environ["NUMBA_WARNINGS"] -----------------------------------------------------

How to operate on list generator using numba

女生的网名这么多〃 提交于 2019-12-25 02:23:17
问题 I'm trying to use a simple code that tries to use numba and list generator and I get an error executing the following code. @numba.jit(nopython=True, nogil=True) def perform_search(simple_list, number): gen = (ind for ind in xrange(len(simple_list)) if simple_list[ind] != number) return next(gen) x = [1,1,1,2,1,3] perform_search(x, 1) When I execute the above code I get a ValueError , however, when just use the decorator @numba.jit , I get a a LoweringError . Please help me to perform this

module 'numba.findlib' has no attribute 'get_lib_dir'

别来无恙 提交于 2019-12-24 12:34:12
问题 I'm trying to learn how to use pyculib and got AttributeError: module 'numba.findlib' has no attribute 'get_lib_dir' 4 core CPU (intel) + GeForce GTX 745 File "", line 1, in runfile('C:/Python/Scripts/LearnCUDA/curand.py', wdir='C:/Python/Scripts/LearnCUDA') File "C:\Users\Administrator\Anaconda3\lib\site-packages\spyder_kernels\customize\spydercustomize.py", line 786, in runfile execfile(filename, namespace) File "C:\Users\Administrator\Anaconda3\lib\site-packages\spyder_kernels\customize

CUDA API error on Python with Numba

旧巷老猫 提交于 2019-12-24 05:38:04
问题 I'm kind of new to numba and was trying to speed up my monte carlo method with it. Im currently working on Ubuntu 14.04 with GeForce 950M. The CUDA version is 8.0.61. When I try to run the following code I get some memory associated error from CUDA API Code: @cuda.jit def SIR(rng_states, y, particles, weight, beta, omega, gamma, greater, equal, phi, phi_sub): # thread/block index for accessing data tx = cuda.threadIdx.x # Thread id in a 1D block = particle index ty = cuda.blockIdx.x # Block