Skip to content

Commit

Permalink
Merge pull request #9060 from cms-sw/eigen-build-flags
Browse files Browse the repository at this point in the history
Using consistent Eigen alignment settings
  • Loading branch information
smuzaffar authored Mar 11, 2024
2 parents 8edd672 + a12ad75 commit 1f90040
Show file tree
Hide file tree
Showing 8 changed files with 38 additions and 9 deletions.
12 changes: 7 additions & 5 deletions gbl.spec
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
## INCLUDE cpp-standard
%define tag 59c2d99ea96bc739321fd251096504c91467be24
Source: git+https://gitlab.desy.de/claus.kleinwort/general-broken-lines.git?obj=main/%{tag}&export=%{n}-%{realversion}&output=/%{n}-%{realversion}.tgz
Source99: scram-tools.file/tools/eigen/env

BuildRequires: cmake
Requires: eigen
Expand All @@ -15,18 +16,19 @@ sed -i -e 's|CMAKE_CXX_STANDARD *11|CMAKE_CXX_STANDARD %{cms_cxx_standard}|' cp
rm -rf build
mkdir build
cd build
source %{_sourcedir}/env

cmake ../cpp \
-DCMAKE_INSTALL_PREFIX=%{i} \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_VERBOSE_MAKEFILE=ON \
-DEIGEN3_INCLUDE_DIR=${EIGEN_ROOT}/include/eigen3 \
-DSUPPORT_ROOT=False \
%ifarch x86_64
-DCMAKE_CXX_FLAGS="-DEIGEN_MAX_ALIGN_BYTES=64 -msse3"
%else
-DCMAKE_CXX_FLAGS="-DEIGEN_MAX_ALIGN_BYTES=64"
%endif
%ifarch x86_64
-DCMAKE_CXX_FLAGS="$CMS_EIGEN_CXX_FLAGS -msse3"
%else
-DCMAKE_CXX_FLAGS="$CMS_EIGEN_CXX_FLAGS"
%endif

make %{makeprocesses}

Expand Down
11 changes: 9 additions & 2 deletions lwtnn.spec
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
### RPM external lwtnn 2.13
### RPM external lwtnn 2.14.1
## INCLUDE cpp-standard

Source: https://github.com/lwtnn/lwtnn/archive/v%{realversion}.tar.gz
Source99: scram-tools.file/tools/eigen/env

BuildRequires: ninja cmake
Requires: eigen boost

Expand All @@ -13,11 +15,16 @@ Requires: eigen boost
rm -rf ../build
mkdir ../build
cd ../build
source %{_sourcedir}/env

cmake ../%{n}-%{realversion} \
-G Ninja \
-DCMAKE_CXX_COMPILER="g++" \
-DCMAKE_CXX_FLAGS="-fPIC" \
%ifarch x86_64
-DCMAKE_CXX_FLAGS="-fPIC $CMS_EIGEN_CXX_FLAGS -msse3" \
%else
-DCMAKE_CXX_FLAGS="-fPIC $CMS_EIGEN_CXX_FLAGS" \
%endif
-DCMAKE_INSTALL_PREFIX:PATH="%{i}" \
-DCMAKE_BUILD_TYPE=Release \
-DBUILTIN_BOOST=OFF \
Expand Down
8 changes: 8 additions & 0 deletions opencv.spec
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
%define github_user opencv

Source0: git+https://github.com/%{github_user}/opencv.git?obj=%{branch}/%{tag}&export=%{n}-%{realversion}&output=/%{n}-%{realversion}-%{tag}.tgz
Source99: scram-tools.file/tools/eigen/env

BuildRequires: cmake ninja
Requires: python3 py3-numpy libpng libjpeg-turbo libtiff zlib eigen OpenBLAS

Expand All @@ -16,6 +18,7 @@ Requires: python3 py3-numpy libpng libjpeg-turbo libtiff zlib eigen OpenBLAS
rm -rf ../build
mkdir ../build
cd ../build
source %{_sourcedir}/env

cmake ../%{n}-%{realversion} \
-GNinja \
Expand All @@ -30,6 +33,11 @@ cmake ../%{n}-%{realversion} \
-DPYTHON3_INCLUDE_DIR:PATH="${PYTHON3_ROOT}/include/python%{cms_python3_major_minor_version}" \
-DPYTHON3_LIBRARY:FILEPATH="${PYTHON3_ROOT}/lib/libpython%{cms_python3_major_minor_version}.so" \
-DCMAKE_BUILD_TYPE=Release \
%ifarch x86_64
-DCMAKE_CXX_FLAGS="$CMS_EIGEN_CXX_FLAGS -msse3" \
%else
-DCMAKE_CXX_FLAGS="$CMS_EIGEN_CXX_FLAGS" \
%endif
-DCMAKE_PREFIX_PATH="${LIBPNG_ROOT};${LIBTIFF_ROOT};${LIBJPEG_TURBO_ROOT};${ZLIB_ROOT};${PYTHON3_ROOT};${PY2_NUMPY_ROOT};${PY3_NUMPY_ROOT};${EIGEN_ROOT};${OPENBLAS_ROOT}"

ninja -v %{makeprocesses}
Expand Down
7 changes: 7 additions & 0 deletions pytorch.spec
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
Source: git+https://github.com/pytorch/pytorch.git?obj=%{branch}/%{tag}&export=%{n}-%{realversion}&submodules=1&output=/%{n}-%{realversion}.tgz
Source1: FindEigen3.cmake
Source2: FindFMT.cmake
Source99: scram-tools.file/tools/eigen/env
Patch0: pytorch-ignore-different-cuda-include-dir
Patch1: pytorch-missing-braces
Patch2: pytorch-system-fmt
Expand All @@ -25,6 +26,7 @@ Requires: cuda cudnn OpenBLAS zlib protobuf fmt py3-pybind11
%build
cp %{_sourcedir}/FindEigen3.cmake %{_sourcedir}/FindFMT.cmake cmake/Modules/
rm -rf ../build && mkdir ../build && cd ../build
source %{_sourcedir}/env

USE_CUDA=OFF
%if "%{cmsos}" != "slc7_aarch64"
Expand Down Expand Up @@ -74,6 +76,11 @@ cmake ../%{n}-%{realversion} \
-DUSE_SYSTEM_FXDIV=ON \
-DUSE_SYSTEM_PYBIND11=ON \
-DUSE_SYSTEM_BENCHMARK=ON \
%ifarch x86_64
-DCMAKE_CXX_FLAGS="$CMS_EIGEN_CXX_FLAGS -msse3" \
%else
-DCMAKE_CXX_FLAGS="$CMS_EIGEN_CXX_FLAGS" \
%endif
-DCMAKE_PREFIX_PATH="%{cmake_prefix_path}" \
-DPYTHON_EXECUTABLE=${PYTHON3_ROOT}/bin/python3

Expand Down
3 changes: 1 addition & 2 deletions scram-tools.file/tools/eigen/eigen.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
<environment name="INCLUDE" default="$EIGEN_BASE/include/eigen3"/>
</client>
<runtime name="ROOT_INCLUDE_PATH" value="$INCLUDE" type="path"/>
<flags CPPDEFINES="EIGEN_DONT_PARALLELIZE"/>
<flags CPPDEFINES="EIGEN_MAX_ALIGN_BYTES=64"/>
<flags CXXFLAGS="@CMS_EIGEN_CXX_FLAGS@"/>
<flags CUDA_FLAGS="--diag-suppress 20014"/>
</tool>
1 change: 1 addition & 0 deletions scram-tools.file/tools/eigen/env.file
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export CMS_EIGEN_CXX_FLAGS="-DEIGEN_DONT_PARALLELIZE -DEIGEN_MAX_ALIGN_BYTES=64"
2 changes: 2 additions & 0 deletions scram-tools.file/tools/eigen/env.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/bash -e
source ${SCRAM_TOOL_SOURCE_DIR}/env.file
3 changes: 3 additions & 0 deletions vectorization/cmsdist_packages.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
"OpenBLAS",
"rivet",
"gbl",
"lwtnn",
"opencv",
"pytorch",
]
VALID_TARGETS = {
"nehalem": "-march=nehalem",
Expand Down

0 comments on commit 1f90040

Please sign in to comment.