don't set CMAKE_TUNE_FLAGS to anything by default

This commit is contained in:
Axel Kohlmeyer
2020-07-15 16:19:48 -04:00
parent bf37e6aae1
commit 73a076daf3
3 changed files with 14 additions and 23 deletions

View File

@ -69,14 +69,6 @@ if(${CMAKE_CXX_COMPILER_ID} STREQUAL "Intel")
endif() endif()
endif() endif()
if(${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU")
set(CMAKE_TUNE_DEFAULT "-march=native")
endif()
if(${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang")
set(CMAKE_TUNE_DEFAULT "-march=native")
endif()
# we require C++11 without extensions # we require C++11 without extensions
set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_STANDARD_REQUIRED ON)
@ -366,7 +358,7 @@ foreach(PKG_WITH_INCL KSPACE PYTHON VORONOI USER-COLVARS USER-MOLFILE USER-NETCD
endif() endif()
endforeach() endforeach()
set(CMAKE_TUNE_FLAGS "${CMAKE_TUNE_DEFAULT}" CACHE STRING "Compiler specific optimization or instrumentation") set(CMAKE_TUNE_FLAGS "${CMAKE_TUNE_DEFAULT}" CACHE STRING "Compiler and machine specific optimization flags (compilation only)")
separate_arguments(CMAKE_TUNE_FLAGS) separate_arguments(CMAKE_TUNE_FLAGS)
foreach(_FLAG ${CMAKE_TUNE_FLAGS}) foreach(_FLAG ${CMAKE_TUNE_FLAGS})
target_compile_options(lammps PRIVATE ${_FLAG}) target_compile_options(lammps PRIVATE ${_FLAG})

View File

@ -193,14 +193,17 @@ compiler and any :doc:`accelerator packages <Speed_packages>` you have
included in the build. included in the build.
You can tell CMake to look for a specific compiler with setting CMake You can tell CMake to look for a specific compiler with setting CMake
variable during configuration. For a few common choices, there are also variables (listed below) during configuration. For a few common
presets in the ``cmake/presets`` folder. For convenience, there is a choices, there are also presets in the ``cmake/presets`` folder. For
``CMAKE_TUNE_FLAGS`` variable that can be set to apply global compiler convenience, there is a ``CMAKE_TUNE_FLAGS`` variable that can be set to
options. More on that below, but you can also specify the corresponding apply global compiler options (applied to compilation only), to be used
``CMAKE_*_FLAGS`` variables individually if you want to experiment with for adding compiler or host specific optimization flags in addition to
alternate optimization flags. You should specify all 3 compilers, so the "flags" variables listed below. You may also specify the
that the (few) LAMMPS source files written in C or Fortran are built corresponding ``CMAKE_*_FLAGS`` variables individually, if you want to
with a compiler consistent with the one used for the C++ files: experiment with alternate optimization flags. You should specify all 3
compilers, so that the (few) LAMMPS source files written in C or Fortran
are built with a compiler consistent with the one used for the C++
files:
.. code-block:: bash .. code-block:: bash
@ -229,11 +232,7 @@ can be loaded with `-C ../cmake/presets/clang.cmake`. Similarly,
In addition you can set ``CMAKE_TUNE_FLAGS`` to specifically add In addition you can set ``CMAKE_TUNE_FLAGS`` to specifically add
compiler flags to tune for optimal performance on given hosts. By compiler flags to tune for optimal performance on given hosts. By
default these are initialized to some compiler specific flags, to default this variable is empty.
optimize the LAMMPS executable with optimizations and instructions
available on the host where LAMMPS is compiled. For example, for Intel
compilers this would be ``-xHost`` and for GNU compilers this would be
``-march=native``. To turn these flags off, do ``-D CMAKE_TUNE_FLAGS=``.
.. note:: .. note::

View File

@ -331,7 +331,7 @@ Some common LAMMPS specific variables
* - ``BUILD_DOC`` * - ``BUILD_DOC``
- include building the HTML format documentation for packaging/installing (default: ``off``) - include building the HTML format documentation for packaging/installing (default: ``off``)
* - ``CMAKE_TUNE_FLAGS`` * - ``CMAKE_TUNE_FLAGS``
- common compiler flags, for optimization or instrumentation (default: compiler specific) - common compiler flags, for optimization or instrumentation (default:)
* - ``LAMMPS_MACHINE`` * - ``LAMMPS_MACHINE``
- when set to ``name`` the LAMMPS executable and library will be called ``lmp_name`` and ``liblammps_name.a`` - when set to ``name`` the LAMMPS executable and library will be called ``lmp_name`` and ``liblammps_name.a``
* - ``LAMMPS_EXCEPTIONS`` * - ``LAMMPS_EXCEPTIONS``