0

Is it allowed to pass objects instead of a pointer to the following directive

pragma acc host_data use_device(myobject)

here is the code , Pn is the object and Pn.P is the pointer to the array where data is stored

#pragma acc data pcopyin( rank,N )
{
#pragma acc host_data use_device( Pn )
    {


        cufftPlan1d( &plan, 1000 , CUFFT_Z2Z, 1 );

        cufftExecZ2Z( plan, (cufftDoubleComplex*)Pn.P, (cufftDoubleComplex *)Pn.P, CUFFT_FORWARD );

     
    }
}

runing gives Seg Fault

Community
  • 1
  • 1
JimBamFeng
  • 709
  • 1
  • 4
  • 20

2 Answers2

1

Try "host_data use_device( Pn.P )" so that "P"'s device address is used.

When you pass "Pn.P" as an argument, you're accessing "Pn" on the host to get the address of "P". Hence by putting "Pn" in the host_data region, the code is using the device address which in turn causes the segv.

Mat Colgrove
  • 5,441
  • 1
  • 10
  • 11
0

using version PGI 18.1 solves this issue

JimBamFeng
  • 709
  • 1
  • 4
  • 20