Program x06aafe
! X06AAF Example Program Text
! Mark 27.3 Release. NAG Copyright 2021.
! .. Use Statements ..
Use nag_library, Only: x06aaf, x06abf, x06acf
! .. Implicit None Statement ..
Implicit None
! .. Parameters ..
Integer, Parameter :: nout = 6
! .. Local Scalars ..
Integer :: ifail, num, num_max, num_set
! .. Executable Statements ..
Write (nout,*) 'X06AAF Example Program Results'
Write (nout,*)
ifail = 0
num_set = 5
! Set the OpenMP Internal Control Variable (ICV) controlling the number
! of threads
Call x06aaf(num_set,ifail)
! Retrieve the value of the ICV, and display it
num_max = x06acf()
Write (nout,99999) 'Value of ICV controlling the number of threads:', &
num_max
Write (nout,*)
! Display the number of threads in the current team
num = x06abf()
Write (nout,99999) 'Number of threads outside the parallel region: ', &
num
Write (nout,*)
! Spawn an OpenMP parallel region and have the master thread display
! the number of threads in the current team
!$Omp Parallel Private (num), Default (None)
num = x06abf()
!$Omp Master
Write (nout,99999) 'Number of threads inside the parallel region: ', &
num
Write (nout,*)
!$Omp End Master
!$Omp End Parallel
99999 Format (1X,A,I5)
End Program x06aafe