forked from lattice/quda
-
Notifications
You must be signed in to change notification settings - Fork 0
/
make.inc.in
234 lines (201 loc) · 7.15 KB
/
make.inc.in
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
232
233
###### Local configuration:
CUDA_INSTALL_PATH = @CUDA_INSTALL_PATH@
QDP_INSTALL_PATH = @QDP_INSTALL_PATH@
QDPXX_CXXFLAGS = @QDPXX_CXXFLAGS@
QDPXX_LDFLAGS = @QDPXX_LDFLAGS@
QDPXX_LIBS = @QDPXX_LIBS@
CPU_ARCH = @CPU_ARCH@ # x86 or x86_64
GPU_ARCH = @GPU_ARCH@ # sm_10, sm_11, sm_12, sm_13, sm_20, sm_21 or sm_30
OS = @QUDA_OS@ # linux or osx
PYTHON = @QUDA_PYTHON@ # python 2.5 or later required for 'make gen'
# compilation options
HOST_DEBUG = @HOST_DEBUG@ # compile host debug code
DEVICE_DEBUG = @DEVICE_DEBUG@ # compile device debug code for cuda-gdb
VERBOSE = @VERBOSE@ # display kernel register useage
DSLASH_PROFILING = @DSLASH_PROFILING@ # multi-gpu dslash profiling
FERMI_DBLE_TEX=@FERMI_DBLE_TEX@ # enable double-precision texture reads on Fermi?
BUILD_WILSON_DIRAC = @BUILD_WILSON_DIRAC@ # build Wilson Dirac operators?
BUILD_CLOVER_DIRAC = @BUILD_CLOVER_DIRAC@ # build clover Dirac operators?
BUILD_DOMAIN_WALL_DIRAC = @BUILD_DOMAIN_WALL_DIRAC@ # build domain wall Dirac operators?
BUILD_STAGGERED_DIRAC = @BUILD_STAGGERED_DIRAC@ # build staggered Dirac operators?
BUILD_TWISTED_MASS_DIRAC = @BUILD_TWISTED_MASS_DIRAC@ # build twisted mass Dirac operators?
BUILD_FATLINK = @BUILD_FATLINK@ # build code for computing asqtad fat links?
BUILD_HISQLINK = @BUILD_HISQLINK@ # build code for computing hisq fat links?
BUILD_GAUGE_FORCE = @BUILD_GAUGE_FORCE@ # build code for (1-loop Symanzik) gauge force?
BUILD_FERMION_FORCE = @BUILD_FERMION_FORCE@ # build code for asqtad fermion force?
BUILD_HISQ_FORCE = @BUILD_HISQ_FORCE@ # build code for hisq fermion force?
# Multi-GPU options
BUILD_MULTI_GPU = @BUILD_MULTI_GPU@ # set to 'yes' to build the multi-GPU code
BUILD_QMP = @BUILD_QMP@ # set to 'yes' to build the QMP multi-GPU code
BUILD_MPI = @BUILD_MPI@ # set to 'yes' to build the MPI multi-GPU code
OVERLAP_COMMS = @OVERLAP_COMMS@ # set to 'yes' to overlap comms and compute
# GPUdirect options
GPU_DIRECT = @GPU_DIRECT@ # set to 'yes' to allow GPU and NIC to shared pinned buffers
BUILD_QIO = @BUILD_QIO@ # set to 'yes' to build QIO code for binary I/O
USE_QDPJIT = @USE_QDPJIT@ # build QDP-JIT support?
FECC = @FECC@ # front-end CC
FECXX = @FECXX@ # front-end CXX
MPI_HOME=@MPI_HOME@
QMP_HOME=@QMP_HOME@
QIO_HOME=@QIO_HOME@
NUMA_AFFINITY=@NUMA_AFFINITY@ # enable NUMA affinity?
######
INC = -I$(CUDA_INSTALL_PATH)/include
ifeq ($(strip $(CPU_ARCH)), x86_64)
ifeq ($(strip $(OS)), osx)
LIB = -L$(CUDA_INSTALL_PATH)/lib -lcudart
NVCCOPT = -m64
else
LIB = -L$(CUDA_INSTALL_PATH)/lib64 -lcudart
endif
COPT += -DPOINTER_SIZE=8
NVCCOPT += -DPOINTER_SIZE=8
else
LIB = -L$(CUDA_INSTALL_PATH)/lib -lcudart
COPT = -malign-double -DPOINTER_SIZE=4
NVCCOPT = -DPOINTER_SIZE=4
endif
COPT += -D__COMPUTE_CAPABILITY__=$(GPU_ARCH:sm_%=%0)
NVCCOPT += -D__COMPUTE_CAPABILITY__=$(GPU_ARCH:sm_%=%0)
ifneq (,$(filter $(strip $(GPU_ARCH)),sm_20 sm_21 sm_30))
NVCCOPT += -ftz=true -prec-div=false -prec-sqrt=false
endif
ifeq ($(strip $(BUILD_MULTI_GPU)), yes)
COPT += -DMULTI_GPU
NVCCOPT += -DMULTI_GPU
endif
CC = $(FECC)
CXX = $(FECXX)
ifeq ($(strip $(BUILD_MPI)), yes)
MPI_CFLAGS =
MPI_LDFLAGS =
MPI_LIBS =
INC += -DMPI_COMMS $(MPI_CFLAGS) -I$(MPI_HOME)/include/mpi
LIB += $(MPI_LDFLAGS) $(MPI_LIBS)
FACE_COMMS_OBJS=face_mpi.o comm_mpi.o
else
FACE_COMMS_OBJS=face_qmp.o
endif
ifeq ($(strip $(BUILD_QMP)), yes)
QMP_CFLAGS = $(shell $(QMP_HOME)/bin/qmp-config --cflags )
QMP_LDFLAGS = $(shell $(QMP_HOME)/bin/qmp-config --ldflags )
QMP_LIBS = $(shell $(QMP_HOME)/bin/qmp-config --libs )
INC += -DQMP_COMMS $(QMP_CFLAGS)
LIB += $(QMP_LDFLAGS) $(QMP_LIBS)
FACE_COMMS_OBJS=face_qmp.o comm_qmp.o
endif
ifeq ($(strip $(OVERLAP_COMMS)), yes)
COPT += -DOVERLAP_COMMS
NVCCOPT += -DOVERLAP_COMMS
endif
ifeq ($(strip $(BUILD_QIO)), yes)
INC += -DHAVE_QIO -I$(QIO_HOME)/include
LIB += -L$(QIO_HOME)/lib -lqio -llime
QIO_UTIL = qio_util.o layout_hyper.o gauge_qio.o
endif
ifeq ($(strip $(BUILD_WILSON_DIRAC)), yes)
NVCCOPT += -DGPU_WILSON_DIRAC
COPT += -DGPU_WILSON_DIRAC
DIRAC_TEST = dslash_test invert_test
endif
ifeq ($(strip $(BUILD_DOMAIN_WALL_DIRAC)), yes)
NVCCOPT += -DGPU_DOMAIN_WALL_DIRAC
COPT += -DGPU_DOMAIN_WALL_DIRAC
DIRAC_TEST = dslash_test invert_test
endif
ifeq ($(strip $(BUILD_STAGGERED_DIRAC)), yes)
NVCCOPT += -DGPU_STAGGERED_DIRAC
COPT += -DGPU_STAGGERED_DIRAC
STAGGERED_DIRAC_TEST=staggered_dslash_test staggered_invert_test
endif
ifeq ($(strip $(BUILD_CLOVER_DIRAC)), yes)
NVCCOPT += -DGPU_CLOVER_DIRAC -DGPU_WILSON_DIRAC
COPT += -DGPU_CLOVER_DIRAC -DGPU_WILSON_DIRAC
endif
ifeq ($(strip $(BUILD_TWISTED_MASS_DIRAC)), yes)
NVCCOPT += -DGPU_TWISTED_MASS_DIRAC -DGPU_WILSON_DIRAC
COPT += -DGPU_TWISTED_MASS_DIRAC -DGPU_WILSON_DIRAC
endif
ifeq ($(strip $(BUILD_FATLINK)), yes)
NVCCOPT += -DGPU_FATLINK
FATLINK_TEST=llfat_test
COPT += -DGPU_FATLINK
FATLINK_ITF_OBJS=llfat_quda_itf.o
endif
ifeq ($(strip $(BUILD_HISQLINK)), yes)
ifneq ($(strip $(BUILD_FATLINK)), yes)
NVCCOPT += -DGPU_FATLINK
COPT += -DGPU_FATLINK
FATLINK_TEST=llfat_test
FATLINK_ITF_OBJS=llfat_quda_itf.o
endif
NVCCOPT += -DGPU_UNITARIZE
COPT += -DGPU_UNITARIZE
endif
ifeq ($(strip $(BUILD_GAUGE_FORCE)), yes)
NVCCOPT += -DGPU_GAUGE_FORCE
COPT += -DGPU_GAUGE_FORCE
GAUGE_FORCE_TEST=gauge_force_test
endif
ifeq ($(strip $(BUILD_FERMION_FORCE)), yes)
NVCCOPT += -DGPU_FERMION_FORCE
COPT += -DGPU_FERMION_FORCE
FERMION_FORCE_TEST=fermion_force_test
endif
ifeq ($(strip $(BUILD_HISQ_FORCE)), yes)
NVCCOPT += -DGPU_HISQ_FORCE
COPT += -DGPU_HISQ_FORCE
HISQ_PATHS_FORCE_TEST=hisq_paths_force_test
HISQ_UNITARIZE_FORCE_TEST=hisq_unitarize_force_test
endif
ifeq ($(strip $(HOST_DEBUG)), yes)
NVCCOPT += -g -DHOST_DEBUG
COPT += -g -fno-inline -DHOST_DEBUG
endif
ifeq ($(strip $(DEVICE_DEBUG)), yes)
NVCCOPT += -G
endif
ifeq ($(strip $(VERBOSE)), yes)
NVCCOPT += --ptxas-options=-v
endif
ifeq ($(strip $(DSLASH_PROFILING)), yes)
NVCCOPT += -DDSLASH_PROFILING
COPT += -DDSLASH_PROFILING
endif
ifeq ($(strip $(FERMI_DBLE_TEX)), no)
NVCCOPT += -DFERMI_NO_DBLE_TEX
COPT += -DFERMI_NO_DBLE_TEX
endif
ifeq ($(strip $(GPU_DIRECT)), yes)
NVCCOPT += -DGPU_DIRECT
COPT += -DGPU_DIRECT
endif
ifeq ($(strip $(OS)), osx)
NUMA_AFFINITY = no
endif
ifeq ($(strip $(NUMA_AFFINITY)), yes)
NVCCOPT += -DNUMA_AFFINITY
COPT += -DNUMA_AFFINITY
NUMA_AFFINITY_OBJS=numa_affinity.o
endif
### Next conditional is necessary.
### QDPXX_CXXFLAGS contains "-O3".
### We must make sure its not given
### twice to nvcc. It would complain.
ifeq ($(strip $(USE_QDPJIT)), yes)
NVCCOPT += -DUSE_QDPJIT
COPT += -DUSE_QDPJIT
LIB += $(QDPXX_LDFLAGS) $(QDPXX_LIBS)
INC += $(QDPXX_CXXFLAGS)
CFLAGS = -Wall -std=c99 $(COPT) $(INC)
CXXFLAGS = -Wall $(COPT) $(INC)
NVCC = $(CUDA_INSTALL_PATH)/bin/nvcc
NVCCFLAGS = $(NVCCOPT) -arch=$(GPU_ARCH) $(INC)
LDFLAGS = -fPIC $(LIB)
else
CFLAGS = -Wall -O3 -std=c99 $(COPT) $(INC)
CXXFLAGS = -Wall -O3 $(COPT) $(INC)
NVCC = $(CUDA_INSTALL_PATH)/bin/nvcc
NVCCFLAGS = -O3 $(NVCCOPT) -arch=$(GPU_ARCH) $(INC)
LDFLAGS = -fPIC $(LIB)
endif