CUDA编程出现错误

Error calling a __host__ function("sqrt<int, void> ") 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有类似的错误

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

猜你喜欢

转载自blog.csdn.net/u014683187/article/details/89302216