When programming with OpenACC recently, if I have a 3 * 1 matrix and a 1 * 4 matrix, I would like to use OpenACC for multiplication, but it seems that my usage is not very correct
cufftComplex a[3];
cufftComplex b[4];
a[0].x=1;
a[1].x=2;
a[2].x=3;
a[0].y=1;
a[1].y=2;
a[2].y=4;
b[0].x=3;
b[1].x=2;
b[2].x=3;
b[3].x=4;
b[0].y=4;
b[1].y=2;
b[2].y=3;
b[3].y=4;
cufftComplex c[3][4];
#pragma acc data copyin(a[0:3],b[0:4])\
copy(c[0:3][0:4])
{
#pragma acc loop
for(int i=0;i<3;i++)
for(int j=0;j<4;j++)
{
c[i][j]=a[i]*b[j];
}
}
Although it can run, it is obvious that his results are not correct. I think it is a problem with the introduction.The result is this
0+0j 0+0j 0+0j 0+0j
-1.41339e-21+0j 2.10704e+15+-3.14499e+19j 2.36943e-38+2.36943e-38j 0+0j
-1.46479e-21+0j 0+0j 8.26032e+11+2.38368e+11j 3.39615e+38+3.39615e+38j