Test which checks that the omp_get_num_threads returns the correct number of threads. Therefor it counts up a variable in a parallelized section and compars this value with the result of the omp_get_num_threads function.
2.0
omp_get_num_threads
omp critical,somp single
INTEGER FUNCTION omp_get_num_threads()
INTEGER nthreads
INTEGER omp_get_num_threads
INTEGER nthreads_lib
COMMON /orphvars/ nthreads_lib
nthreads=0
nthreads_lib=-1
!$omp parallel
!shared(nthreads,nthreads_lib)
!$omp critical
nthreads = nthreads + 1
!$omp end critical
!$omp single
nthreads_lib=omp_get_num_threads()
!$omp end single
!$omp end parallel
IF (nthreads .EQ. nthreads_lib) THEN
= 1
ELSE
= 0
END IF
END