-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
179 lines (142 loc) · 6.53 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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
# Copyright Haruhiko Matsuo and Synsge Todo 2011-2018.
# Distributed under the Boost Software License, Version 1.0.
# (See http://www.boost.org/LICENSE_1_0.txt)
cmake_minimum_required(VERSION 2.8.12 FATAL_ERROR)
project(alps-looper NONE)
######################################################################
# Version information
######################################################################
set(LOOPER_VERSION 4.1.0)
message(STATUS "Looper version: ${LOOPER_VERSION}")
configure_file(looper/version.h.in ${PROJECT_BINARY_DIR}/looper/version.h)
######################################################################
# options
######################################################################
option(LOOPER_BUILD_TESTS "Build looper tests" ON)
option(LOOPER_ENABLE_DIAG "Enable exact diagonalization method" ON)
option(LOOPER_ENABLE_ISING "Enable Swendsen-Wang method for classical Ising model" ON)
option(LOOPER_ENABLE_PI "Enable path integral method" ON)
option(LOOPER_ENABLE_SSE "Enable SSE method" ON)
option(LOOPER_ENABLE_SSE_QWL "Enable SSE quantum Wang-Landau method" OFF)
option(LOOPER_ENABLE_OPENMP "OpenMP is enabled by default. You can turn off OpenMP by -DLOOPER_ENABLE_OPENMP=OFF" ON)
if(LOOPER_ENABLE_OPENMP)
add_definitions(-DLOOPER_ENABLE_OPENMP)
endif(LOOPER_ENABLE_OPENMP)
option(LOOPER_ENABLE_TIMER "You can turn on Timer by -DLOOPER_ENABLE_TIMER=ON" OFF)
if(LOOPER_ENABLE_TIMER)
add_definitions(-DALPS_ENABLE_TIMER)
endif(LOOPER_ENABLE_TIMER)
if(LOOPER_TIMER)
option(LOOPER_TIMER_TRACE "You can turn on debug trace output in timer by -DLOOPER_TIMER_TRACE=ON" OFF)
if(LOOPER_TIMER_TRACE)
add_definitions(-DALPS_ENABLE_TIMER_TRACE)
endif(LOOPER_TIMER_TRACE)
option(LOOPER_TIMER_DETAILED "You can turn on detailed timer report by -DLOOPER_TIMER_DETAILED=ON" OFF)
if(LOOPER_TIMER_DETAILED)
add_definitions(-DALPS_ENABLE_TIMER_DETAILED)
endif(LOOPER_TIMER_DETAILED)
option(LOOPER_TIMER_BARRIER "You can turn on barrier synchronization in timer by -DLOOPER_TIMER_BARRIER=ON" OFF)
if(LOOPER_TIMER_BARRIER)
add_definitions(-DALPS_ENABLE_TIMER_BARRIER)
endif(LOOPER_TIMER_BARRIER)
option(LOOPER_ENABLE_PA1 "You can turn on PA-info by -DLOOPER_ENABLE_PA=ON" OFF)
option(LOOPER_ENABLE_PA2 "You can turn on old-PA-info by -DLOOPER_ENABLE_PA=ON" OFF)
option(LOOPER_ENABLE_RANGEDSAMP "You can turn on ranged sampling by -DLOOPER_ENABLE_RANGEDSAMP=ON" OFF)
if(LOOPER_ENABLE_PA1)
add_definitions(-DALPS_ENABLE_PA1)
endif(LOOPER_ENABLE_PA1)
if(LOOPER_ENABLE_PA2)
add_definitions(-DALPS_ENABLE_PA2)
endif(LOOPER_ENABLE_PA2)
if(LOOPER_ENABLE_RANGEDSAMP)
add_definitions(-DALPS_ENABLE_RANGEDSAMP)
endif(LOOPER_ENABLE_RANGEDSAMP)
if(LOOPER_ENABLE_PA1 AND LOOPER_ENABLE_RANGEDSAMP)
message(FATAL_ERROR "Both of sampler and hardware counter can't be enabled.")
endif(LOOPER_ENABLE_PA1 AND LOOPER_ENABLE_RANGEDSAMP)
if(LOOPER_ENABLE_PA2 AND LOOPER_ENABLE_RANGEDSAMP)
message(FATAL_ERROR "Both of sampler and hardware counter can't be enabled.")
endif(LOOPER_ENABLE_PA2 AND LOOPER_ENABLE_RANGEDSAMP)
endif(LOOPER_TIMER)
option(LOOPER_USE_DETERMINISTIC_UNIFY "Use deterministic unify for debug" OFF)
if(LOOPER_USE_DETERMINISTIC_UNIFY)
add_definitions(-DLOOPER_USE_DETERMINISTIC_UNIFY)
endif(LOOPER_USE_DETERMINISTIC_UNIFY)
######################################################################
# find ALPS Library
######################################################################
find_package(ALPS REQUIRED PATHS ${ALPS_ROOT_DIR} $ENV{ALPS_HOME} $ENV{ALPS_ROOT} NO_SYSTEM_ENVIRONMENT_PATH)
message(STATUS "Found ALPS: ${ALPS_ROOT_DIR} (revision: ${ALPS_VERSION})")
include(${ALPS_USE_FILE})
if(NOT LAPACK_FOUND)
message(FATAL "loop will not be built since lapack library is not found")
endif(NOT LAPACK_FOUND)
# enable C++ compilers
enable_language(CXX)
find_package(MPI)
# Boost
find_package(Boost REQUIRED COMPONENTS mpi system)
if(Boost_FOUND)
include_directories(${Boost_INCLUDE_DIRS})
endif(Boost_FOUND)
######################################################################
# applications
######################################################################
include_directories(${PROJECT_BINARY_DIR} ${PROJECT_SOURCE_DIR})
set(LOOP_SRC loop.C loop_custom.C loop_model.C)
if(LOOPER_ENABLE_DIAG)
set(LOOP_SRC diag.C ${LOOP_SRC})
endif(LOOPER_ENABLE_DIAG)
if(LOOPER_ENABLE_ISING)
set(LOOP_SRC ising.C ${LOOP_SRC})
endif(LOOPER_ENABLE_ISING)
if(LOOPER_ENABLE_PI)
set(LOOP_SRC path_integral.C ${LOOP_SRC})
if(MPI_FOUND)
set(LOOP_SRC path_integral_mpi.C ${LOOP_SRC})
endif(MPI_FOUND)
endif(LOOPER_ENABLE_PI)
if(LOOPER_ENABLE_SSE)
set(LOOP_SRC sse.C ${LOOP_SRC})
endif(LOOPER_ENABLE_SSE)
if(LOOPER_ENABLE_SSE_QWL)
set(LOOP_SRC sse_qwl.C ${LOOP_SRC})
endif(LOOPER_ENABLE_SSE_QWL)
add_executable(loop ${LOOP_SRC})
target_link_libraries(loop alps Boost::mpi ${ALPS_EXTRA_LIBRARIES})
install(TARGETS loop RUNTIME DESTINATION bin)
######################################################################
# test
######################################################################
set(TESTS loop)
foreach(name ${TESTS})
add_alps_test(${name})
endforeach(name)
if(LOOPER_BUILD_TESTS)
add_subdirectory(test)
endif(LOOPER_BUILD_TESTS)
######################################################################
# extras
######################################################################
add_subdirectory(extras)
######################################################################
# standalone
######################################################################
# Standalone version is built completeley independetly.
# add_subdirectory(standalone)
######################################################################
# headers
######################################################################
install(DIRECTORY looper ${CMAKE_BINARY_DIR}/looper
DESTINATION include
PATTERN ".DS_Store" EXCLUDE
PATTERN "*.in" EXCLUDE)
######################################################################
# kernels
######################################################################
install(FILES diag.C ising.C loop.C loop_custom.C loop_model.C path_integral.C path_integral_mpi.C qwl_evaluate.C sse.C sse_qwl.C DESTINATION share/looper/kernel)
######################################################################
# CMake configuration
######################################################################
configure_file(config/looper-config.cmake.in ${PROJECT_BINARY_DIR}/config/looper-config.cmake @ONLY)
install(FILES ${PROJECT_BINARY_DIR}/config/looper-config.cmake DESTINATION share/looper)