0
numba.cuda.jit
、numba.jit
およびnone(pure python)から選択すると、デコレータのより良い動的制御を実現する最適な方法は何ですか? [プロジェクトには10または100の機能があることに注意してください。これはすべての機能に適用しやすいはずです。 はnumbaウェブサイトの例です。純粋なpythonの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)