-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
179 lines (159 loc) · 6.26 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
cmake_minimum_required(VERSION 3.16)
project(mpskit LANGUAGES CXX C)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
include(CheckIPOSupported)
check_ipo_supported(RESULT result OUTPUT output)
if(NOT result)
message(WARNING "IPO is not supported: ${output}")
endif()
find_package(HDF5 REQUIRED)
find_package(Boost REQUIRED)
find_package(LAPACK REQUIRED)
find_package(Threads REQUIRED)
message(STATUS "BLAS/LAPACK vendor: ${BLA_VENDOR}")
macro(mpskit_compile_options target)
target_compile_options(itensor PRIVATE $<$<CXX_COMPILER_ID:GNU>:-fconcepts>)
target_compile_definitions(${target} PRIVATE H5_USE_XTENSOR)
target_compile_definitions(${target} PRIVATE FMT_HEADER_ONLY)
target_compile_definitions(${target} PRIVATE XTENSOR_USE_XSIMD)
target_compile_definitions(${target} PRIVATE SPDLOG_FMT_EXTERNAL)
if(${BLA_VENDOR} MATCHES "Intel" OR "mkl")
target_compile_definitions(${target} PRIVATE -DPLATFORM_mkl)
elseif(${BLA_VENDOR} MATCHES ACML)
target_compile_definitions(${target} PRIVATE -DPLATFORM_mkl)
elseif(${BLA_VENDOR} MATCHES Apple)
target_compile_definitions(${target} PRIVATE -DPLATFORM_macos)
else()
target_compile_definitions(${target} PRIVATE -DPLATFORM_lapack)
endif()
target_compile_options(${target} PRIVATE
$<$<OR:$<CXX_COMPILER_ID:Clang>,$<CXX_COMPILER_ID:AppleClang>,$<CXX_COMPILER_ID:GNU>>:-O>
)
if(IPO_SUPPORTED)
set_property(TARGET ${target} PROPERTY INTERPROCEDURAL_OPTIMIZATION TRUE)
endif()
endmacro()
macro(mpskit_enable_warnings target)
target_compile_options(${target} PRIVATE
$<$<OR:$<CXX_COMPILER_ID:Clang>,$<CXX_COMPILER_ID:AppleClang>,$<CXX_COMPILER_ID:GNU>>:-Wall -Wextra -Wconversion -Wsign-conversion -pedantic -Werror -pedantic-errors>
)
endmacro()
macro(mpskit_include_directories target)
target_include_directories(${target} SYSTEM BEFORE PRIVATE
dependencies/CLI11/include
dependencies/fmt/include
dependencies/highfive/include
dependencies/json/include
dependencies/xtensor/include
dependencies/xtl/include
dependencies/xsimd/include
dependencies/itensor
dependencies/spdlog/include
${CMAKE_CURRENT_BINARY_DIR}
)
endmacro()
macro(mpskit_link_libraries target)
target_link_libraries(${target} PRIVATE LAPACK::LAPACK)
target_link_libraries(${target} PRIVATE Threads::Threads)
target_link_libraries(${target} PRIVATE HDF5::HDF5)
target_link_libraries(${target} PRIVATE Boost::boost)
endmacro()
configure_file(itensor_config.h.in ${CMAKE_CURRENT_BINARY_DIR}/itensor/config.h COPYONLY)
add_library(itensor STATIC
dependencies/itensor/itensor/decomp.cc
dependencies/itensor/itensor/global.cc
dependencies/itensor/itensor/hermitian.cc
dependencies/itensor/itensor/index.cc
dependencies/itensor/itensor/indexset.cc
dependencies/itensor/itensor/itensor.cc
dependencies/itensor/itensor/qn.cc
dependencies/itensor/itensor/spectrum.cc
dependencies/itensor/itensor/svd.cc
dependencies/itensor/itensor/tagset.cc
dependencies/itensor/itensor/itdata/combiner.cc
dependencies/itensor/itensor/itdata/dense.cc
dependencies/itensor/itensor/itdata/diag.cc
# dependencies/itensor/itensor/itdata/itlazy.cc
dependencies/itensor/itensor/itdata/qcombiner.cc
dependencies/itensor/itensor/itdata/qdense.cc
dependencies/itensor/itensor/itdata/qdiag.cc
dependencies/itensor/itensor/itdata/scalar.cc
dependencies/itensor/itensor/mps/autompo.cc
dependencies/itensor/itensor/mps/mpo.cc
dependencies/itensor/itensor/mps/mpoalgs.cc
dependencies/itensor/itensor/mps/mps.cc
dependencies/itensor/itensor/mps/mpsalgs.cc
dependencies/itensor/itensor/tensor/algs.cc
dependencies/itensor/itensor/tensor/contract.cc
dependencies/itensor/itensor/tensor/gemm.cc
dependencies/itensor/itensor/tensor/lapack_wrap.cc
dependencies/itensor/itensor/tensor/mat.cc
dependencies/itensor/itensor/tensor/vec.cc
dependencies/itensor/itensor/util/args.cc
dependencies/itensor/itensor/util/cputime.cc
dependencies/itensor/itensor/util/input.cc
)
mpskit_compile_options(itensor)
mpskit_include_directories(itensor)
mpskit_link_libraries(itensor)
add_library(mpskit_common STATIC
mpskit/cmd/dmrg.cpp
mpskit/cmd/analyze_basis.cpp
mpskit/cmd/create_state.cpp
mpskit/cmd/entanglement_entropy.cpp
mpskit/cmd/list_observables.cpp
mpskit/cmd/list_one_point.cpp
mpskit/cmd/list_two_point.cpp
mpskit/cmd/max_bond_dimension.cpp
mpskit/cmd/overlap.cpp
mpskit/json.cpp
mpskit/models/bosons/1d/bose_hubbard_1d.cpp
mpskit/models/bosons/1d/bosonic_1d.cpp
mpskit/models/model.cpp
mpskit/models/model_1d.cpp
mpskit/models/model_2d.cpp
mpskit/models/registry.cpp
mpskit/models/spin_half/1d/heisenberg_1d.cpp
mpskit/models/spin_half/1d/calabrese_2020.cpp
mpskit/models/spin_half/1d/ising_lr_1d.cpp
mpskit/models/spin_half/1d/spin_half_1d.cpp
mpskit/models/spin_half/1d/transverse_ising_1d.cpp
mpskit/models/spin_half/1d/vitagliano_2010.cpp
mpskit/models/spin_half/1d/xy_inhom.cpp
mpskit/models/spin_half/1d/xy_spin_glass_1d.cpp
mpskit/models/spin_half/2d/ising_lr_square.cpp
mpskit/models/spin_half/2d/spin_half_square.cpp
mpskit/models/spin_half/2d/transverse_ising_square.cpp
mpskit/observable.cpp
mpskit/observer.cpp
mpskit/point_functions.cpp
mpskit/terms.cpp
mpskit/util.cpp
)
mpskit_compile_options(mpskit_common)
mpskit_enable_warnings(mpskit_common)
mpskit_include_directories(mpskit_common)
mpskit_link_libraries(mpskit_common)
target_link_libraries(mpskit_common PRIVATE itensor)
add_executable(
mpskit
mpskit.cpp
)
mpskit_compile_options(mpskit)
mpskit_enable_warnings(mpskit)
mpskit_include_directories(mpskit)
mpskit_link_libraries(mpskit)
target_link_libraries(mpskit PRIVATE itensor)
target_link_libraries(mpskit PRIVATE mpskit_common)
add_executable(
tdvp_example
dependencies/TDVP/sample/run.cc
)
mpskit_compile_options(tdvp_example)
mpskit_include_directories(tdvp_example)
target_link_libraries(tdvp_example PRIVATE itensor)
target_include_directories(tdvp_example PRIVATE dependencies/TDVP)