Commit 2e4430b2 authored by Budiardja, Reuben's avatar Budiardja, Reuben
Browse files

Added result checking.

parent f50c0def
!-- 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_metadirective_target_test
use omp_lib
use iso_fortran_env
implicit none
integer :: &
iV
real ( real64 ), dimension ( : ), allocatable :: &
A, B, C
A, B, C, &
C_Ref
allocate ( A ( 1024 ) )
allocate ( B ( 1024 ) )
......@@ -15,14 +22,29 @@ program OpenMP_metadirective_target_test
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) } : target )
!$OMP end metadirective
!$OMP when ( implementation = { vendor("ibm") } : target )
!$OMP parallel do
do iV = 1, size ( A )
C ( iV ) = A ( iV ) + B ( iV )
end 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_metadirective_target_test
!-- Check if using metadirective with static selector for
! target parallel do executes on device and produces correct results
! This should pass on "ibm", fail elsewhere.
program OpenMP_metadirective_target_test
use omp_lib
use iso_fortran_env
implicit none
integer :: &
iV
real ( real64 ), dimension ( : ), allocatable :: &
A, B, C
A, B, C, &
C_Ref
allocate ( A ( 1024 ) )
allocate ( B ( 1024 ) )
......@@ -15,13 +22,25 @@ program OpenMP_metadirective_target_test
call random_number ( A )
call random_number ( B )
call random_number ( C )
allocate ( C_Ref, source = C )
!$OMP metadirective &
!$OMP when ( implementation = { vendor(ibm) } : target )
C_Ref = A + B
!$OMP target enter data map ( to: A, B, C )
!$OMP parallel do
!$OMP metadirective &
!$OMP when ( implementation = { vendor("ibm") } &
!$OMP : target parallel do )
do iV = 1, size ( A )
C ( iV ) = A ( iV ) + B ( iV )
end do
!$OMP target update from ( C )
if ( all ( C == C_Ref ) ) then
print*, 'PASSED'
else
print*, 'FAILED'
end if
end program OpenMP_metadirective_target_test
Supports Markdown
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