98 lines · plain
1! REQUIRES: flang2! REQUIRES: gpu3 4! RUN: %libomptarget-compile-fortran-generic -O3 -fopenmp-assume-threads-oversubscription -fopenmp-assume-teams-oversubscription5! RUN: env LIBOMPTARGET_INFO=16 OMP_NUM_TEAMS=16 OMP_TEAMS_THREAD_LIMIT=16 %libomptarget-run-generic 2>&1 | %fcheck-generic6function check_errors(array) result (errors)7 integer, intent(in) :: array(1024)8 integer :: errors9 integer :: i10 errors = 011 do i = 1, 102412 if ( array( i) .ne. (i) ) then13 errors = errors + 114 end if15 end do16end function17 18program main19 use omp_lib20 implicit none21 integer :: i,j,red22 integer :: array(1024), errors = 023 array = 124 25 ! No-loop kernel26 !$omp target teams distribute parallel do27 do i = 1, 102428 array(i) = i29 end do30 errors = errors + check_errors(array)31 32 ! SPMD kernel (num_teams clause blocks promotion to no-loop)33 array = 134 !$omp target teams distribute parallel do num_teams(3)35 do i = 1, 102436 array(i) = i37 end do38 39 errors = errors + check_errors(array)40 41 ! No-loop kernel42 array = 143 !$omp target teams distribute parallel do num_threads(64)44 do i = 1, 102445 array(i) = i46 end do47 48 errors = errors + check_errors(array)49 50 ! SPMD kernel51 array = 152 !$omp target parallel do53 do i = 1, 102454 array(i) = i55 end do56 57 errors = errors + check_errors(array)58 59 ! Generic kernel60 array = 161 !$omp target teams distribute62 do i = 1, 102463 array(i) = i64 end do65 66 errors = errors + check_errors(array)67 68 ! SPMD kernel (reduction clause blocks promotion to no-loop)69 array = 170 red =071 !$omp target teams distribute parallel do reduction(+:red)72 do i = 1, 102473 red = red + array(i)74 end do75 76 if (red .ne. 1024) then77 errors = errors + 178 end if79 80 print *,"number of errors: ", errors81 82end program main83 84! CHECK: "PluginInterface" device {{[0-9]+}} info: Launching kernel {{.*}} SPMD-No-Loop mode85! CHECK: info: #Args: 3 Teams x Thrds: 64x 1686! CHECK: "PluginInterface" device {{[0-9]+}} info: Launching kernel {{.*}} SPMD mode87! CHECK: info: #Args: 3 Teams x Thrds: 3x 16 {{.*}}88! CHECK: "PluginInterface" device {{[0-9]+}} info: Launching kernel {{.*}} SPMD-No-Loop mode89! CHECK: info: #Args: 3 Teams x Thrds: 64x 16 {{.*}}90! CHECK: "PluginInterface" device {{[0-9]+}} info: Launching kernel {{.*}} SPMD mode91! CHECK: info: #Args: 3 Teams x Thrds: 1x 1692! CHECK: "PluginInterface" device {{[0-9]+}} info: Launching kernel {{.*}} Generic mode93! CHECK: info: #Args: 3 Teams x Thrds: 16x 16 {{.*}}94! CHECK: "PluginInterface" device {{[0-9]+}} info: Launching kernel {{.*}} SPMD mode95! CHECK: info: #Args: 4 Teams x Thrds: 16x 16 {{.*}}96! CHECK: number of errors: 097 98