Commit 99e02417 authored by Jaikrishnan Menon's avatar Jaikrishnan Menon Committed by Robert Kimball

CMake: Allow build target arch to be overridden (#859)

* CMake: Allow build target arch to be overridden

* Add DNGRAPH_TARGET_ARCH option to install docs
parent 16571afd
......@@ -111,8 +111,14 @@ endif()
SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-g")
SET(CMAKE_CXX_FLAGS_DEBUG "-O0 -g")
# Enable native CPU features
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=native")
# Enable build target CPU features
set(NGRAPH_TARGET_ARCH native CACHE STRING "Target CPU architecture to build for. Defaults to the native CPU architecture")
if (NOT "${NGRAPH_TARGET_ARCH}" STREQUAL "native")
message(WARNING "Build target architecture was overridden. The resulting build might not work correctly on the host CPU.")
endif()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=${NGRAPH_TARGET_ARCH}")
# flags required for SDL-3
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O2 -fPIE -D_FORTIFY_SOURCE=2")
......
......@@ -80,7 +80,10 @@ The process documented here will work on Ubuntu\* 16.04 (LTS)
#. Generate the GNUMakefiles in the customary manner (from within the
``build`` directory). If running ``gcc-5.4.0`` or ``clang-3.9``, remember
that you can also append ``cmake`` with the prebuilt LLVM option to
speed-up the build:
speed-up the build. Another option if your deployment system has Intel®
Advanced Vector Extensions (Intel® AVX) is to target the accelerations
available directly by compiling the build as follows during the cmake
step: ``-DNGRAPH_TARGET_ARCH=skylake-avx512``.
.. code-block:: console
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment