0
numba.cuda.jit
, numba.jit
및 none (순수한 python) 중에서 선택하는 데있어 가장 좋은 방법은 무엇입니까? [프로젝트에는 10 또는 100 개의 기능이 있으므로 모든 기능에 적용하기 쉽습니다.] 여기은 numba 웹 사이트의 예제입니다.순수 파이썬 numba.jit 및 numba.cuda.jit에서 동적으로/조건 적으로 선택
import numba as nb
import numpy as np
# global control of this --> @nb.jit or @nb.cuda.jit or none
# some functions with @nb.jit or cuda.jit with kwargs like (nopython=True, **other_kwargs)
def sum2d(arr):
M, N = arr.shape
result = 0.0
for i in range(M):
for j in range(N):
result += arr[i,j]
return result
a = np.arange(81).reshape(9,9)
sum2d(a)