") from a __global__ function("judgeIsTouche...">

CUDA编程出现calling a __host__ function("sqrt ") from a __global__ function("judgeIsTouche...

Error calling a __host__ function("sqrt ") from a __global__ function("judgeIsTouched") is not allowed cuda07 E:\program\cplus\cuda07\cuda07\kernel.cu   255 

错误的代码如下

float distanceM = std::sqrt(2)*LENGTH;

做出如下更改

float distanceM = std::sqrt(2.0)*LENGTH;

即可消去错误。

CUDA好像不支持模板函数
StackOverflow有类似的错误

编程中遇到的,记录一下。

你可能感兴趣的:(CUDA编程出现calling a __host__ function("sqrt ") from a __global__ function("judgeIsTouche...)