Page 1 of 1

The declare target construct and Dynamic/Nested Parallelism

Posted: Mon Aug 03, 2015 4:18 am
by guraynet
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(){


 #pragma omp target teams distribute parallel for 

#pragma omp end declare target

int main(){


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?