From e881004d7666f90665aa666d5fe97a45b04cebe8 Mon Sep 17 00:00:00 2001 From: Timo Heister Date: Wed, 25 Apr 2018 11:39:17 -0400 Subject: [PATCH] add optimization option Introduce a new settings to allow native optimizations. This currently affects PETSc and deal.II (basically setting march=native). --- candi.cfg | 3 +++ deal.II-toolchain/packages/dealii.package | 11 ++++++++++- deal.II-toolchain/packages/petsc.package | 9 +++++++++ 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/candi.cfg b/candi.cfg index e36fdd5..7eb2081 100644 --- a/candi.cfg +++ b/candi.cfg @@ -28,6 +28,9 @@ MIRROR="https://tjhei.info/candi-mirror/ https://cecas.clemson.edu/dealii/mirror #Choose configuration and components of deal.II DEAL_CONFOPTS="" +# enable machine-specific optimizations (implies -march=native etc.)? +#NATIVE_OPTIMIZATIONS=true + PACKAGES="load:dealii-prepare" # These are system dependencies that are often pre-installed: diff --git a/deal.II-toolchain/packages/dealii.package b/deal.II-toolchain/packages/dealii.package index fe42bb7..c69b614 100644 --- a/deal.II-toolchain/packages/dealii.package +++ b/deal.II-toolchain/packages/dealii.package @@ -26,7 +26,16 @@ CONFOPTS=" \ -D DEAL_II_FORCE_BUNDLED_UMFPACK:BOOL=OFF \ -D DEAL_II_WITH_BOOST:BOOL=ON \ -D DEAL_II_FORCE_BUNDLED_BOOST:BOOL=OFF \ --D DEAL_II_WITH_ZLIB:BOOL=ON \ +-D DEAL_II_WITH_ZLIB:BOOL=ON" + +if [ "${NATIVE_OPTIMIZATIONS}" = "true" ]; then + CONFOPTS="${CONFOPTS} \ + -D CMAKE_CXX_FLAGS='-march=native' + " +fi + +# add the user-specified flags at the end (so things can be overriden): +CONFOPTS="${CONFOPTS} \ ${DEAL_CONFOPTS}" diff --git a/deal.II-toolchain/packages/petsc.package b/deal.II-toolchain/packages/petsc.package index 0fab51f..0821a75 100644 --- a/deal.II-toolchain/packages/petsc.package +++ b/deal.II-toolchain/packages/petsc.package @@ -37,6 +37,15 @@ CONFOPTS=" --with-64-bit-indices=0 " +if [ "${NATIVE_OPTIMIZATIONS}" = "true" ]; then + CONFOPTS="${CONFOPTS} + COPTFLAGS='-O3 -march=native -mtune=native' + CXXOPTFLAGS='-O3 -march=native -mtune=native' + FOPTFLAGS='-O3 -march=native -mtune=native' + " +fi + + for external_pkg in hypre; do CONFOPTS="${CONFOPTS} --download-${external_pkg}=1" done -- 2.39.5