-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
231 lines (155 loc) · 8.73 KB
/
Copy pathMakefile
File metadata and controls
231 lines (155 loc) · 8.73 KB
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
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
CC = g++
ICC = icpc
LD = g++
NVCC = nvcc
CFLAGS = -Wall -std=c++11
ICC_LDFLAGS = -Wall -qopenmp
FPIC = -fPIC
MAGMADIR = /usr/local/magma
CUDADIR = /usr/local/cuda
OPENBLASDIR = /usr/local/openblas
MKL_CFLAGS := -m64 -I$(MKLROOT)/include
CUDA_INC := -I$(CUDADIR)/include
MAGMA_INC := -DADD_ \
-I$(MAGMADIR)/include \
-I$(CUDADIR)/include
SEQ_MKL_LIBS := -L${MKLROOT}/lib/intel64 -lmkl_intel_lp64 \
-lmkl_sequential -lmkl_core -lpthread -lm -ldl
PARAL_MKL_LIBS := -L${MKLROOT}/lib/intel64 -lmkl_intel_lp64 \
-lmkl_intel_thread -lmkl_core -liomp5 -lpthread -lm -ldl
CUSOLVER_LIBS := -L$(CUDADIR)/lib64 -lcublas -lcudart -lcusolver
MAGMA_LIBS := -L$(MAGMADIR)/lib -lmagma -lmagma_sparse \
-L$(CUDADIR)/lib64 -lcublas -lcudart -lcusolver
NVCC_CFLAGS := -gencode arch=compute_30,code=compute_30 \
-gencode arch=compute_32,code=compute_32 \
-gencode arch=compute_35,code=compute_35 \
-gencode arch=compute_50,code=compute_50 \
-gencode arch=compute_60,code=compute_60 \
-gencode arch=compute_61,code=compute_61 \
--device-c
NVCC_LDFLAGS := -gencode arch=compute_30,code=compute_30 \
-gencode arch=compute_32,code=compute_32 \
-gencode arch=compute_35,code=compute_35 \
-gencode arch=compute_50,code=compute_50 \
-gencode arch=compute_60,code=compute_60 \
-gencode arch=compute_61,code=compute_61 --device-link
# ----------------------------------------
default:
@echo "Available make targets are:"
@echo " make cpu gpu # compiles main_gpu.cu main_cpu.cpp"
@echo " make gpu # compiles main_gpu.cu"
@echo " make cpu # compiles main_cpu.cpp"
@echo " make clean # deletes executables and object files"
all:cpu gpu clean
rlm:rlm_cpu_dp rlm_gpu_mkl clean
hlm:hlm_cpu_dp clean
cpu:rlm_cpu_sp rlm_cpu_dp hlm_cpu_sp hlm_cpu_dp clean
gpu:rlm_gpu_cusolver rlm_gpu_magma rlm_gpu_mkl rlm_gpu_magma_wfs clean
.PHONY:clean remove
clean:
rm -f *.o
remove:
rm -f rlm_gpu_* rlm_cpu* hlm_cpu_*
# ------ compile gpu version of random Landau model ------
# ---- object files -----
init_rlm.o:rlm/init_rlm.cpp rlm/init_rlm.h
$(CC) $(CFLAGS) -c -o $@ $<
wfs_file.o:diag_wrappers/wfs_file.cpp diag_wrappers/wfs_file.h
$(CC) $(CFLAGS) -c -o $@ $<
matrix_coefficients.o:rlm/matrix_coefficients.cpp rlm/matrix_coefficients.h
$(CC) $(CFLAGS) -c -o $@ $<
disorder_potential.o:rlm/disorder_potential.cpp rlm/disorder_potential.h
$(CC) $(CFLAGS) $(MKL_CFLAGS) -c -o $@ $<
potential_coeff.o:rlm/potential_coeff.cu
$(NVCC) $(NVCC_CFLAGS) $(CUDA_INC) -c -o $@ $<
chern.o:diag_wrappers/chern.cpp diag_wrappers/chern.h diag_wrappers/wfs_file.h
$(CC) $(CFLAGS) $(MKL_CFLAGS) -c -o $@ $<
hamiltonian_rlm_gpu.o:rlm/hamiltonian_rlm_gpu.cu rlm/hamiltonian_rlm_gpu.h
$(NVCC) $(NVCC_CFLAGS) $(CUDA_INC) -c -o $@ $<
cusolver_diag.o:diag_wrappers/cusolver_diag.cu diag_wrappers/cusolver_diag.h
$(NVCC) $(NVCC_CFLAG) $(CUDA_INC) -c -o $@ $<
magma_diag.o:diag_wrappers/magma_diag.cu diag_wrappers/magma_diag.h
$(NVCC) $(MAGMA_CFLAGS) $(MAGMA_INC) $(NVCC_CFLAGS) -c -o $@ $<
mkl_diag.o:diag_wrappers/mkl_diag.cpp diag_wrappers/mkl_diag.h
$(CC) $(CFLAGS) $(MKL_CFLAGS) -c -o $@ $<
main_rlm_gpu_cusolver.o:rlm/main_rlm_gpu.cu
$(NVCC) -Dcusolver $(NVCC_CFLAGS) $(CUDA_INC) -c -o $@ $<
main_rlm_gpu_magma.o:rlm/main_rlm_gpu.cu
$(NVCC) -Dmagma $(MAGMA_CFLAGS) $(MAGMA_INC) $(NVCC_CFLAGS) -c -o $@ $<
main_rlm_gpu_magma_wfs.o:rlm/main_rlm_gpu.cu
$(NVCC) -Dmagma -DwfsIO $(MAGMA_CFLAGS) $(MAGMA_INC) $(NVCC_CFLAGS) -c -o $@ $<
main_rlm_gpu_mkl.o:rlm/main_rlm_gpu.cu
$(NVCC) -Dmkl $(NVCC_CFLAGS) $(CUDA_INC) -c -o $@ $<
rlm_gpu_linker_cusolver.o:main_rlm_gpu_cusolver.o hamiltonian_rlm_gpu.o cusolver_diag.o potential_coeff.o
$(NVCC) $(NVCC_LDFLAGS) $^ -o $@
rlm_gpu_linker_magma.o:main_rlm_gpu_magma.o hamiltonian_rlm_gpu.o magma_diag.o potential_coeff.o
$(NVCC) $(NVCC_LDFLAGS) $^ -o $@
rlm_gpu_linker_magma_wfs.o:main_rlm_gpu_magma_wfs.o hamiltonian_rlm_gpu.o magma_diag.o potential_coeff.o
$(NVCC) $(NVCC_LDFLAGS) $^ -o $@
rlm_gpu_linker_mkl.o:main_rlm_gpu_mkl.o hamiltonian_rlm_gpu.o potential_coeff.o
$(NVCC) $(NVCC_LDFLAGS) $^ -o $@
# ----- executables -----
rlm_gpu_cusolver:main_gpu_cusolver.o rlm_gpu_linker_cusolver.o init_rlm.o matrix_coefficients.o disorder_potential.o hamiltonian_rlm_gpu.o chern.o cusolver_diag.o wfs_file.o potential_coeff.o
$(NVCC) -Dcusolver $^ $(PARAL_MKL_LIBS) ${CUSOLVER_LIBS} ${MAGMA_LIBS} -O3 -o $@
rlm_gpu_magma:main_rlm_gpu_magma.o rlm_gpu_linker_magma.o init_rlm.o matrix_coefficients.o disorder_potential.o hamiltonian_rlm_gpu.o chern.o magma_diag.o wfs_file.o potential_coeff.o
$(NVCC) -Dmagma $^ $(PARAL_MKL_LIBS) ${MAGMA_LIBS} -O3 -o $@
rlm_gpu_mkl:main_rlm_gpu_mkl.o rlm_gpu_linker_mkl.o init_rlm.o matrix_coefficients.o disorder_potential.o hamiltonian_rlm_gpu.o chern.o mkl_diag.o wfs_file.o potential_coeff.o
$(NVCC) -Dmkl $^ $(PARAL_MKL_LIBS) ${CUSOLVER_LIBS} ${MAGMA_LIBS} -O3 -o $@
rlm_gpu_magma_wfs:main_rlm_gpu_magma_wfs.o rlm_gpu_linker_magma_wfs.o init_rlm.o matrix_coefficients.o disorder_potential.o hamiltonian_rlm_gpu.o chern.o magma_diag.o wfs_file.o potential_coeff.o
$(NVCC) -Dmagma -DwfsIO $^ $(PARAL_MKL_LIBS) ${MAGMA_LIBS} -O3 -o $@
# ------ compile cpu version of random Landau model ------
init_rlm_icc.o:rlm/init_rlm.cpp rlm/init_rlm.h
$(ICC) $(CFLAGS) -c -o $@ $<
wfs_file_icc.o:diag_wrappers/wfs_file.cpp diag_wrappers/wfs_file.h
$(ICC) $(CFLAGS) -c -o $@ $<
matrix_coefficients_icc.o:rlm/matrix_coefficients.cpp rlm/matrix_coefficients.h
$(ICC) $(CFLAGS) -c -o $@ $<
disorder_potential_icc.o:rlm/disorder_potential.cpp rlm/disorder_potential.h
$(ICC) $(CFLAGS) $(MKL_CFLAGS) -c -o $@ $<
hamiltonian_rlm_cpu.o:rlm/hamiltonian_rlm_cpu.cpp rlm/hamiltonian_rlm_cpu.h
$(ICC) $(MKL_CFLAGS) -c -o $@ $<
chern_icc.o:diag_wrappers/chern.cpp diag_wrappers/chern.h
$(ICC) $(CFLAGS) $(MKL_CFLAGS) -c -o $@ $<
mkl_diag_icc.o:diag_wrappers/mkl_diag.cpp diag_wrappers/mkl_diag.h
$(ICC) $(CFLAGS) $(MKL_CFLAGS) -c -o $@ $<
main_rlm_cpu.o:rlm/main_rlm_cpu.cpp
$(ICC) $(CFLAGS) $(MKL_CFLAGS) -c -o $@ $<
rlm_cpu_sp:main_rlm_cpu.o hamiltonian_rlm_cpu.o init_rlm_icc.o disorder_potential_icc.o chern_icc.o matrix_coefficients_icc.o mkl_diag_icc.o wfs_file_icc.o
$(ICC) $(ICC_LDFLAGS) $^ $(SEQ_MKL_LIBS) -O3 -o $@
# ------ compile cpu double precision version for random Landau model------
init_rlm_icc_dp.o:rlm/init_rlm.cpp rlm/init_rlm.h
$(ICC) -DDP $(CFLAGS) -c -o $@ $<
wfs_file_icc_dp.o:diag_wrappers/wfs_file.cpp diag_wrappers/wfs_file.h
$(ICC) -DDP $(CFLAGS) -c -o $@ $<
matrix_coefficients_icc_dp.o:rlm/matrix_coefficients.cpp rlm/matrix_coefficients.h
$(ICC) -DDP $(CFLAGS) -c -o $@ $<
disorder_potential_icc_dp.o:rlm/disorder_potential.cpp rlm/disorder_potential.h
$(ICC) -DDP $(CFLAGS) $(MKL_CFLAGS) -c -o $@ $<
hamiltonian_rlm_cpu_dp.o:rlm/hamiltonian_rlm_cpu.cpp rlm/hamiltonian_rlm_cpu.h
$(ICC) -DDP $(MKL_CFLAGS) -c -o $@ $<
chern_icc_dp.o:diag_wrappers/chern.cpp diag_wrappers/chern.h
$(ICC) -DDP $(CFLAGS) $(MKL_CFLAGS) -c -o $@ $<
mkl_diag_icc_dp.o:diag_wrappers/mkl_diag.cpp diag_wrappers/mkl_diag.h
$(ICC) -DDP $(CFLAGS) $(MKL_CFLAGS) -c -o $@ $<
main_rlm_cpu_dp.o:rlm/main_rlm_cpu.cpp
$(ICC) -DDP $(CFLAGS) $(MKL_CFLAGS) -c -o $@ $<
rlm_cpu_dp:main_rlm_cpu_dp.o hamiltonian_rlm_cpu_dp.o init_rlm_icc_dp.o disorder_potential_icc_dp.o chern_icc_dp.o matrix_coefficients_icc_dp.o mkl_diag_icc_dp.o wfs_file_icc_dp.o
$(ICC) -DDP $(ICC_LDFLAGS) $^ $(SEQ_MKL_LIBS) -O3 -o $@
# ------ compile cpu single precision version for Hofstadter lattice model ------
init_hlm_icc.o:hlm/init_hlm.cpp hlm/init_hlm.h
$(ICC) $(CFLAGS) -c -o $@ $<
hamiltonian_hlm_cpu.o:hlm/hamiltonian_hlm_cpu.cpp hlm/hamiltonian_hlm_cpu.h
$(ICC) $(MKL_CFLAGS) -c -o $@ $<
main_hlm_cpu.o:hlm/main_hlm_cpu.cpp
$(ICC) $(CFLAGS) $(MKL_CFLAGS) -c -o $@ $<
hlm_cpu_sp:main_hlm_cpu.o hamiltonian_hlm_cpu.o init_hlm_icc.o chern_icc.o mkl_diag_icc.o wfs_file_icc.o
$(ICC) $(ICC_LDFLAGS) $^ $(SEQ_MKL_LIBS) -O3 -o $@
# ------ compile cpu double precision version for Hofstadter lattice model ------
init_hlm_icc_dp.o:hlm/init_hlm.cpp hlm/init_hlm.h
$(ICC) -DDP $(CFLAGS) -c -o $@ $<
hamiltonian_hlm_cpu_dp.o:hlm/hamiltonian_hlm_cpu.cpp hlm/hamiltonian_hlm_cpu.h
$(ICC) -DDP $(MKL_CFLAGS) -c -o $@ $<
main_hlm_cpu_dp.o:hlm/main_hlm_cpu.cpp
$(ICC) -DDP $(CFLAGS) $(MKL_CFLAGS) -c -o $@ $<
hlm_cpu_dp:main_hlm_cpu_dp.o hamiltonian_hlm_cpu_dp.o init_hlm_icc_dp.o chern_icc_dp.o mkl_diag_icc_dp.o wfs_file_icc_dp.o
$(ICC) -DDP $(ICC_LDFLAGS) $^ $(SEQ_MKL_LIBS) -O3 -o $@