Merge pull request #63 from miroi/opm_test
new, simple OpenMP test added
This commit is contained in:
commit
35d1af9a85
14
test/fc_omp/cmake/autocmake.cfg
Normal file
14
test/fc_omp/cmake/autocmake.cfg
Normal file
@ -0,0 +1,14 @@
|
||||
[project]
|
||||
name: example
|
||||
|
||||
[fc]
|
||||
source: ../../../modules/fc.cmake
|
||||
|
||||
[omp]
|
||||
source: ../../../modules/omp.cmake
|
||||
|
||||
[default_build_paths]
|
||||
source: ../../../modules/default_build_paths.cmake
|
||||
|
||||
[src]
|
||||
source: ../../../modules/src.cmake
|
6
test/fc_omp/src/CMakeLists.txt
Normal file
6
test/fc_omp/src/CMakeLists.txt
Normal file
@ -0,0 +1,6 @@
|
||||
if (OPENMP_FOUND)
|
||||
add_executable(example example.f90)
|
||||
else()
|
||||
message(FATAL "OPENMP not found!")
|
||||
endif()
|
||||
|
19
test/fc_omp/src/example.f90
Normal file
19
test/fc_omp/src/example.f90
Normal 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
|
@ -160,6 +160,14 @@ def test_fc_mpi():
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
|
||||
@no_windows
|
||||
def test_fc_omp():
|
||||
os.environ['OMP_NUM_THREADS'] = '2'
|
||||
configure_build_and_exe('fc_omp', 'python setup.py --omp --fc=gfortran')
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
|
||||
@no_windows
|
||||
def test_fc_blas():
|
||||
configure_build_and_exe('fc_blas', 'python setup.py --fc=gfortran')
|
||||
|
Loading…
x
Reference in New Issue
Block a user