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
For more complete information about compiler optimizations, see our Optimization Notice.