Skip to content

Commit

Permalink
Purely technical update pertaining to standalone builds
Browse files Browse the repository at this point in the history
  • Loading branch information
srlantz authored and mmasciov committed Oct 9, 2024
1 parent 7e75e8f commit be6c619
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 18 deletions.
31 changes: 22 additions & 9 deletions RecoTracker/MkFitCore/standalone/Makefile.config
Original file line number Diff line number Diff line change
Expand Up @@ -53,16 +53,22 @@ endif
OPT := -g -Ofast

# 4. Vectorization settings
# SRL 2024-10-15: Updated to use -march flags available in GCC 11+, Clang 12+
ifdef AVX_512
VEC_GCC := -march=native # -fopt-info-vec -mavx512f -mavx512cd
VEC_GCC := -march=x86-64-v4
#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_GCC := -march=x86-64-v3
#VEC_GCC := -mavx2 -mfma
VEC_ICC := -mavx2 -mfma
else ifdef SSE3
VEC_GCC := -msse3
VEC_GCC := -march=x86-64-v2
#VEC_GCC := -msse3
# SRL 2024-10-05: v2 is latest CMSSW default, includes SSE4, SSSE3, not AVX
VEC_ICC := -msse3
else
# SRL 2024-10-05: Default to AVX - Intel Sandy Bridge, Ivy Bridge (2011-2015)
VEC_GCC := -mavx # -fopt-info-vec-all
VEC_ICC := -mavx
endif
Expand Down Expand Up @@ -120,12 +126,19 @@ endif

ifeq ($(CXX), g++)
# For gcc, compile with flags approximating "scram build echo_CXXFLAGS" in a CMSSW env
# -msse3 is enabled above, if so configured (i.e., not avx)
# -Ofast is specified above in section 3.
# -std is set to c++1z below (was c++17 here)
# SRL 2024-10-05: Update to latest CMSSW flags, some get set elsewere...
# -march=x86-64-v2 is enabled above, if so configured (i.e., SSE3=1, not avx)
# -Ofast is specified above in section 3, it includes -O3
# -std=c++20 below (ROOT 6.30.09 needs it too, formerly it was c++1z below)
# MT 2023-12-11: Had to remove -Werror=missing-braces ... triggered by RNTuple/REntry
# CXXFLAGS += -pthread -pipe -Werror=main -Werror=pointer-arith -Werror=overlength-strings -Wno-vla -Werror=overflow -ftree-vectorize -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 -fuse-ld=bfd -felide-constructors -fmessage-length=0 -Wall -Wno-non-template-friend -Wno-long-long -Wreturn-type -Wextra -Wpessimizing-move -Wclass-memaccess -Wno-cast-function-type -Wno-unused-but-set-parameter -Wno-ignored-qualifiers -Wno-deprecated-copy -Wno-unused-parameter -Wunused -Wparentheses -Wno-deprecated -Werror=return-type -Werror=missing-braces -Werror=unused-value -Werror=unused-label -Werror=address -Werror=format -Werror=sign-compare -Werror=write-strings -Werror=delete-non-virtual-dtor -Werror=strict-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 += -pthread -pipe -Werror=main -Werror=pointer-arith -Werror=overlength-strings -Wno-vla -Werror=overflow -ftree-vectorize -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 -fuse-ld=bfd -felide-constructors -fmessage-length=0 -Wall -Wno-non-template-friend -Wno-long-long -Wreturn-type -Wextra -Wpessimizing-move -Wclass-memaccess -Wno-cast-function-type -Wno-unused-but-set-parameter -Wno-ignored-qualifiers -Wno-deprecated-copy -Wno-unused-parameter -Wunused -Wparentheses -Wno-deprecated -Werror=return-type -Werror=unused-value -Werror=unused-label -Werror=address -Werror=format -Werror=sign-compare -Werror=write-strings -Werror=delete-non-virtual-dtor -Werror=strict-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 += -pthread -pipe -Werror=main -Werror=pointer-arith -Werror=overlength-strings -Wno-vla -Werror=overflow -ftree-vectorize -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 -Wno-error=array-bounds -Warray-bounds -fuse-ld=bfd -felide-constructors -fmessage-length=0 -Wall -Wno-non-template-friend -Wno-long-long -Wreturn-type -Wextra -Wpessimizing-move -Wclass-memaccess -Wno-cast-function-type -Wno-unused-but-set-parameter -Wno-ignored-qualifiers -Wno-unused-parameter -Wunused -Wparentheses -Werror=return-type -Werror=unused-value -Werror=unused-label -Werror=address -Werror=format -Werror=sign-compare -Werror=write-strings -Werror=delete-non-virtual-dtor -Werror=strict-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
endif

# SRL 2024-10-05: Enable the flags below for gcc plus Clang-like compilers
# (including icpx); the flags above either affect warnings (-W), or have
# effects that don't matter or are invalid for Clang.
# Note, -Ofast already includes -mno-math-errno and -ftree-vectorize (via -O3).
ifneq ($(CXX),icc)
CXXFLAGS += -fdiagnostics-color=auto -fdiagnostics-show-option -fopenmp-simd
# Disable reciprocal math for Intel/AMD consistency, see cms-sw/cmsdist#8280
CXXFLAGS += -fno-reciprocal-math -mrecip=none
Expand Down Expand Up @@ -170,7 +183,7 @@ ifdef DEBUG
endif

# Set C++ standard version at the very end, as other flags (i.e. ROOT) can override our choice for which version of c++
CXXFLAGS += -std=c++1z
CXXFLAGS += -std=c++20

################################################################
# Dependency generation
Expand Down
11 changes: 8 additions & 3 deletions RecoTracker/MkFitCore/standalone/README_buildFromCMSSW.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,17 @@ echo -e "/RecoTracker/MkFit/\n/RecoTracker/MkFitCMS/\n/RecoTracker/MkFitCore/" >
echo -e "/FWCore/Utilities/interface/" >> .git/info/sparse-checkout
git checkout # enter detached-head state
./RecoTracker/MkFitCore/standalone/configure $PWD
source ./RecoTracker/MkFitCore/standalone/xeon_scripts/init-env.sh
unset INTEL_LICENSE_FILE

# To build with gcc:
source ./RecoTracker/MkFitCore/standalone/xeon_scripts/init-env.sh
make -j 16 AVX_512:=1 WITH_ROOT=1

# To build with icc, do the above except for make, then:
# if [ -z ${INTEL_LICENSE_FILE+x} ]; then export INTEL_LICENSE_FILE=1; fi
# To build with icpx, do this instead (note, WITH_ROOT doesn't work yet):
# source /opt/intel/oneapi/compiler/latest/env/vars.sh
# source /opt/intel/oneapi/tbb/latest/env/vars.sh
# make -j 16 AVX_512:=1 CXX=icpx

# To build with icc (obsolete), source the gcc AND icpx scripts above, then:
# if [ -z ${INTEL_LICENSE_FILE+x} ]; then export INTEL_LICENSE_FILE=1; fi
# make -j 16 AVX_512:=1 WITH_ROOT=1
23 changes: 17 additions & 6 deletions RecoTracker/MkFitCore/standalone/xeon_scripts/init-env.sh
Original file line number Diff line number Diff line change
@@ -1,13 +1,24 @@
#!/bin/bash
if [[ `[ -f /usr/bin/lsb_release ] && lsb_release -si` == "Fedora" ]]
then
os_arch_comp="el9_amd64_gcc13"
elif [[ `[ -f /etc/redhat-release ] && awk '{print $1}' /etc/redhat-release` == "AlmaLinux" ]]
source /cvmfs/cms.cern.ch/${os_arch_comp}/lcg/root/6.30.07-38879e46537b73c431ecb76409c95eac/etc/profile.d/init.sh
export TBB_GCC=/cvmfs/cms.cern.ch/${os_arch_comp}/external/tbb/v2021.9.0-ef248624754cb25d582754024f93e5e8
export GCC_CXXCOMPILER_BASE=$(which gcc | sed s[/bin/gcc[[)
elif [[ `[ -f /etc/redhat-release ] && awk -F. '{print $1}' /etc/redhat-release` == "AlmaLinux release 9" ]]
then
os_arch_comp="el9_amd64_gcc12"
source /cvmfs/cms.cern.ch/${os_arch_comp}/lcg/root/6.30.09-0308019b8ff223bcf0391fcc4df2b105/etc/profile.d/init.sh
export TBB_GCC=/cvmfs/cms.cern.ch/${os_arch_comp}/external/tbb/v2021.9.0-f55817ca40e6490787280b5021409fd9
export GCC_CXXCOMPILER_BASE=$(which gcc | sed s[/bin/gcc[[)
elif [[ `[ -f /etc/redhat-release ] && awk -F. '{print $1}' /etc/redhat-release` == "AlmaLinux release 8" ]]
then
os_arch_comp="el8_amd64_gcc12"
source /cvmfs/cms.cern.ch/${os_arch_comp}/lcg/root/6.30.09-c59d6b036f1cbd6988c172ba319259f1/etc/profile.d/init.sh
export TBB_GCC=/cvmfs/cms.cern.ch/${os_arch_comp}/external/tbb/v2021.9.0-2391c941213c757dc9a1835b31681235
export GCC_CXXCOMPILER_BASE=$(which gcc | sed s[/bin/gcc[[)
else
os_arch_comp="slc7_amd64_gcc11"
os_arch_comp="slc7_amd64_gcc12"
source /cvmfs/cms.cern.ch/${os_arch_comp}/lcg/root/6.30.09-c59d6b036f1cbd6988c172ba319259f1/etc/profile.d/init.sh
export TBB_GCC=/cvmfs/cms.cern.ch/${os_arch_comp}/external/tbb/v2021.9.0-2391c941213c757dc9a1835b31681235
export GCC_CXXCOMPILER_BASE=$(which gcc | sed s[/bin/gcc[[)
fi

source /cvmfs/cms.cern.ch/${os_arch_comp}/lcg/root/6.28.07-573b0d3de9894ea2ab667c0d36cf4882/etc/profile.d/init.sh
export TBB_GCC=/cvmfs/cms.cern.ch/${os_arch_comp}/external/tbb/v2021.9.0-295412b9bb1d6b3275d2ace3e62c1faa

0 comments on commit be6c619

Please sign in to comment.