Numba 内核不允许字典或字符串函数
Numba kernel is not allowing dictionaries or string functions
我正在尝试将字典传递给 Numba CUDA 内核并在内核中执行各种字符串操作(例如 string.split()
)。这些都不起作用。
我使用的是 numba 版本 0.44.1。根据发行说明 (https://numba.pydata.org/numba-doc/dev/release-notes.html),Numba 支持字典和 string.split(),所以我不确定为什么两者都不起作用。
词典代码:
from numba import cuda
aDict = {'potato':7,'Achashveirosh':127,'GzeiraShava':613,'KimLeiBidiRabbaMinei':4}
@cuda.jit
def kernel_thing(chashuvDict):
print(chashuvDict['GzeiraShava'])
kernel_thing[128,30](aDict)
string.split() 的代码:
from numba import cuda
@cuda.jit
def kernel2():
eggs = "hello"
eggs.split('e')
kernel2[128,30]()
对于字典,我收到以下错误:
line 34, in typeof
raise ValueError(msg)
ValueError: cannot determine Numba type of < class 'dict'>
对于string.split()
,我也得到一个错误:
No definition for lowering (unicode_type, unicode_type, omitted(default=-1)) -> list(unicode_type)
File "testKernel2.py", line 6:
eggs.split('e')
I am trying to pass a dictionary to a Numba CUDA kernel as well as perform various string manipulations in the kernel (such as string.split()). Neither of these are working.
它们不起作用,因为 Numba GPU 内核不支持字符串和字典(参见 here)
我正在尝试将字典传递给 Numba CUDA 内核并在内核中执行各种字符串操作(例如 string.split()
)。这些都不起作用。
我使用的是 numba 版本 0.44.1。根据发行说明 (https://numba.pydata.org/numba-doc/dev/release-notes.html),Numba 支持字典和 string.split(),所以我不确定为什么两者都不起作用。
词典代码:
from numba import cuda
aDict = {'potato':7,'Achashveirosh':127,'GzeiraShava':613,'KimLeiBidiRabbaMinei':4}
@cuda.jit
def kernel_thing(chashuvDict):
print(chashuvDict['GzeiraShava'])
kernel_thing[128,30](aDict)
string.split() 的代码:
from numba import cuda
@cuda.jit
def kernel2():
eggs = "hello"
eggs.split('e')
kernel2[128,30]()
对于字典,我收到以下错误:
line 34, in typeof raise ValueError(msg)
ValueError: cannot determine Numba type of < class 'dict'>
对于string.split()
,我也得到一个错误:
No definition for lowering (unicode_type, unicode_type, omitted(default=-1)) -> list(unicode_type)
File "testKernel2.py", line 6:
eggs.split('e')
I am trying to pass a dictionary to a Numba CUDA kernel as well as perform various string manipulations in the kernel (such as string.split()). Neither of these are working.
它们不起作用,因为 Numba GPU 内核不支持字符串和字典(参见 here)