- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I have a question about using Ordered directive.
Since we use NCPU (number of CPUs) from inputin our program, we have no problem in the following:
!$OMP parallel do if(NCPU>1) num_threads(NCPU)
......
For another section in our program, we also have no problem with the following:
!$OMP do ordered
....
!$OMP ordered
...
!$OMP end ordered
However, we have the compiler errorif we add cluase if(NCPU>1) num_threads(NCPU) to the above:
!$OMP do ordered if(NCPU>1) num_threads(NCPU)
....
!$OMP ordered
...
!$OMP end ordered
The syntax erroris 'Syntax error, found 'IF' when expecting one of : PRIVATE, FIRSTPRIVATE.....'
What directive should I use if the number of threads will be specified in the code inputs? What's the correct way of specify this? Also I can not use Default(private) directive. Since most of variables inside this ordered section are private, what's the best way to specify these variables?
Thanks, Maria
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
move "if(NCPU>1)" to the right most position on the !$OMP line
.and. add "if(NCPU>1)" to the !$OMP ordered (and !$OMP end ordered).
Jim Dempsey

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page