The declare target construct and Dynamic/Nested Parallelism

Discuss the OpenMP 4.0 API Specifications released July 2013 (Read Only)

The declare target construct and Dynamic/Nested Parallelism

Postby guraynet » Mon Aug 03, 2015 4:18 am

I've question is related with declare target construct of OpenMP and dynamic/nested parallelism feature of GPUs. OpenACC 2.0 supports dynamic parallelism in two ways; routine directive and using parallel/kernels directives in nested way. But using nested device directives such as target, teams or distribute is prohibited in OpenMP. But declare target directive seems to me similar with routine directive of openacc.

However it's not still clear semantic and its usage. My sample code is like this.

Code: Select all
#pragma omp declare target
void foo(){

  //work-1

#pragma omp target teams distribute parallel for
for(...)
{
    if(...){
       foo();
    {
      //work-2
    }
}

//work-3
}
#pragma omp end declare target

int main(){
//work

foo();

}


In that example, I am expecting that function foo will be mapped as device function. but since it has target construct inside, compiler will transform this code in some way. My question is here, what will happen when the threads encounters foo function invocation inside of target construct?
guraynet
 
Posts: 2
Joined: Thu Nov 07, 2013 6:42 am

Return to OpenMP 4.0 API Specifications

Who is online

Users browsing this forum: No registered users and 1 guest