Reputation: 1
NVC++-W-1056-External variables used in acc routine need to be in #pragma acc create() - i (sim_xy1.c: 1012)
NVC++-W-1056-External variables used in acc routine need to be in #pragma acc create() - i (sim_xy1.c: 1010)
NVC++-W-1056-External variables used in acc routine need to be in #pragma acc create() - j (sim_xy1.c: 1002)
NVC++-W-1056-External variables used in acc routine need to be in #pragma acc create() - j (sim_xy1.c: 994)
NVC++-W-1056-External variables used in acc routine need to be in #pragma acc create() - i (sim_xy1.c: 986)
NVC++-W-1056-External variables used in acc routine need to be in #pragma acc create() - i (sim_xy1.c: 984)
I tried to bold or marked with ** ** in the code the location of the line corresponding to the error
void produto_matriz_vetor(int NX, int NY,double *AN,double *AW,double *AP,double *AE,double *AS, double *x, double *b)
{
int N,aux,NXY;
NXY=NX*NY;
N=1;
b[N]=(AP[N]*x[N])+(AE[N]*x[N+1])+(AS[N]*x[N+NX]);
N=NX;
b[N]=(AW[N]*x[N-1])+(AP[N]*x[N])+(AS[N]*x[N+NX]);
N=NXY-NX+1;
b[N]=(AN[N]*x[N-NX])+(AP[N]*x[N])+(AE[N]*x[N+1]);
N=NXY;
b[N]=(AN[N]*x[N-NX])+(AW[N]*x[N-1])+(AP[N]*x[N]);
for(N=2;N<NX;N++)
{
b[N]=(AP[N]*x[N])+AE[N]*x[N+1]+AS[N]*x[N+NX]+AW[N]*x[N-1];
}
**for(i=2;i<NX;i++)**
{
**N=NXY-NX+i;**
b[N]=(AN[N]*x[N-NX])+(AW[N]*x[N-1])+(AP[N]*x[N])+(AE[N]*x[N+1]);
}
for(j=2;j<NY;j++)
{
**N=(NX*(j-1))+1;**
b[N]=(AN[N]*x[N-NX])+(AP[N]*x[N])+(AE[N]*x[N+1])+(AS[N]*x[N+NX]);
}
for(j=2;j<NY;j++)
{
**N=(NX*(j-1))+NX;**
b[N]=(AN[N]*x[N-NX])+(AW[N]*x[N-1])+(AP[N]*x[N])+(AS[N]*x[N+NX]);
}
for(j=2;j<NY;j++)
{
**for(i=2;i<NX;i++)**
{
**N=(NX*(j-1))+i;**
b[N]=(AN[N]*x[N-NX])+(AW[N]*x[N-1])+(AP[N]*x[N])+(AE[N]*x[N+1])+(AS[N]*x[N+NX]);
}
}
}
Upvotes: 0
Views: 321
Reputation: 5646
Yes, static global variables need to be placed in a "acc declare create" directive so a device copy of the global variable can be accessed from the device routine.
However here, using a global variable as your index variable is going to cause issues since all threads would be using the same variables. The better solution would be to use local variables for the index variables so they can be made private for each thread.
Upvotes: 1