-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
75 lines (59 loc) · 2.05 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
cmake_minimum_required( VERSION 2.8 )
project( POLY )
set( CMAKE_SUPPRESS_REGENERATION on )
set( CMAKE_VERBOSE_MAKEFILE no )
include_directories( "${PROJECT_BINARY_DIR}" )
# cuda options
set( CUDA_TOOLKIT_ROOT_DIR "/usr/local/cuda" )
find_package( CUDA )
set( CUDA_NVCC_FLAGS -arch=sm_20 )
set( CUDA_LIBRARIES -L"/usr/local/cuda/lib64" -lcufft )
set( OCELOT 0 ) # set 0 if ocelot not used
if( OCELOT )
set( CUDA_LIBRARIES -locelot )
endif()
#
#set( CMAKE_C_FLAGS "-march=native -O3 -pipe -floop-block -floop-strip-mine -floop-interchange -flto" )
set( CMAKE_C_FLAGS "-O0 -ggdb -Wall -Wno-format-extra-args -fopenmp" )
link_libraries( -lm )
# fft
add_executable( poly_serial_fft src/poly.c src/fft.c )
SET_TARGET_PROPERTIES( poly_serial_fft
PROPERTIES COMPILE_FLAGS "-DSERIAL" )
add_executable( poly_openmp_fft src/poly.c src/fft.c )
SET_TARGET_PROPERTIES( poly_openmp_fft
PROPERTIES COMPILE_FLAGS "-DOPENMP" )
if( CUDA_FOUND )
cuda_add_executable( poly_cuda_fft src/poly.c src/fft.cu )
SET_TARGET_PROPERTIES( poly_cuda_fft
PROPERTIES COMPILE_FLAGS "-DCUDA" )
endif()
# end fft
# karatsuba
add_executable( poly_serial_karatsuba src/poly.c src/karatsuba.c )
SET_TARGET_PROPERTIES( poly_serial_karatsuba
PROPERTIES COMPILE_FLAGS "-DSERIAL" )
add_executable( poly_openmp_karatsuba src/poly.c src/karatsuba.c )
SET_TARGET_PROPERTIES( poly_openmp_karatsuba
PROPERTIES COMPILE_FLAGS "-DOPENMP" )
if( CUDA_FOUND )
cuda_add_executable( poly_cuda_karatsuba src/poly.c src/karatsuba.cu )
SET_TARGET_PROPERTIES( poly_cuda_karatsuba
PROPERTIES COMPILE_FLAGS "-DCUDA" )
endif()
# end karatsuba
# naive
add_executable( poly_serial_naive src/poly.c src/naive.c )
SET_TARGET_PROPERTIES( poly_serial_naive
PROPERTIES COMPILE_FLAGS "-DSERIAL" )
add_executable( poly_openmp_naive src/poly.c src/naive.c )
SET_TARGET_PROPERTIES( poly_openmp_naive
PROPERTIES COMPILE_FLAGS "-DOPENMP" )
if( CUDA_FOUND )
cuda_add_executable( poly_cuda_naive src/poly.c src/naive.cu )
SET_TARGET_PROPERTIES( poly_cuda_naive
PROPERTIES COMPILE_FLAGS "-DCUDA" )
endif()
#end naive
# tests
enable_testing()