SoA by reference

Hi,

I created a SoA in my code.

but when I pass this one by reference, it does not work with pgcc.

typedef struct Coordinates coordinate;


struct Coordinates
{
long double *x;
long double *y;
long double *z;
int n;
};


int main (int argc, char *argv)
{


coordinate r;

ccoordinate(&r);


}


void ccoordinate(coordinate * c)
{
int n;
n=(*c).n;

#pragma acc kernels

for (unsigned int i=0; i < n; i++) {
(*c).x_=0.00;
(*c).y=0.00;
(*c).z=0.00;
}
}

I have these errors

Accelerator restriction: unsupported operation: X87CON
PGC/x86-64 Linux 17.10-0: compilation completed with severe errors

I cannot find what the mistake are.

Thanks in advance for your help._

Hi azzulrd,

The problem here is the “long double”. GPUs don’t support 80-bit precision so “long double” can’t be used in device code. Changing the struct variables to be “double” will work around the problem.

I’ve added TPR#25392 to have our engineers investigate what’s the best solution here. It may be possible to demote long double to 64-bits on the device, but this would give you divergent answers between host and device code. Though, we should at least be giving a better error message.

Best Regards,
Mat