Test which checks the omp task directive. The idea of the tests is to generate a set of tasks in a single region. We let pause the tasks generated so that other threads get sheduled to the newly opened tasks.
3.0
omp task
omp single
INCLUDE "omp_my_sleep.f"
INTEGER FUNCTION omp_task()
IMPLICIT NONE
INCLUDE "omp_testsuite.f"
INTEGER omp_get_num_threads, omp_get_thread_num
EXTERNAL my_sleep
INTEGER myj
INTEGER i,j
INTEGER tids(NUM_TASKS)
COMMON /orphvars/ j,tids
!$omp parallel private(myj) shared(j)
!$omp single
do i=1, NUM_TASKS
j = i
myj = j
!$omp task
call my_sleep(SLEEPTIME)
tids(myj) = omp_get_thread_num()
!$omp end task
end do
!$omp end single
!$omp end parallel
= 0
! check if more than one thread executed the tasks.
do i=1, NUM_TASKS
if (tids(1) .ne. tids(i)) then
= 1
end if
end do
END FUNCTION