From c904f629a1eae59f605d50b2846bbc95dd9c2488 Mon Sep 17 00:00:00 2001
From: Lars Bilke <lars.bilke@ufz.de>
Date: Mon, 4 Oct 2021 11:26:45 +0200
Subject: [PATCH] [cmake] Removed option OGS_ENABLE_AVX2.

---
 CMakeLists.txt                                             | 1 -
 scripts/cmake/CompilerSetup.cmake                          | 7 +------
 .../docs/devguide/environments/redistributable-builds.md   | 2 --
 3 files changed, 1 insertion(+), 9 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 58e01a94056..e27e006623f 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -28,7 +28,6 @@ set(CMAKE_LIBRARY_SEARCH_PATH ""
 set(OGS_CPU_ARCHITECTURE "native" CACHE STRING "Processor architecture, \
     defaults to native (*nix) / blend (MSVC)."
 )
-option(OGS_ENABLE_AVX2 "Enable the use of AVX2 instructions" OFF)
 option(OGS_USE_CONAN "Should Conan package manager be used?" ON)
 set(OGS_CONAN_BUILD "missing" CACHE STRING "Possible values: all, missing, \
     never or list of libs to build"
diff --git a/scripts/cmake/CompilerSetup.cmake b/scripts/cmake/CompilerSetup.cmake
index 1de8c3c7664..f1f7fc023de 100644
--- a/scripts/cmake/CompilerSetup.cmake
+++ b/scripts/cmake/CompilerSetup.cmake
@@ -71,9 +71,7 @@ if(COMPILER_IS_GCC OR COMPILER_IS_CLANG OR COMPILER_IS_INTEL)
         add_compile_options(${PROFILE_ARGS})
     endif()
 
-    if(OGS_ENABLE_AVX2)
-        set(CPU_FLAGS -mavx2 -march=core-avx2)
-    elseif(OGS_CPU_ARCHITECTURE STREQUAL "generic")
+    if(OGS_CPU_ARCHITECTURE STREQUAL "generic")
         set(CPU_FLAGS -mtune=generic)
     elseif(NOT APPLE_ARM AND OGS_CPU_ARCHITECTURE)
         set(CPU_FLAGS -march=${OGS_CPU_ARCHITECTURE})
@@ -152,9 +150,6 @@ if(MSVC)
     else()
         set(CPU_FLAGS /favor:${OGS_CPU_ARCHITECTURE})
     endif()
-    if(OGS_ENABLE_AVX2)
-        set(CPU_FLAGS ${CPU_FLAGS} /arch:AVX2)
-    endif()
     add_compile_options(
         /MP # multi-core compilation
         /wd4290
diff --git a/web/content/docs/devguide/environments/redistributable-builds.md b/web/content/docs/devguide/environments/redistributable-builds.md
index af6ce0b8c2c..70a1048a995 100644
--- a/web/content/docs/devguide/environments/redistributable-builds.md
+++ b/web/content/docs/devguide/environments/redistributable-builds.md
@@ -27,7 +27,6 @@ If a binary runs on a different machine depends on a lot of factors. The followi
 ### Optimization CMake options
 
 - `OGS_CPU_ARCHITECTURE`: possible values `AMD64` or `INTEL64` (sets `/favor:{AMD64 | INTEL64}` flag)
-- `OGS_ENABLE_AVX2`: boolean (sets `/arch:AVX2` when set to true), requires at least [Intel Haswell or AMD Excavator-based processors](https://msdn.microsoft.com/en-us//library/7t5yh4fd.aspx)
 </div>
 
 <div class='linux'>
@@ -45,7 +44,6 @@ If a binary runs on a different machine depends on a lot of factors. The followi
 #### For optimization
 
 - `OGS_CPU_ARCHITECTURE`: tot to `native` for best optimization for your current cpu, possible values are [listed here](https://stackoverflow.com/a/25095818/80480), more info on [gcc docs](https://gcc.gnu.org/onlinedocs/gcc/x86-Options.html#index-mtune-15)
-- `OGS_ENABLE_AVX2`: boolean (sets `-march=core-avx2` when set to true), requires at least Haswell processors
 </div>
 
 <div class='mac'>
-- 
GitLab