【发布时间】:2021-02-20 16:54:56
【问题描述】:
根据numba 0.51.2documentation,CUDA Python 支持多个math 函数。但是,它在以下核函数中不起作用:
@cuda.jit
def find_angle(angles):
i, j = cuda.grid(2)
if i < angles.shape[0] and j < angles.shape[1]:
angles[i][j] = math.atan2(j, i)
输出:
numba.core.errors.LoweringError: Failed in nopython mode pipeline (step: nopython mode backend)
No definition for lowering <built-in function atan2>(int64, int64) -> float64
我是不是用错了函数?
【问题讨论】:
-
好吧,
arctan2不在您链接的页面上支持的功能列表中。当我查看该页面时,您对支持的文字描述也不是我发现的。我没有看到支持“大多数”math功能,我看到提供了支持的功能列表。如果您在 SO 上查看numba标签,您会发现math用法的示例,例如here。 -
@RobertCrovella 我在调试
math和numpy错误的过程中写了这个问题,并让情况有点混乱。为了澄清这个问题,我将问题指向支持的math函数,特别是math.atan(y, x)。该链接提供了支持的功能。