do not entangle tests

This commit is contained in:
Radovan Bast 2016-07-11 16:20:44 +02:00
parent 1aa7e1a4bd
commit 05f4ad9116
6 changed files with 64 additions and 15 deletions

View File

@ -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:

View File

@ -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()

View File

@ -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

View File

@ -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()

View File

@ -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

View File

@ -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')