-
Notifications
You must be signed in to change notification settings - Fork 2
/
CMakeLists.txt
97 lines (78 loc) · 4.95 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
cmake_minimum_required(VERSION 3.14)
project(
fft_bench
LANGUAGES C CXX
)
set(CMAKE_CXX_STANDARD 20)
set (default_build_type "Release")
if (NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
message (STATUS "No build type specified. Setting build type to Release.")
set (CMAKE_BUILD_TYPE "Release" CACHE STRING "Valid options: Debug, RelWithDebInfo, Release" FORCE)
endif()
set(BENCHMARK_ENABLE_TESTING off CACHE STRING "" FORCE)
set(
FFT_BENCH_INCLUDES
${PROJECT_SOURCE_DIR}/include
)
find_package(PkgConfig REQUIRED)
find_package(MKL REQUIRED)
find_package(OpenMP REQUIRED)
pkg_check_modules(FFTW3 REQUIRED fftw3)
include(ExternalProject)
ExternalProject_Add(libsleef
SOURCE_DIR ${PROJECT_SOURCE_DIR}/extern/sleef
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR}/contrib -DBUILD_DFT=TRUE -DSLEEFDFT_MAXBUTWIDTH=7
)
add_subdirectory(${PROJECT_SOURCE_DIR}/extern/benchmark)
set(KISSFFT_STATIC ON CACHE STRING "" FORCE)
set(KISSFFT_PKGCONFIG ON CACHE STRING "" FORCE)
set(KISSFFT_TOOLS OFF CACHE STRING "" FORCE)
set(KISSFFT_TEST OFF CACHE STRING "" FORCE)
set(KISSFFT_DATATYPE double CACHE STRING "" FORCE)
add_subdirectory(${PROJECT_SOURCE_DIR}/extern/kissfft)
add_executable(sleef_bench ${PROJECT_SOURCE_DIR}/src/fft_bench.cpp)
add_dependencies(sleef_bench libsleef)
target_include_directories(sleef_bench PRIVATE ${FFT_BENCH_INCLUDES} ${CMAKE_BINARY_DIR}/contrib/include)
target_link_directories(sleef_bench PRIVATE ${CMAKE_BINARY_DIR}/contrib/lib64)
target_link_libraries(sleef_bench benchmark::benchmark sleef sleefdft)
target_compile_options(sleef_bench PRIVATE -march=native -DFFT_BENCH_SLEEF)
add_executable(mkl_bench ${PROJECT_SOURCE_DIR}/src/fft_bench.cpp)
target_include_directories(mkl_bench PRIVATE ${FFT_BENCH_INCLUDES} ${MKL_H})
target_link_libraries(mkl_bench mkl_rt benchmark::benchmark)
target_compile_options(mkl_bench PRIVATE -march=native -DFFT_BENCH_MKL)
add_executable(mkl_omp_bench ${PROJECT_SOURCE_DIR}/src/fft_bench.cpp)
target_include_directories(mkl_omp_bench PRIVATE ${FFT_BENCH_INCLUDES} ${FFTW3_INCLUDE_DIRS})
target_link_libraries(mkl_omp_bench mkl_rt OpenMP::OpenMP_CXX benchmark::benchmark)
target_compile_options(mkl_omp_bench PRIVATE -march=native -DFFT_BENCH_MKL -DFFT_BENCH_OMP)
add_executable(ducc_omp_bench ${PROJECT_SOURCE_DIR}/src/fft_bench.cpp)
target_include_directories(ducc_omp_bench PRIVATE ${FFT_BENCH_INCLUDES} ${PROJECT_SOURCE_DIR}/extern/ducc0/src)
target_link_libraries(ducc_omp_bench benchmark::benchmark)
target_compile_options(ducc_omp_bench PRIVATE -O3 -march=native -ffast-math -DFFT_BENCH_DUCC -DFFT_BENCH_OMP -pthread)
add_executable(fftw3_bench ${PROJECT_SOURCE_DIR}/src/fft_bench.cpp)
target_include_directories(fftw3_bench PRIVATE ${FFT_BENCH_INCLUDES} ${FFTW3_INCLUDE_DIRS})
target_link_libraries(fftw3_bench ${FFTW3_LIBRARIES} benchmark::benchmark)
target_compile_options(fftw3_bench PRIVATE -march=native -DFFT_BENCH_FFTW3)
add_executable(fftw3_omp_bench ${PROJECT_SOURCE_DIR}/src/fft_bench.cpp)
target_include_directories(fftw3_omp_bench PRIVATE ${FFT_BENCH_INCLUDES} ${FFTW3_INCLUDE_DIRS})
target_link_libraries(fftw3_omp_bench ${FFTW3_LIBRARIES} ${FFTW3_LIBDIR}/libfftw3_omp.so OpenMP::OpenMP_CXX benchmark::benchmark)
target_compile_options(fftw3_omp_bench PRIVATE -march=native -DFFT_BENCH_FFTW3 -DFFT_BENCH_OMP)
add_executable(pocket_bench ${PROJECT_SOURCE_DIR}/src/fft_bench.cpp ${PROJECT_SOURCE_DIR}/extern/pocketfft/pocketfft.c)
target_include_directories(pocket_bench PRIVATE ${FFT_BENCH_INCLUDES} ${PROJECT_SOURCE_DIR}/extern/pocketfft)
target_link_libraries(pocket_bench benchmark::benchmark)
target_compile_options(pocket_bench PRIVATE -march=native -DFFT_BENCH_POCKET)
add_executable(kiss_bench ${PROJECT_SOURCE_DIR}/src/fft_bench.cpp)
target_include_directories(kiss_bench PRIVATE ${FFT_BENCH_INCLUDES})
target_link_libraries(kiss_bench benchmark::benchmark kissfft::kissfft)
target_compile_options(kiss_bench PRIVATE -march=native -DFFT_BENCH_KISS)
add_executable(ducc_bench ${PROJECT_SOURCE_DIR}/src/fft_bench.cpp)
target_include_directories(ducc_bench PRIVATE ${FFT_BENCH_INCLUDES} ${PROJECT_SOURCE_DIR}/extern/ducc0/src)
target_link_libraries(ducc_bench benchmark::benchmark)
target_compile_options(ducc_bench PRIVATE -O3 -march=native -ffast-math -DFFT_BENCH_DUCC -DDUCC0_NO_LOWLEVEL_THREADING)
add_executable(duccnew_omp_bench ${PROJECT_SOURCE_DIR}/src/fft_bench.cpp)
target_include_directories(duccnew_omp_bench PRIVATE ${FFT_BENCH_INCLUDES} ${PROJECT_SOURCE_DIR}/extern/ducc0new/src)
target_link_libraries(duccnew_omp_bench benchmark::benchmark)
target_compile_options(duccnew_omp_bench PRIVATE -O3 -march=native -ffast-math -DFFT_BENCH_DUCC -DFFT_BENCH_OMP -pthread)
add_executable(duccnew_bench ${PROJECT_SOURCE_DIR}/src/fft_bench.cpp)
target_include_directories(duccnew_bench PRIVATE ${FFT_BENCH_INCLUDES} ${PROJECT_SOURCE_DIR}/extern/ducc0new/src)
target_link_libraries(duccnew_bench benchmark::benchmark)
target_compile_options(duccnew_bench PRIVATE -O3 -march=native -ffast-math -DFFT_BENCH_DUCC -DDUCC0_NO_LOWLEVEL_THREADING)