Commit 1e4f0cc4 authored by Budiardja, Reuben's avatar Budiardja, Reuben
Browse files

Added simpler test cases for correctnes check.

parent 2e4430b2
!-- Check if using metadirective with static selector parallel do
! produces correct results
program OpenMP_metadirective_target_test
use omp_lib
use iso_fortran_env
implicit none
integer :: &
iV
real ( real64 ), dimension ( : ), allocatable :: &
A, B, C, &
C_Ref
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 metadirective &
!$OMP when ( implementation = { vendor("ibm") } : parallel do )
do iV = 1, size ( A )
C ( iV ) = A ( iV ) + B ( iV )
end do
if ( all ( C == C_Ref ) ) then
print*, 'PASSED'
else
print*, 'FAILED'
end if
end program OpenMP_metadirective_target_test
program OpenMP_metadirective_simple
use omp_lib
implicit none
logical :: &
ID
!$OMP begin metadirective &
!$OMP when ( implementation = { vendor("ibm" } : target )
ID = omp_is_initial_device ( )
!$OMP end metadirective
if ( ID ) then
print*, 'Program runs on host'
else
print*, 'Program runs on device'
end if
end program OpenMP_metadirective_simple
\ No newline at end of file
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