Error "expression must have integral or enum type" in thats code:
__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;
}
}
the error happen in "z", in stretch:
c = c + z;
(i'm beginner in CUDA programming)
c is a pointer. Pointer arithmetic requires a pointer and an integer type expression.
If you want to to add z to the float pointed to by c you should change the expression to:
*c = *c + z;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With