intel-application-migration-tool-for-openacc-to-openmp
intel-application-migration-tool-for-openacc-to-openmp copied to clipboard
Kernels could be mapped to target data clauses
As noted in the README, the experimental support for the kernels directive currently produces empty target regions that need to be manually corrected. In the code I'm working with, it seems like it would be possible to map kernels to target enter/target exit regions instead. I think this transformation might be safer.
Original
subroutine foo(a, b, n)
implicit none
integer :: a(:)
integer :: b(:)
integer :: n
integer :: i
!$acc kernels copyin(a)
!$acc loop
do i=1,n
b(i) = a(i) + 1
enddo
!$acc end kernels
end subroutine foo
Migrated
subroutine foo(a, b, n)
implicit none
integer :: a(:)
integer :: b(:)
integer :: n
integer :: i
!$omp target map(to:a)
!$omp end target
!$omp target teams loop
do i=1,n
b(i) = a(i) + 1
enddo
end subroutine foo
Expected
subroutine foo(a, b, n)
implicit none
integer :: a(:)
integer :: b(:)
integer :: n
integer :: i
!$omp target enter data map(to:a)
!$omp target teams loop
do i=1,n
b(i) = a(i) + 1
enddo
!$omp end target teams loop
!$omp target exit data map(release:a)
end subroutine foo
@Pennycook -- I was exploring this, and this behavior occurs because of some "experimental" features that I implemented in the translator. Those features were enabled by default, but since they are not very mature I have turned them off in 5ee318eadf9b414a6bf2b3f976b55fba2a2b33c2