blob: 273d7b07ec490101b3e54953f38e8c1e4cd3a494 [file] [log] [blame]
Jim Cownie18d84732014-05-10 17:02:09 +00001<ompts:test>
2<ompts:testdescription>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.</ompts:testdescription>
3<ompts:ompversion>3.0</ompts:ompversion>
4<ompts:directive>omp task</ompts:directive>
5<ompts:dependences>omp single</ompts:dependences>
6<ompts:testcode>
7 INCLUDE "omp_my_sleep.f"
8
9 INTEGER FUNCTION <ompts:testcode:functionname>omp_task</ompts:testcode:functionname>()
10 IMPLICIT NONE
11 INCLUDE "omp_testsuite.f"
12 <ompts:orphan:vars>
13 INTEGER omp_get_num_threads, omp_get_thread_num
14 EXTERNAL my_sleep
15 INTEGER myj
16 INTEGER i,j
17 INTEGER tids(NUM_TASKS)
18 COMMON /orphvars/ j,tids
19 </ompts:orphan:vars>
20!$omp parallel private(myj) shared(j)
21!$omp single
22 do i=1, NUM_TASKS
23 j = i
24 <ompts:orphan>
25 myj = j
26 <ompts:check>
27!$omp task
28 </ompts:check>
29 call my_sleep(SLEEPTIME)
30 tids(myj) = omp_get_thread_num()
31 <ompts:check>
32!$omp end task
33 </ompts:check>
34 </ompts:orphan>
35 end do
36!$omp end single
37!$omp end parallel
38
39 <testfunctionname></testfunctionname> = 0
40
41 ! check if more than one thread executed the tasks.
42 do i=1, NUM_TASKS
43 if (tids(1) .ne. tids(i)) then
44 <testfunctionname></testfunctionname> = 1
45 end if
46 end do
47
48 END FUNCTION
49</ompts:testcode>
50</ompts:test>