Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

cuda kernel warning : expression has no effect

Tags:

cuda

I'm new to Cuda programming and trying my luck with Particle in Cell Code. But the first Problem is to build a particle mover. But when I'm trying to compile this code i get error messages like this:

error : expression must have integral or enum type / warning : expression has no effect.

My code:

__global__ void kernel(int* x, int* x_1, int* E_x, int* t, int* m)
{
    int idx = 0;
    if (idx < N)
        // move particles
        x_1[idx] = (E_x[idx] / m[1]) * t[1] * t[1] + x[idx];
}

kernel<<1,1>>( dev_x , dev_x_1, dev_E_x , dev_t, dev_m );

The integers defined as follows:

int x[N], x_1[N], v_x[N], v_y[N], v_z[N], E_x[N], m[1], t[1];
int *dev_x, *dev_v_x, *dev_x_1, *dev_v_y, *dev_v_z, *dev_E_x, *dev_m, *dev_t;
like image 752
suehprom Avatar asked Nov 25 '25 12:11

suehprom


1 Answers

One problem is you are using a double-chevron syntax instead of the proper triple-chevron syntax on your kernel launch parameters. Instead of this:

kernel<<1,1>>( dev_x , dev_x_1, dev_E_x , dev_t, dev_m );

Do this:

kernel<<<1,1>>>( dev_x , dev_x_1, dev_E_x , dev_t, dev_m );
like image 188
Robert Crovella Avatar answered Nov 27 '25 22:11

Robert Crovella



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!