forked from lattice/quda
-
Notifications
You must be signed in to change notification settings - Fork 1
/
make.inc.in
192 lines (161 loc) · 5.58 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
###### Local configuration:
CUDA_INSTALL_PATH = @CUDA_INSTALL_PATH@
QDP_INSTALL_PATH = @QDP_INSTALL_PATH@
CPU_ARCH = @CPU_ARCH@ # x86 or x86_64
GPU_ARCH = @GPU_ARCH@ # sm_10, sm_11, sm_12, sm_13, sm_20 or sm_21
OS = @QUDA_OS@ # linux or osx
PYTHON = @QUDA_PYTHON@ # python 2.5 or later required for 'make gen'
DEVICE = @DEVICE@ # CUDA device to use for 'make tune'
# compilation options
HOST_DEBUG = @HOST_DEBUG@ # compile host debug code
DEVICE_DEBUG = @DEVICE_DEBUG@ # compile deivce debug code for cuda-gdb
VERBOSE = @VERBOSE@ # display kernel register useage
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_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?
# Multiple 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
# Do we have qio support?
BUILD_QIO = @BUILD_QIO@ # set to 'yes' to build QIO code for binary i/o
# Do we compile the numa support
#HAVE_NUMA = @HAVE_NUMA@
HAVE_NUMA = no
USE_QMEM = @USE_QMEM@ # build QMEM support?
FECC = @FECC@ # Front end CC
FECXX = @FECXX@ # Front end CXX
MPI_HOME=@MPI_HOME@
MPICC = $(MPI_HOME)/bin/mpicc
MPICXX = $(MPI_HOME)/bin/mpicxx
QMP_HOME=@QMP_HOME@
QIO_HOME=@QIO_HOME@
DSLASH_SHARED_FLOATS=0
######
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
else
LIB = -L$(CUDA_INSTALL_PATH)/lib -lcudart
COPT = -malign-double
endif
COPT += -D__CUDA_ARCH__=$(GPU_ARCH:sm_%=%0)
NVCCOPT += -D__CUDA_ARCH__=$(GPU_ARCH:sm_%=%0)
ifeq ($(strip $(GPU_ARCH)), sm_20)
NVCCOPT += -ftz=true -prec-div=false -prec-sqrt=false
endif
ifeq ($(strip $(BUILD_MULTI_GPU)), yes)
COPT += -DMULTI_GPU
NVCCOPT += -DMULTI_GPU
endif
RUN =
CC = $(FECC)
CXX = $(FECXX)
ifeq ($(strip $(BUILD_QMP)), yes)
RUN = $(MPI_HOME)/bin/mpirun -np 1
CC = $(MPICC)
CXX = $(MPICXX)
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=face_qmp.o
endif
ifeq ($(strip $(BUILD_MPI)), yes)
RUN = $(MPI_HOME)/bin/mpirun -np 1
CC = $(MPICC)
CXX = $(MPICXX)
MPI_CFLAGS =
MPI_LDFLAGS =
MPI_LIBS =
INC += -DMPI_COMMS $(MPI_CFLAGS) -I$(MPI_HOME)/include/mpi
LIB += $(MPI_LDFLAGS) $(MPI_LIBS)
FACE_COMMS=face_mpi.o mpicomm.o
else
FACE_COMMS=face_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
WILSON_DIRAC_TEST=wilson_dslash_test wilson_invert_test
endif
ifeq ($(strip $(BUILD_DOMAIN_WALL_DIRAC)), yes)
NVCCOPT += -DGPU_DOMAIN_WALL_DIRAC
COPT += -DGPU_DOMAIN_WALL_DIRAC
DOMAIN_WALL_DIRAC_TEST=domain_wall_dslash_test domain_wall_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_QUDA_ITF=llfat_quda_itf.o
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 $(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 $(HAVE_NUMA)), yes)
COPT += -DHAVE_NUMA
LIB += -lnuma
endif
ifeq ($(strip $(USE_QMEM)), yes)
NVCCOPT += -DUSE_QMEM
COPT += -DUSE_QMEM
LIB += -L$(QDP_INSTALL_PATH)/lib -lqmem
INC += -I$(QDP_INSTALL_PATH)/include
endif
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)