privatized-ref-1.f95 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  1. ! { dg-do run }
  2. ! { dg-additional-options "-fopt-info-note-omp" }
  3. ! { dg-additional-options "-foffload=-fopt-info-note-omp" }
  4. ! { dg-additional-options "--param=openacc-privatization=noisy" }
  5. ! { dg-additional-options "-foffload=--param=openacc-privatization=noisy" }
  6. ! { dg-additional-options "-Wuninitialized" }
  7. !TODO
  8. ! { dg-xfail-run-if TODO { openacc_radeon_accel_selected && { ! __OPTIMIZE__ } } }
  9. ! It's only with Tcl 8.5 (released in 2007) that "the variable 'varName'
  10. ! passed to 'incr' may be unset, and in that case, it will be set to [...]",
  11. ! so to maintain compatibility with earlier Tcl releases, we manually
  12. ! initialize counter variables:
  13. ! { dg-line l_dummy[variable c_loop 0] }
  14. ! { dg-message "dummy" "" { target iN-VAl-Id } l_dummy } to avoid
  15. ! "WARNING: dg-line var l_dummy defined, but not used". */
  16. program main
  17. implicit none
  18. integer :: myint
  19. integer :: i
  20. real :: res(65536), tmp
  21. res(:) = 0.0
  22. myint = 3
  23. call gangs(myint, res)
  24. do i=1,65536
  25. tmp = i * 97
  26. if (res(i) .ne. tmp) stop 1
  27. end do
  28. res(:) = 0.0
  29. myint = 5
  30. call workers(myint, res)
  31. do i=1,65536
  32. tmp = i * 99
  33. if (res(i) .ne. tmp) stop 2
  34. end do
  35. res(:) = 0.0
  36. myint = 7
  37. call vectors(myint, res)
  38. do i=1,65536
  39. tmp = i * 101
  40. if (res(i) .ne. tmp) stop 3
  41. end do
  42. res(:) = 0.0
  43. myint = 9
  44. call gangs_workers_vectors(myint, res)
  45. do i=1,65536
  46. tmp = i * 103
  47. if (res(i) .ne. tmp) stop 4
  48. end do
  49. contains
  50. subroutine gangs(t1, res)
  51. implicit none
  52. integer :: t1
  53. integer :: i, j
  54. real, intent(out) :: res(:)
  55. !$acc parallel copyout(res) num_gangs(64)
  56. !$acc loop collapse(2) gang private(t1) ! { dg-line l_loop[incr c_loop] }
  57. ! { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop }
  58. ! { dg-note {variable 'j' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop }
  59. ! { dg-note {variable 't1' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop }
  60. do i=0,255
  61. do j=1,256
  62. t1 = (i * 256 + j) * 97
  63. res(i * 256 + j) = t1
  64. end do
  65. end do
  66. !$acc end parallel
  67. end subroutine gangs
  68. subroutine workers(t1, res)
  69. implicit none
  70. integer :: t1
  71. integer :: i, j
  72. real, intent(out) :: res(:)
  73. !$acc parallel copyout(res) num_gangs(64) num_workers(64)
  74. ! { dg-warning "using .num_workers \\(32\\)., ignoring 64" "" { target openacc_nvidia_accel_selected } .-1 }
  75. !$acc loop gang ! { dg-line l_loop[incr c_loop] }
  76. ! { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop }
  77. do i=0,255
  78. !$acc loop worker private(t1) ! { dg-line l_loop[incr c_loop] }
  79. ! { dg-note {variable 'j' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop }
  80. ! { dg-note {variable 't1' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop }
  81. do j=1,256
  82. t1 = (i * 256 + j) * 99
  83. res(i * 256 + j) = t1
  84. end do
  85. end do
  86. !$acc end parallel
  87. end subroutine workers
  88. subroutine vectors(t1, res)
  89. implicit none
  90. integer :: t1
  91. integer :: i, j
  92. real, intent(out) :: res(:)
  93. !$acc parallel copyout(res) num_gangs(64) num_workers(64)
  94. ! { dg-warning "using .num_workers \\(32\\)., ignoring 64" "" { target openacc_nvidia_accel_selected } .-1 }
  95. !$acc loop gang worker ! { dg-line l_loop[incr c_loop] }
  96. ! { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop }
  97. do i=0,255
  98. !$acc loop vector private(t1) ! { dg-line l_loop[incr c_loop] }
  99. ! { dg-note {variable 'j' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop }
  100. ! { dg-note {variable 't1' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop }
  101. do j=1,256
  102. t1 = (i * 256 + j) * 101
  103. res(i * 256 + j) = t1
  104. end do
  105. end do
  106. !$acc end parallel
  107. end subroutine vectors
  108. subroutine gangs_workers_vectors(t1, res)
  109. implicit none
  110. integer :: t1
  111. integer :: i, j
  112. real, intent(out) :: res(:)
  113. !$acc parallel copyout(res) num_gangs(64) num_workers(64)
  114. ! { dg-warning "using .num_workers \\(32\\)., ignoring 64" "" { target openacc_nvidia_accel_selected } .-1 }
  115. !$acc loop collapse(2) gang worker vector private(t1) ! { dg-line l_loop[incr c_loop] }
  116. ! { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop }
  117. ! { dg-note {variable 'j' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop }
  118. ! { dg-note {variable 't1' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop }
  119. do i=0,255
  120. do j=1,256
  121. t1 = (i * 256 + j) * 103
  122. res(i * 256 + j) = t1
  123. end do
  124. end do
  125. !$acc end parallel
  126. end subroutine gangs_workers_vectors
  127. end program main