|
1 | 1 | cmake_minimum_required (VERSION 3.7) |
| 2 | +if(NOT CMAKE_BUILD_TYPE) |
| 3 | + set(CMAKE_BUILD_TYPE Release CACHE STRING "Debug or Release") |
| 4 | +endif() |
2 | 5 | project(spectrum C CXX Fortran) |
3 | 6 | enable_testing() |
4 | 7 |
|
5 | | -option(USE_MKL "use Intel MKL") |
6 | 8 | # we build separate libraries for real and complex to avoid polymorphic performance hits and complexities. |
7 | 9 | list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/Modules/) |
8 | 10 |
|
9 | | -include(cmake/math.cmake) |
10 | 11 | # *** DO NOT use -ffast-math *** it screws up the signaling between modules!! |
11 | 12 | include(cmake/compilers.cmake) |
12 | 13 |
|
13 | 14 | add_compile_options(${FLAGS}) |
14 | 15 |
|
15 | | -add_library(subspace SHARED filters.f90 covariance.f90 subspace.f90 signals.f90 perf.f90) |
16 | | -if(f2008) |
| 16 | +find_package(LAPACK REQUIRED) |
| 17 | + |
| 18 | +add_library(subspace filters.f90 covariance.f90 subspace.f90 signals.f90 perf.f90) |
| 19 | +if(f2018) |
17 | 20 | target_sources(subspace PRIVATE comm.f90) |
18 | 21 | else() |
19 | 22 | target_sources(subspace PRIVATE comm_legacy.f90) |
20 | 23 | endif() |
21 | | -target_link_libraries(subspace PRIVATE ${FLIBS}) |
22 | 24 | target_compile_options(subspace PRIVATE ${FFLAGS}) |
| 25 | +target_link_libraries(subspace PRIVATE ${LAPACK_LIBRARIES}) |
23 | 26 |
|
24 | 27 | #------ test program: Fortran Complex Double Precision ---------- |
25 | 28 | add_executable(fespritcmpl RunSubspace.f90) |
26 | | -target_link_libraries(fespritcmpl subspace ${FLIBS}) |
| 29 | +target_link_libraries(fespritcmpl subspace) |
27 | 30 | target_compile_options(fespritcmpl PRIVATE ${FFLAGS}) |
28 | 31 | add_test(NAME FortranComplexEsprit COMMAND fespritcmpl) |
| 32 | +set_tests_properties(FortranComplexEsprit PROPERTIES TIMEOUT 15) |
29 | 33 | #------ test program: Fortran Real Single Precision ------------- |
30 | 34 | add_executable(fespritreal RunSubspace_realsp.f90) |
31 | | -target_link_libraries(fespritreal subspace ${FLIBS}) |
| 35 | +target_link_libraries(fespritreal subspace) |
32 | 36 | target_compile_options(fespritreal PRIVATE ${FFLAGS}) |
33 | 37 | add_test(NAME FortranRealEsprit COMMAND fespritreal) |
| 38 | +set_tests_properties(FortranRealEsprit PROPERTIES TIMEOUT 15) |
34 | 39 | #------ test program: C++ Real Single --------------------------- |
35 | 40 | add_executable(cppesprit cppSubspace.cpp) |
36 | | -target_link_libraries(cppesprit subspace ${CLIBS} ${CXXLIBS}) |
| 41 | +target_link_libraries(cppesprit subspace) |
37 | 42 | set_target_properties(cppesprit PROPERTIES CXX_STANDARD 11) |
38 | 43 | add_test(NAME C++Esprit COMMAND cppesprit) |
| 44 | +set_tests_properties(C++Esprit PROPERTIES TIMEOUT 15) |
39 | 45 | #------ test program: C Real Single ----------------------------- |
40 | 46 | add_executable(cesprit cSubspace.c) |
41 | | -target_link_libraries(cesprit subspace ${CLIBS}) |
| 47 | +target_link_libraries(cesprit subspace) |
42 | 48 | set_target_properties(cesprit PROPERTIES C_STANDARD 11) |
43 | 49 | add_test(NAME C-Esprit COMMAND cesprit) |
44 | | - |
45 | | - |
46 | | -#------------------------------------------------------------------------------- |
47 | | - |
48 | | -# ------ mkl manual working -- NOTE: -Wl,--no-as-need prevents runtime errors |
49 | | -# gfortran -fdefault-integer-8 -g -I$MKLROOT/include/intel64/ilp64 -m64 -I$MKLROOT/include ../comm.f90 ../perf.f90 ../covariance.f90 ../subspace.f90 ../signals.f90 ../RunSubspace.f90 -L$MKLROOT/lib/intel64 -lmkl_blas95_ilp64 -lmkl_lapack95_ilp64 -lmkl_gf_ilp64 -lmkl_sequential -lmkl_core -lpthread -lm -ldl && ./a.out |
50 | | - |
51 | | -# OpenBLAS gfortran Complex64 WORKING |
52 | | -# gfortran ../comm.f90 ../perf.f90 ../covariance.f90 ../subspace.f90 ../signals.f90 ../RunSubspace.f90 -lblas -llapack -lpthread -lm && ./a.out |
53 | | -# |
54 | | -# MKL gfortran Real32 WORKING |
55 | | -# gfortran ../comm.f90 ../perf.f90 ../covariance_realsp.f90 ../subspace_realsp.f90 ../signals_realsp.f90 ../filters.f90 ../RunSubspace_realsp.f90 -lmkl_blas95_lp64 -lmkl_lapack95_lp64 -lmkl_gf_lp64 -lmkl_sequential -lmkl_core -ldl -lm && ./a.out |
56 | | -# |
57 | | -# not working 8-byte integer Parameter 13 SGESVD |
58 | | -# ifort -i8 -I${F95ROOT}/include/intel64/ilp64 -I${MKLROOT}/include ../comm.f90 ../perf.f90 ../covariance_realsp.f90 ../subspace_realsp.f90 ../signals_realsp.f90 ../filters.f90 ../RunSubspace_realsp.f90 ${MKLROOT}/lib/intel64/libmkl_blas95_ilp64.a ${MKLROOT}/lib/intel64/libmkl_lapack95_ilp64.a -L${MKLROOT}/lib/intel64 -Wl,--no-as-needed -lmkl_gf_ilp64 -lmkl_sequential -lmkl_core -lpthread -ldl -lm && ./a.out |
59 | | -# |
60 | | -# |
61 | | -# ifort -I${F95ROOT}/include/intel64/lp64 -I${MKLROOT}/include ../comm.f90 ../perf.f90 ../covariance_realsp.f90 ../subspace_realsp.f90 ../signals_realsp.f90 ../filters.f90 ../RunSubspace_realsp.f90 ${MKLROOT}/lib/intel64/libmkl_blas95_lp64.a ${MKLROOT}/lib/intel64/libmkl_lapack95_lp64.a -L${MKLROOT}/lib/intel64 -lmkl_gf_lp64 -lmkl_sequential -lmkl_core -lpthread -ldl -lm && ./a.out |
62 | | - |
63 | | - |
64 | | -#---- intel compiler |
65 | | -# note that you can compile first with GCC then link with ICPC (kind of silly |
66 | | -# since main computation is done in Fortran, but just to show the concept) |
67 | | -# cmake .. |
68 | | -# make |
69 | | -# icpc ../cppSubspace.cpp libsubspace_real.a -lgfortran -llapack |
70 | | - |
71 | | -# using Intel Compiler requires linking: |
72 | | -# svml intlc ifcore imf |
73 | | -# that do not work for GCC |
74 | | -# |
75 | | -# cd bin |
76 | | -# rm -r * |
77 | | -# FC=ifort CC=icc CXX=icpc cmake .. |
78 | | -# make |
79 | | -# icpc ../cppSubspace.cpp libsubspace_real.a -lifcore -lsvml -lintlc -limf |
80 | | - |
| 50 | +set_tests_properties(C-Esprit PROPERTIES TIMEOUT 15) |
81 | 51 |
|
0 commit comments