This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Mapping pointers omp target data

Hello everyone, 

I'm running a simple program with openmpacc in offloading mode. So in my target code I've got something like this:

#pragma omp target data map(to:VARIABLE[0:size])

   {

     #pragma omp target

     { function(f1);}

   }

When VARIABLE is not a pointer it compiles and runs correctly but when It is a pointer, it compiles and when running I got the following error:

"ERROR: Variables accessed via a pointer in a target region must be shaped using array sections e.g. map(to:ptr[start:size]). This is an implementation restric

tion in the current runtime and will be fixed in a future release"

1) Is there a way to map pointers like that or it is not implemented yet? 

2) I also would like to know if the omp target update construct supported by TI OpenMP-acc is blocking or non-blocking? 

I'm using an EVMk2h board and ti-processor-sdk-linux-rt-k2hk-evm-03.01.00.06.

I appreciate your help

Thanks 

  • Hi Carlos,


    This is an open issue.  The workaround is to replicate the shaping of the array section on the target construct.

    #pragma omp target data map(to:VARIABLE[0:size])

    {

          #pragma omp target map(to:VARIABLE[0:size])

             { function(f1);}

          }

    }

    It won't map it twice.  The outer target data region will map it.  The map clause on the inner target region will find the mapped variable and use it.  The issue on having to repeat the map clause is related to how the compiler has to setup the pointer variable on the target device.

    Best Regards,

    Eric

  • Thank you very much Eric, It worked just like you said!