在该代码中出现错误"表达式必须具有整数或枚举类型":
__global__ void VectorKernel(float *a, float *b, float *c, int n)
{
int i = threadIdx.x;
float y = 0, z = 0;
if (i < n)
y = (b-a) / n;
for (float j = y; j <= n ; j++) {
z = (((j+y) - j) / 6) * function(j) + 4 * (function((j + (y+j)) / 2)) + function(y+j);
c = c + z;
}
}
Run Code Online (Sandbox Code Playgroud)
在"z"中发生错误,在拉伸中:
c = c + z;
Run Code Online (Sandbox Code Playgroud)
(我是CUDA编程的初学者)
cuda ×1