I have a CPU code:
`if(number_of_pushed_particles<N&&number_of_alive_particles<K)
{
push_particle();
number_of_pushed_particles++;
}`
Here number_of_pushed_particles, number_of_alive_particles, K and N are int, K and N are const. The function push_particle() is:
`push_particle()
{
particles[LIFE].id=++MAX_ELEMENT;
particles[LIFE].rx=0.0;
particles[LIFE].ry=0.0;
particles[LIFE].rz=0.0;
...
++LIFE;
}
`Particle is a structure of floats.The array Particle particles[0:GL], integer variables LIFE and MAX_ELEMENT are statically allocated on the device. That is why i do not want to use #pragma acc update host/device before/after calling the push_particle() function and lose time for copying data. How can i launch this sequential code on the GPU?