const long int G=100000;
const unsigned int GL=100000;
const long int K=G;
const int LE=1.0f;
struct Particle
{
float x;
float rs;
};
Particle particles[GL];
int sort[GL];
int ind01[GL];
long int MAX_ELEMENT=1;
int POSITION1;
int POSITION0;
int LIFE=0;
bool start=true;
int mini;
int count0;
int count1;
int GL1;
int js;
Here i fill in:
particles[LIFE].x=5.0;
the array “particles” allocated on the gpu. Bu the prints give the output that particles[0].x=0although LIFE=1 after this operation.
How to fill in the array properly?
Why the #pragma acc update(LIFE) async does not work without async?
i try to launch a serial code on the gpu like this #pragma acc parallel num_gangs(1) vector_length(1)
{
POSITION0=GL1-count0;
POSITION1=count1;
count0=0;
count1=0;
LIFE-=POSITION0;
LIFE+=POSITION1;
}
Is it correct?
My task is to make all the opeartions except for output prints on the gpu(put all the variablesa nd arrays in the device_resident clause). If you have any advice how to fulfill it better, please, tell me._
The formatting of code is a bit off and is incomplete so I can’t run your code, but one problem I see is that you’re missing “parallel” for the “loop” directive on the POSITION1 loop. “loop” directives must be contained within a compute directive or combined.
Also, I don’t see where you’ve updated the host copy of “particles”. Without an update, the values you print will be what ever host copy happens to contain.
Why the #pragma acc update(LIFE) async does not work without async?
Using async shouldn’t matter here. Something else is causing your error.
i try to launch a serial code on the gpu like this
Yes, this is the current method to create a serial compute region. The OpenACC 2.6 standard which was just ratified will introduce a “serial” region. PGI will add this sometime in the near future.
My task is to make all the opeartions except for output prints on the gpu(put all the variablesa nd arrays in the device_resident clause). If you have any advice how to fulfill it better, please, tell me.
Can you post or send the complete code to PGI Customer Service (trs@pgroup.com) and ask them to forward it to me? Other that some minor errors, I think you’re on the right track, but without a complete example it’s difficult for me to tell if there are other issues. Having a reproducing example will help.