80 lines · plain
1! RUN: %python %S/../test_errors.py %s %flang_fc1 -fopenmp -Werror -pedantic2 3! OpenMP Version 5.04! Check OpenMP construct validity for the following directives:5! 2.12.5 Target Construct6 7program main8 integer :: i, j, N = 10, n1, n2, res(100)9 real :: a, arrayA(512), arrayB(512), ai(10)10 real, allocatable :: B(:)11 12 !$omp target13 !PORTABILITY: If TARGET UPDATE directive is nested inside TARGET region, the behaviour is unspecified [-Wopen-mp-usage]14 !$omp target update from(arrayA) to(arrayB)15 do i = 1, 51216 arrayA(i) = arrayB(i)17 end do18 !$omp end target19 20 !$omp parallel21 !$omp target22 !$omp parallel23 !PORTABILITY: If TARGET UPDATE directive is nested inside TARGET region, the behaviour is unspecified [-Wopen-mp-usage]24 !$omp target update from(arrayA) to(arrayB)25 do i = 1, 51226 arrayA(i) = arrayB(i)27 end do28 !$omp end parallel29 !$omp end target30 !$omp end parallel31 32 !$omp target33 !PORTABILITY: If TARGET DATA directive is nested inside TARGET region, the behaviour is unspecified [-Wopen-mp-usage]34 !$omp target data map(to: a)35 do i = 1, N36 a = 3.1437 end do38 !$omp end target data39 !$omp end target40 41 allocate(B(N))42 !$omp target43 !PORTABILITY: If TARGET ENTER DATA directive is nested inside TARGET region, the behaviour is unspecified [-Wopen-mp-usage]44 !$omp target enter data map(alloc:B)45 !$omp end target46 47 !$omp target48 !PORTABILITY: If TARGET EXIT DATA directive is nested inside TARGET region, the behaviour is unspecified [-Wopen-mp-usage]49 !$omp target exit data map(delete:B)50 !$omp end target51 deallocate(B)52 53 n1 = 1054 n2 = 1055 !$omp target teams map(to:a)56 !PORTABILITY: If TARGET DATA directive is nested inside TARGET region, the behaviour is unspecified [-Wopen-mp-usage]57 !ERROR: Only `DISTRIBUTE`, `PARALLEL`, or `LOOP` regions are allowed to be strictly nested inside `TEAMS` region.58 !$omp target data map(n1,n2)59 do i=1, n160 do j=1, n261 res((i-1)*10+j) = i*j62 end do63 end do64 !$omp end target data65 !$omp end target teams66 67 !$omp target teams map(to:a) map(from:n1,n2)68 !PORTABILITY: If TARGET TEAMS DISTRIBUTE PARALLEL DO directive is nested inside TARGET region, the behaviour is unspecified [-Wopen-mp-usage]69 !ERROR: Only `DISTRIBUTE`, `PARALLEL`, or `LOOP` regions are allowed to be strictly nested inside `TEAMS` region.70 !$omp target teams distribute parallel do71 do i=1, n172 do j=1, n273 res((i-1)*10+j) = i*j74 end do75 end do76 !$omp end target teams distribute parallel do77 !$omp end target teams78 79end program main80