【发布时间】:2013-12-01 12:13:45
【问题描述】:
我是 Cuda 新手,我有以下功能:
__global__ void square(float *myArrayGPU)
{
myArrayGPU[threadIdx.x] = sqrt(threadIdx.x);
}
我想使用 cuda 数学库,我尝试#include "math.h" 但我仍然收到错误
error: calling a __host__ function("__sqrt") from a __global__ function("square") is not allowed
知道我应该包含什么库来使用sqrt吗?
【问题讨论】:
标签: c++ c math cuda square-root