Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2022-04-07 05:53:44

0001 ################################################################
0002 # Build notes
0003 ################################################################
0004 
0005 # Requires a recent gcc, e.g.:
0006 #   . /opt/rh/devtoolset-2/enable
0007 # This is also needed for icc as it uses gcc headers.
0008 
0009 # To build mkFit -- Matriplex Kalman Fit:
0010 # - cd mkFit; make (or make -C mkFit).
0011 
0012 
0013 ################################################################
0014 # Configuration section
0015 ################################################################
0016 
0017 # -1. What to build - default is AVX
0018 # Define to build for AVX_512
0019 #AVX_512 := 1
0020 # Define to build for AVX2
0021 #AVX2    := 1
0022 # Define to build for SSE3
0023 #SSE3 := 1
0024 
0025 # 0. Use gcc-5 from MacPorts on OSX
0026 # OSXGCC5    := 1
0027 # Use clang from MacPorts on OSX
0028 # OSXMPCLANG   := 1
0029 
0030 # 1. Use ROOT or not
0031 # Comment out to disable root ("1" is not relevant)
0032 #WITH_ROOT := 1
0033 
0034 # 2. Use gcc (clang by default on mac) or icc
0035 # Comment out to force using standard c++.
0036 ifdef INTEL_LICENSE_FILE
0037   # Define ICC to make it easier to switch to icpc
0038   ICC := icc
0039   CXX := ${ICC}
0040 else ifdef OSXGCC5
0041   CXX := c++-mp-5
0042   TBB_PREFIX := /opt/local
0043 else ifdef OSXMPCLANG
0044   CXX := ${OSXMPCLANG} -Wall -Wno-unknown-pragmas -Wno-missing-braces
0045   TBB_PREFIX := /opt/local
0046 endif
0047 
0048 # 3. Optimization
0049 # -O3 implies vectorization and simd (but not AVX)
0050 OPT := -g -O3
0051 
0052 # 4. Vectorization settings
0053 ifdef AVX_512
0054 VEC_GCC  := -march=native # -fopt-info-vec -mavx512f -mavx512cd
0055 VEC_ICC  := -xHost -qopt-zmm-usage=high # -xcore-avx512
0056 else ifdef AVX2
0057 VEC_GCC  := -mavx2 -mfma
0058 VEC_ICC  := -mavx2 -mfma
0059 else ifdef SSE3
0060 VEC_GCC  := -msse3
0061 VEC_ICC  := -msse3
0062 else
0063 VEC_GCC  := -mavx # -fopt-info-vec-all
0064 VEC_ICC  := -mavx
0065 endif
0066 
0067 # 5. Matriplex intrinsics, vtune
0068 # Comment-out to enable intrinsics (supported for AVX512, AVX2 and AVX)
0069 USE_INTRINSICS := -DMPLEX_USE_INTRINSICS
0070 # To enforce given vector size (does not work with intrinsics!)
0071 #USE_INTRINSICS := -DMPT_SIZE=1
0072 USE_VTUNE_NOTIFY := 1
0073 
0074 # 6. MIC stuff - obsolete
0075 
0076 # 7. OSX hack (is there a good way to detect clang?)
0077 # MT needs this on OSX-10.8, c++ -v
0078 #    Apple LLVM version 5.1 (clang-503.0.40) (based on LLVM 3.4svn)
0079 # OSX_CXXFLAGS := -stdlib=libc++
0080 # And with gcc-4.8.1 from cms we need this
0081 # OSX_LDFLAGS  := -lstdc++
0082 
0083 # 9. Check track state propagation for success, turns on simple
0084 # checks of filter convergence: used in SMatrix code mostly, still retain as toyMC propagation still uses this
0085 USE_STATE_VALIDITY_CHECKS := -DCHECKSTATEVALID
0086 
0087 # 10. Turn on multiple scattering: for toyMC SMatrix code. Scattering handled through material map in CMSSW
0088 #USE_SCATTERING := -DSCATTERING
0089 
0090 # 11. In SMatrix track building, use linear interpolation across a
0091 # a volume instead of using the geometry
0092 #USE_LINEAR_INTERPOLATION := -DLINEARINTERP
0093 
0094 # 12. Use built tracks for fitting in SMatrix code, comment out to fit sim tracks
0095 #ENDTOEND := -DENDTOEND
0096 
0097 # 13. Intel Threading Building Blocks.  With icc uses system
0098 # TBB, otherwise requires a local installation, and paths will
0099 # have to be adjusted.
0100 WITH_TBB := 1
0101 
0102 # 14. Use inward fit in Conformal fit + final KF Fit: unsed in mkFit, used in SMatrix
0103 #INWARD_FIT := -DINWARDFIT
0104 
0105 ################################################################
0106 # Derived settings
0107 ################################################################
0108 
0109 CPPFLAGS := ${USE_INTRINSICS} -DMKFIT_STANDALONE
0110 CXXFLAGS := -fPIC ${OPT} ${OSX_CXXFLAGS}
0111 
0112 LDFLAGS_HOST := 
0113 
0114 CPPFLAGS += ${USE_STATE_VALIDITY_CHECKS} ${USE_SCATTERING} ${USE_LINEAR_INTERPOLATION} ${ENDTOEND} ${INWARD_FIT} 
0115 
0116 ifdef USE_VTUNE_NOTIFY
0117   ifdef VTUNE_AMPLIFIER_XE_2017_DIR
0118     CPPFLAGS     += -I$(VTUNE_AMPLIFIER_XE_2017_DIR)/include -DUSE_VTUNE_PAUSE
0119     LDFLAGS_HOST += -L$(VTUNE_AMPLIFIER_XE_2017_DIR)/lib64 -littnotify
0120   endif
0121 endif
0122 
0123 ifeq (${CXX}, ${ICC})
0124   VEC_HOST := ${VEC_ICC}
0125   CXXFLAGS += -qopt-report=5 -qopenmp-simd -qopt-report-phase=all
0126 else
0127   VEC_HOST := ${VEC_GCC}
0128 endif
0129 
0130 ifeq ($(CXX), g++)
0131   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
0132   CXXFLAGS += -fdiagnostics-color=auto -fdiagnostics-show-option -pthread -pipe -fopenmp-simd
0133 endif
0134 
0135 # Try to find a new enough TBB
0136 ifneq ($(CXX),icc)
0137   ifndef TBB_PREFIX
0138     ifdef CMSSW_BASE
0139       CPPFLAGS += -I$(shell cd $$CMSSW_BASE && scram tool tag tbb INCLUDE)
0140       LDFLAGS_HOST += -L$(shell cd $$CMSSW_BASE && scram tool tag tbb LIBDIR)
0141     else ifdef TBB_GCC
0142       TBB_PREFIX = $(TBB_GCC)
0143     endif
0144   endif
0145 endif
0146 
0147 ifdef WITH_TBB
0148   # icc finds tbb in its own installation, but allow overriding in case it doesn't
0149   ifdef TBB_PREFIX
0150     CPPFLAGS += -I${TBB_PREFIX}/include
0151     LDFLAGS  += -L${TBB_PREFIX}/lib -Wl,-rpath,${TBB_PREFIX}/lib 
0152   endif
0153   CPPFLAGS += -DTBB
0154   LDFLAGS  += -ltbb
0155 endif
0156 
0157 CPPFLAGS_NO_ROOT := ${CPPFLAGS} -DNO_ROOT
0158 LDFLAGS_NO_ROOT  := ${LDFLAGS}
0159 
0160 ifdef WITH_ROOT
0161   CPPFLAGS += $(shell root-config --cflags)
0162   LDFLAGS  += $(shell root-config --libs)
0163 else
0164   CPPFLAGS += -DNO_ROOT
0165 endif
0166 
0167 ifdef DEBUG
0168   CPPFLAGS += -DDEBUG
0169 endif
0170 
0171 # Set stdlib at the very end, as other flags (i.e. ROOT) can override our choice for which version of c++
0172 CPPFLAGS += -std=c++1z
0173 
0174 ################################################################
0175 # Dependency generation
0176 ################################################################
0177 
0178 DEPEND_TGTS = -MQ '$(patsubst %.d,%.o,$@)'
0179 
0180 # With icc use gcc for dependency generation. Check if this is still true with icc-16.
0181 # MT-2016-08-30: icc 16.0.3 seems ok. Leaving this here until we update phiphi.
0182 
0183 ifeq (${CXX}, ${ICC})
0184   MAKEDEPEND = gcc    -MM -MG ${DEPEND_TGTS} ${CPPFLAGS}
0185 else
0186   MAKEDEPEND = ${CXX} -MM -MG ${DEPEND_TGTS} ${CPPFLAGS}
0187 endif
0188 
0189 CPPFLAGS += ${CPPUSERFLAGS}
0190 CXXFLAGS += ${CXXUSERFLAGS}
0191 LDFLAGS  += ${LDUSERFLAGS}