From 05f4ad9116d3a3030b19650e1c22a346962c9304 Mon Sep 17 00:00:00 2001 From: Radovan Bast Date: Mon, 11 Jul 2016 16:20:44 +0200 Subject: [PATCH] do not entangle tests --- test/fc_blas/cmake/autocmake.yml | 4 +-- test/fc_blas/src/CMakeLists.txt | 11 ------- test/fc_openblas/cmake/autocmake.yml | 11 +++++++ test/fc_openblas/src/CMakeLists.txt | 6 ++++ test/fc_openblas/src/example.f90 | 45 ++++++++++++++++++++++++++++ test/test_openblas.py | 2 +- 6 files changed, 64 insertions(+), 15 deletions(-) create mode 100644 test/fc_openblas/cmake/autocmake.yml create mode 100644 test/fc_openblas/src/CMakeLists.txt create mode 100644 test/fc_openblas/src/example.f90 diff --git a/test/fc_blas/cmake/autocmake.yml b/test/fc_blas/cmake/autocmake.yml index a8eadbc..0ed452b 100644 --- a/test/fc_blas/cmake/autocmake.yml +++ b/test/fc_blas/cmake/autocmake.yml @@ -3,10 +3,8 @@ min_cmake_version: 2.8 modules: - fc: - source: ../../../modules/fc.cmake -- math1: +- math: - source: ../../../modules/math/blas.cmake -- math2: - - source: ../../../modules/math/openblas.cmake - default_build_paths: - source: ../../../modules/default_build_paths.cmake - src: diff --git a/test/fc_blas/src/CMakeLists.txt b/test/fc_blas/src/CMakeLists.txt index 6ebea0e..682fdba 100644 --- a/test/fc_blas/src/CMakeLists.txt +++ b/test/fc_blas/src/CMakeLists.txt @@ -1,17 +1,6 @@ -if (ENABLE_BLAS) if(BLAS_FOUND) add_executable(example example.f90) target_link_libraries(example ${BLAS_LIBRARIES}) else() message(FATAL_ERROR "BLAS library not found") endif() -endif() - -if (ENABLE_OPENBLAS) -if(OpenBLAS_FOUND) - add_executable(example example.f90) - target_link_libraries(example ${OpenBLAS_LIB}) -else() - message(FATAL_ERROR "OpenBLAS library not found") -endif() -endif() diff --git a/test/fc_openblas/cmake/autocmake.yml b/test/fc_openblas/cmake/autocmake.yml new file mode 100644 index 0000000..957dbee --- /dev/null +++ b/test/fc_openblas/cmake/autocmake.yml @@ -0,0 +1,11 @@ +name: example +min_cmake_version: 2.8 +modules: +- fc: + - source: ../../../modules/fc.cmake +- math: + - source: ../../../modules/math/openblas.cmake +- default_build_paths: + - source: ../../../modules/default_build_paths.cmake +- src: + - source: ../../../modules/src.cmake diff --git a/test/fc_openblas/src/CMakeLists.txt b/test/fc_openblas/src/CMakeLists.txt new file mode 100644 index 0000000..9b723b2 --- /dev/null +++ b/test/fc_openblas/src/CMakeLists.txt @@ -0,0 +1,6 @@ +if(OpenBLAS_FOUND) + add_executable(example example.f90) + target_link_libraries(example ${OpenBLAS_LIB}) +else() + message(FATAL_ERROR "OpenBLAS library not found") +endif() diff --git a/test/fc_openblas/src/example.f90 b/test/fc_openblas/src/example.f90 new file mode 100644 index 0000000..7be86c7 --- /dev/null +++ b/test/fc_openblas/src/example.f90 @@ -0,0 +1,45 @@ +program example + + implicit none + + integer, parameter :: n = 10 + + integer :: i, j + logical :: test_ok + + real(8), allocatable :: a(:, :) + real(8), allocatable :: b(:, :) + real(8), allocatable :: c(:, :) + + allocate(a(n, n)) + allocate(b(n, n)) + allocate(c(n, n)) + + a = 1.0d0 + b = 2.0d0 + c = 0.0d0 + + call dgemm('n', 'n', n, n, n, 1.0d0, a, n, b, n, 0.0d0, c, n) + + test_ok = .true. + + do i = 1, n + do j = 1, n + if (dabs(c(i, j) - 20.0d0) > tiny(0.0d0)) then + print *, 'ERROR: element', i, j, 'is', c(i, j) + test_ok = .false. + end if + end do + end do + + deallocate(a) + deallocate(b) + deallocate(c) + + if (test_ok) then + print *, 'PASSED' + else + print *, 'FAILED' + end if + +end program diff --git a/test/test_openblas.py b/test/test_openblas.py index 71ea1cf..3bbb497 100644 --- a/test/test_openblas.py +++ b/test/test_openblas.py @@ -81,4 +81,4 @@ def configure_build_and_exe(name, setup_command, launcher=None): @skip_on_osx def test_fc_openblas(): - configure_build_and_exe('fc_blas', 'python setup --fc=gfortran --openblas') + configure_build_and_exe('fc_openblas', 'python setup --fc=gfortran --openblas')