3

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;
Drew Noakes
  • 300,895
  • 165
  • 679
  • 742
suehprom
  • 37
  • 1
  • 3

1 Answers1

4

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 );
Robert Crovella
  • 143,785
  • 11
  • 213
  • 257