simple OpenMP test

- with removed int64 support
This commit is contained in:
Miro ILIAS
2015-08-07 15:42:51 +02:00
committed by Miro Ilias
parent 14588a7681
commit e57d6d0372
4 changed files with 47 additions and 0 deletions

View File

@ -0,0 +1,6 @@
if (OPENMP_FOUND)
add_executable(example example.f90)
else()
message(FATAL "OPENMP not found!")
endif()

View File

@ -0,0 +1,19 @@
program example
implicit none
integer :: nthreads, tid
integer, external :: omp_get_num_threads, omp_get_thread_num
logical :: test_ok, tid_ok
!$OMP PARALLEL SHARED (nthreads, tid_ok), PRIVATE(tid)
tid = omp_get_thread_num()
if (tid .eq. 0) then
nthreads = omp_get_num_threads()
endif
tid_ok=(tid == 0 .or. tid == 1)
!$OMP END PARALLEL
test_ok=(nthreads==2 .and. tid_ok)
if (test_ok) then
print *, "PASSED"
else
stop "test fc_omp failed!"
endif
end program