使用target =“ cuda”运行numba时出现断言错误

时间:2019-01-30 11:01:45

标签: python numba

我尝试使用cuda运行以下代码。它可以与target ='cpu'和target ='parallel'一起使用,但给与target ='cuda'错误并提供错误

我已经在终端上运行了numba -s,它显示一切都很好。

@vectorize([float64(float64), float32(float32)], target='cuda', nopython=True)
def closestDist(rij):
    global gridsize
    if (rij > gridsize / 2):
        rij -= gridsize
    elif (rij < -gridsize / 2):
        rij += gridsize
    return rij

这是我遇到的错误

AssertionError                            Traceback (most recent call last)
<ipython-input-3-85ebdde41444> in <module>
      1 #helper function to calculate closest manhattan distance between two particles in line with PBC
----> 2 @vectorize([float64(float64), float32(float32)], target='cuda', nopython=True)
      3 def closestDist(rij):
      4     global gridsize
      5     if (rij > gridsize / 2):

~/.local/lib/python3.6/site-packages/numba/npyufunc/decorators.py in wrap(func)
    116 
    117     def wrap(func):
--> 118         vec = Vectorize(func, **kws)
    119         for sig in ftylist:
    120             vec.add(sig)

~/.local/lib/python3.6/site-packages/numba/npyufunc/decorators.py in __new__(cls, func, **kws)
     36         cache = cls.get_cache(kws)
     37         imp = cls.get_target_implementation(kws)
---> 38         return imp(func, identity=identity, cache=cache, targetoptions=kws)
     39 
     40 

~/.local/lib/python3.6/site-packages/numba/npyufunc/deviceufunc.py in __init__(self, func, identity, cache, targetoptions)
    364         if cache:
    365             raise TypeError("caching is not supported")
--> 366         assert not targetoptions
    367         self.py_func = func
    368         self.identity = parse_identity(identity)

AssertionError: 

0 个答案:

没有答案
相关问题