declare target pragma

Discuss the OpenMP 4.0 API Specifications released July 2013 (Read Only)
Forum rules
The OpenMP Forums are now closed to new posts. Please visit Stack Overflow if you are in need of help: https://stackoverflow.com/questions/tagged/openmp
Locked
pierrick
Posts: 3
Joined: Wed Oct 23, 2013 4:17 am

declare target pragma

Post by pierrick »

Hi,

Reading openmp4 specification, I have some question about targets statement.

Here is an example extract from intel website http://software.intel.com/en-us/node/462954

Code: Select all

.#pragma omp target data map(to:a,b,c) map(from:e,f)
{
   #pragma omp target
   {
      e = f(a,b,c);
   }

   #pragma omp target
   {
      f = g(a,b,c);
   }
}
We can notice that we use f and g function on a target device but I don't know how to declare f and g function.
It looks like it is not a problem with MIC as icc may handle this problem but what about gpu? clang and gcc have to call nvcc/clcc or whatever?

I notice the declare target pragma but specification doesn't include a device clause.

Personnaly, I would expect a linkage statement to permit user to write their own function.
Something like

Code: Select all

#pragma omp target linkage(my_c_function:my_device_function) device(gpu0)
Or if we want to use the declare target statement

Code: Select all

#pragma omp declare target device(gpu)
my_c_function();
my_gpu_function();
#pragma omp end declare target
Except if we expect that we do

Code: Select all

#pragma omp declare target
my_c_function();
my_deviceX_function();
my_deviceY_function();
#pragma omp end declare target
and the compiler have to guess which function match with devices?

Does someone have more information about it?

Thanks
Pierrick

Locked