aboutsummaryrefslogtreecommitdiff
path: root/libgomp/testsuite/libgomp.oacc-fortran/gang-static-1.f90
blob: 7d56060ad496009add463e4d3e8d84b084836433 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
! { dg-do run }

program main
  integer, parameter :: n = 100
  integer i, a(n), b(n)
  integer x

  do i = 1, n
     b(i) = i
  end do

  !$acc parallel loop gang (static:*) num_gangs (10)
  do i = 1, n
     a(i) = b(i) + 0
  end do
  !$acc end parallel loop

  call test (a, b, 0, n)

  !$acc parallel loop gang (static:1) num_gangs (10)
  do i = 1, n
     a(i) = b(i) + 1
  end do
  !$acc end parallel loop

  call test (a, b, 1, n)

  !$acc parallel loop gang (static:2) num_gangs (10)
  do i = 1, n
     a(i) = b(i) + 2
  end do
  !$acc end parallel loop

  call test (a, b, 2, n)

  !$acc parallel loop gang (static:5) num_gangs (10)
  do i = 1, n
     a(i) = b(i) + 5
  end do
  !$acc end parallel loop

  call test (a, b, 5, n)

  !$acc parallel loop gang (static:20) num_gangs (10)
  do i = 1, n
     a(i) = b(i) + 20
  end do
  !$acc end parallel loop

  call test (a, b, 20, n)

  x = 5
  !$acc parallel loop gang (static:0+x) num_gangs (10)
  do i = 1, n
     a(i) = b(i) + 5
  end do
  !$acc end parallel loop

  call test (a, b, 5, n)

  x = 10
  !$acc parallel loop gang (static:x) num_gangs (10)
  do i = 1, n
     a(i) = b(i) + 10
  end do
  !$acc end parallel loop

  call test (a, b, 10, n)
end program main

subroutine test (a, b, sarg, n)
  integer n
  integer a (n), b(n), sarg
  integer i

  do i = 1, n
     if (a(i) .ne. b(i) + sarg) call abort ()
  end do
end subroutine test