forked from trackreco/mkFit
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile.config
218 lines (177 loc) · 7.47 KB
/
Makefile.config
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
################################################################
# Build notes
################################################################
# Requires a recent gcc, e.g.:
# . /opt/rh/devtoolset-2/enable
# This is also needed for icc as it uses gcc headers.
# To build mkFit -- Matriplex Kalman Fit:
# - enable USE_MATRIPLEX in section 5,
# - cd mkFit; make (or make -C mkFit).
################################################################
# Configuration section
################################################################
# -1. What to build
# Define to also build for the old MIC (KNC), only works with icc.
# It is atomatically switched off for gcc.
#KNC_BUILD := 1
# Define to build for AVX_512, the new mic (KNL) and latest generation Xeons.
#AVX_512 := 1
# Define to build for AVX2
#AVX2 := 1
# 0. Use gcc-5 from MacPorts on OSX
# OSXGCC5 := 1
# Use clang from MacPorts on OSX
# OSXMPCLANG := 1
# 1. Use ROOT or not (never used on MIC)
# Comment out to disable root ("1" is not relevant)
#WITH_ROOT := 1
# 2. Use gcc (clang by default on mac) or icc
# Comment out to force using standard c++. For mic only icc can be used.
ifdef INTEL_LICENSE_FILE
# Define ICC to make it easier to switch to icpc
ICC := icc
CXX := ${ICC}
else ifdef OSXGCC5
CXX := c++-mp-5
TBB_PREFIX := /opt/local
else ifdef OSXMPCLANG
CXX := ${OSXMPCLANG} -Wall -Wno-unknown-pragmas -Wno-missing-braces
TBB_PREFIX := /opt/local
endif
# 3. Optimization
# -O3 implies vectorization and simd (but not AVX)
OPT := -g -O3
# 4. Vectorization settings
ifdef AVX_512
VEC_GCC := -march=native # -fopt-info-vec -mavx512f -mavx512cd
VEC_ICC := -xHost -qopt-zmm-usage=high # -xcore-avx512
else ifdef AVX2
VEC_GCC := -mavx2 -mfma
VEC_ICC := -mavx2 -mfma
else
VEC_GCC := -mavx # -fopt-info-vec-all
VEC_ICC := -mavx
endif
VEC_MIC := -mmic
# 5. Matriplex, intrinsics, vtune
# Matriplex is required for build in mkFit/
# Comment-out for matriplex, intrinsics (supported for MIC and AVX)
USE_MATRIPLEX := -DUSE_MATRIPLEX
USE_INTRINSICS := -DMPLEX_USE_INTRINSICS
# To enforce given vector size (does not work with intrinsics!)
#USE_INTRINSICS := -DMPT_SIZE=1
USE_VTUNE_NOTIFY := 1
# 6. MIC stuff is built when icc is the chosen compiler.
# MIC build is always done without root.
# Need to build root on MIC and figure out how to deploy it there.
# 7. OSX hack (is there a good way to detect clang?)
# MT needs this on OSX-10.8, c++ -v
# Apple LLVM version 5.1 (clang-503.0.40) (based on LLVM 3.4svn)
# OSX_CXXFLAGS := -stdlib=libc++
# And with gcc-4.8.1 from cms we need this
# OSX_LDFLAGS := -lstdc++
#
# Note: there is a problem building with USE_MATRIPLEX on as there
# was no __builtin_assume_aligned support in clang until recently:
# http://reviews.llvm.org/rL217349
# It will probably take a while before this gets to osx / xcode.
# If somebody is willing to test this we can try without this
# but it was giving 50% speedup on icc.
# 9. Check track state propagation for success, turns on simple
# checks of filter convergence: used in SMatrix code mostly, still retain as toyMC propagation still uses this
USE_STATE_VALIDITY_CHECKS := -DCHECKSTATEVALID
# 10. Turn on multiple scattering: for toyMC SMatrix code. Scattering handled through material map in CMSSW
#USE_SCATTERING := -DSCATTERING
# 11. In SMatrix track building, use linear interpolation across a
# a volume instead of using the geometry
#USE_LINEAR_INTERPOLATION := -DLINEARINTERP
# 12. Use built tracks for fitting in SMatrix code, comment out to fit sim tracks
#ENDTOEND := -DENDTOEND
# 13. Intel Threading Building Blocks. With icc uses system
# TBB, otherwise requires a local installation, and paths will
# have to be adjusted.
WITH_TBB := 1
# 14. Use inward fit in Conformal fit + final KF Fit: unsed in mkFit, used in SMatrix
#INWARD_FIT := -DINWARDFIT
################################################################
# Derived settings
################################################################
CPPFLAGS := -I. ${USE_MATRIPLEX} ${USE_INTRINSICS}
CXXFLAGS := -fPIC ${OPT} ${OSX_CXXFLAGS}
LDFLAGS_HOST :=
LDFLAGS_MIC := -static-intel
CPPFLAGS += ${USE_STATE_VALIDITY_CHECKS} ${USE_SCATTERING} ${USE_LINEAR_INTERPOLATION} ${ENDTOEND} ${INWARD_FIT}
ifdef USE_VTUNE_NOTIFY
ifdef VTUNE_AMPLIFIER_XE_2017_DIR
CPPFLAGS += -I$(VTUNE_AMPLIFIER_XE_2017_DIR)/include -DUSE_VTUNE_PAUSE
LDFLAGS_HOST += -L$(VTUNE_AMPLIFIER_XE_2017_DIR)/lib64 -littnotify
LDFLAGS_MIC += -L$(VTUNE_AMPLIFIER_XE_2017_DIR)/bin64/k1om -littnotify
endif
endif
ifneq (${CXX}, ${ICC})
#CXXFLAGS += -Wall -Wno-unknown-pragmas
KNC_BUILD :=
endif
ifeq (${CXX}, ${ICC})
VEC_HOST := ${VEC_ICC}
CXXFLAGS += -qopt-report=5 -qopenmp-simd -qopt-report-phase=all
else
VEC_HOST := ${VEC_GCC}
endif
ifeq ($(CXX), g++)
CXXFLAGS += -std=c++1z -ftree-vectorize -Werror=main -Werror=pointer-arith -Werror=overlength-strings -Wno-vla -Werror=overflow -Wstrict-overflow -Werror=array-bounds -Werror=format-contains-nul -Werror=type-limits -fvisibility-inlines-hidden -fno-math-errno --param vect-max-version-for-alias-checks=50 -Xassembler --compress-debug-sections -felide-constructors -fmessage-length=0 -Wall -Wno-non-template-friend -Wno-long-long -Wreturn-type -Wunused -Wparentheses -Wno-deprecated -Werror=return-type -Werror=missing-braces -Werror=unused-value -Werror=address -Werror=format -Werror=sign-compare -Werror=write-strings -Werror=delete-non-virtual-dtor -Wstrict-aliasing -Werror=narrowing -Werror=unused-but-set-variable -Werror=reorder -Werror=unused-variable -Werror=conversion-null -Werror=return-local-addr -Wnon-virtual-dtor -Werror=switch -fdiagnostics-show-option -Wno-unused-local-typedefs -Wno-attributes -Wno-psabi
CXXFLAGS += -fdiagnostics-color=always -fdiagnostics-show-option -pthread -pipe -fopenmp-simd
endif
# Try to find a new enough TBB
ifneq ($(CXX),icc)
ifndef TBB_PREFIX
ifdef CMSSW_BASE
CPPFLAGS += -I$(shell cd $$CMSSW_BASE && scram tool tag tbb INCLUDE)
LDFLAGS_HOST += -L$(shell cd $$CMSSW_BASE && scram tool tag tbb LIBDIR)
else ifdef TBB_GCC
TBB_PREFIX = $(TBB_GCC)
endif
endif
endif
ifdef WITH_TBB
# icc finds tbb in its own installation, but allow overriding in case it doesn't
ifdef TBB_PREFIX
CPPFLAGS += -I${TBB_PREFIX}/include
LDFLAGS += -L${TBB_PREFIX}/lib -Wl,-rpath,${TBB_PREFIX}/lib
endif
CPPFLAGS += -DTBB
LDFLAGS += -ltbb
endif
CPPFLAGS_NO_ROOT := ${CPPFLAGS} -DNO_ROOT
LDFLAGS_NO_ROOT := ${LDFLAGS}
ifdef WITH_ROOT
CPPFLAGS += $(shell root-config --cflags)
LDFLAGS += $(shell root-config --libs)
else
MKFIT_ROOT_DIR := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
CPPFLAGS += -DNO_ROOT -I$(MKFIT_ROOT_DIR)/from-root
endif
ifdef DEBUG
CPPFLAGS += -DDEBUG
endif
# Set stdlib at the very end, as other flags (i.e. ROOT) can override our choice for which version of c++
CPPFLAGS += -std=c++1z
################################################################
# Dependency generation
################################################################
DEPEND_TGTS = -MQ '$(patsubst %.d,%.o,$@)'
ifdef KNC_BUILD
DEPEND_TGTS += -MQ '$(patsubst %.d,%.om,$@)'
endif
# With icc use gcc for dependency generation. Check if this is still true with icc-16.
# MT-2016-08-30: icc 16.0.3 seems ok. Leaving this here until we update phiphi.
ifeq (${CXX}, ${ICC})
MAKEDEPEND = gcc -MM -MG ${DEPEND_TGTS} ${CPPFLAGS}
else
MAKEDEPEND = ${CXX} -MM -MG ${DEPEND_TGTS} ${CPPFLAGS}
endif
CPPFLAGS += ${CPPUSERFLAGS}
CXXFLAGS += ${CXXUSERFLAGS}
LDFLAGS += ${LDUSERFLAGS}
%.d: %.cc
${MAKEDEPEND} -o $@ $<