Program x06adfe
! X06ADF Example Program Text
! Mark 26.1 Release. NAG Copyright 2016.
! .. Use Statements ..
Use nag_library, Only: x06abf, x06adf, x06aff
! .. Implicit None Statement ..
Implicit None
! .. Parameters ..
Integer, Parameter :: nout = 6
! .. Local Scalars ..
Integer :: in_para, me, num_got, num_req
! .. Executable Statements ..
Write (nout,*) 'X06ADF Example Program Results'
Write (nout,*)
! Get the thread number with a call to X06ADF and display it
me = x06adf()
Write (nout,99999) 'Thread number: ', me
Write (nout,*)
! Call x06aff to check whether we are in an active parallel region
in_para = x06aff()
Write (nout,99999) 'In active parallel region:', in_para
Write (nout,*)
! Spawn an OpenMP parallel region, have the master thread display
! the number of threads and check whether we are in an active
! parallel region
num_req = 5
!$Omp Parallel Num_threads (num_req), Private (in_para,me,num_got), &
!$Omp Default (None)
me = x06adf()
num_got = x06abf()
in_para = x06aff()
If (me==0) Then
Write (nout,99999) 'Number of threads: ', num_got
Write (nout,*)
Write (nout,99999) 'In active parallel region:', in_para
Write (nout,*)
End If
!$Omp End Parallel
99999 Format (1X,A,I11)
End Program x06adfe