PGI User Forum
 SearchSearch   MemberlistMemberlist     RegisterRegister   ProfileProfile    Log inLog in 

CUDA-x86.

openmp nested parallelism

 
Post new topic   Reply to topic    PGI User Forum Forum Index -> Accelerator Programming
View previous topic :: View next topic  
Author Message
Teslalady



Joined: 16 Mar 2012
Posts: 75

PostPosted: Thu Jun 28, 2012 9:15 am    Post subject: openmp nested parallelism Reply with quote

Hi, I tried to use openmp nested parallelism feature in my PGI accelerator complier 12.5, but failed.
I set Environment variables OMP_NESTED and OMP_MAX_ACTIVE_LEVELS
,but still failed.

My code is as attached :



Code:
program hello
use omp_lib
implicit none
integer :: i

!print *,"omp nested",omp_get_nested()
call omp_set_nested(.true.)
print *,"omp nested",omp_get_nested()
!$omp parallel num_threads(2) default(private)
i = omp_get_thread_num()
if (i.eq.0) then
print *,"hello"
print *,"thread num is ",omp_get_thread_num()
print *,"level is ",omp_get_level()
end if

if (i.eq.1) then
!$omp parallel num_threads(2)
print *,"world"
print *,"thread num is ",omp_get_thread_num()
print *,"level is ",omp_get_level()
!$omp end parallel
end if
if(i.eq.1) then
print *,"thread num is ",omp_get_thread_num()
print *,"level is ",omp_get_level()
end if
!$omp end parallel
end program hello

My running result is as below
[ldl@ln0%lab PGI_125]$ a.out
omp nested F
hello
thread num is 0
level is 1
world
thread num is 0
level is 2
thread num is 1
level is 1

You can see that the output "World" is lever 2,which wasn't Parallelized.and I have set set_nested to true,but I get fales.

But if I use ifort to compile the coda as :
$ ifort hello.f90 -openmp

the running result is as below:
Code:
[ldl@ln0%lab PGI_125]$ a.out
omp nested T
hello
thread num is 0
level is 1
world
thread num is 0
level is 2
world
thread num is 1
level is 2
thread num is 1
level is 1

you will see that set_nested was true and the level 2 was Parallelized.

Can you give me advices?
Back to top
View user's profile
toepfer



Joined: 04 Dec 2007
Posts: 50

PostPosted: Thu Jun 28, 2012 4:51 pm    Post subject: Reply with quote

Currently we only support nested OpenMP parallelism by setting the environment variables:

Code:
OMP_NESTED=TRUE
OMP_MAX_ACTIVE_LEVELS=<n>


While we do allow the runtime calls, they are basically nops at this point.

One other requirement is that we only support orphaned nested parallelism. In the example that you show, the nested parallel region is in the lexical scope of the outer parallel region, and thus we do not honor the nested parallel region.
Back to top
View user's profile
Display posts from previous:   
Post new topic   Reply to topic    PGI User Forum Forum Index -> Accelerator Programming All times are GMT - 7 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © phpBB Group