Commit 696c04cd authored by Budiardja, Reuben's avatar Budiardja, Reuben
Browse files

Test case for multiple selectors with begin/end metadirective.

parent 7f42c5db
!-- Check if using begin/end metadirective with static selector for
! target executes on device and produces correct results.
! This should pass on "ibm", fail elsewhere.
program OpenMP_BeginEndMetadirectiveStatic_MultipleSelectors_Target
use omp_lib
use iso_fortran_env
implicit none
integer :: &
iV
real ( real64 ), dimension ( : ), allocatable :: &
A, B, C, &
C_Ref
character ( 1 ) :: &
ibm, cray
allocate ( A ( 1024 ) )
allocate ( B ( 1024 ) )
allocate ( C ( 1024 ) )
call random_number ( A )
call random_number ( B )
call random_number ( C )
allocate ( C_Ref, source = C )
C_Ref = A + B
!$OMP target enter data map ( to: A, B, C )
!$OMP begin metadirective &
!$OMP when ( implementation = { vendor(ibm) } &
!$OMP : target ) &
!$OMP when ( implementation = { vendor(cray) } &
!$OMP : target )
!$OMP parallel do
do iV = 1, size ( A )
C ( iV ) = A ( iV ) + B ( iV )
end do
!$OMP end parallel do
!$OMP end metadirective
!$OMP target update from ( C )
if ( all ( C == C_Ref ) ) then
print*, 'PASSED'
else
print*, 'FAILED'
end if
end program OpenMP_BeginEndMetadirectiveStatic_MultipleSelectors_Target
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment