diff --git a/config/darwin.cmake b/config/darwin.cmake index 59f031e49f01..da5fb54d0ca5 100644 --- a/config/darwin.cmake +++ b/config/darwin.cmake @@ -52,16 +52,6 @@ set(USE_LAPACK ON CACHE BOOL "Build with lapack support") set(USE_TVM_OP OFF CACHE BOOL "Enable use of TVM operator build system.") -#--------------------- -# Compilers -#-------------------- -# Compilers are usually autodetected. Uncomment and modify the next 3 lines to -# choose manually: - -# set(CMAKE_C_COMPILER "" CACHE BOOL "C compiler") -# set(CMAKE_CXX_COMPILER "" CACHE BOOL "C++ compiler") -# set(CMAKE_CUDA_COMPILER "" CACHE BOOL "Cuda compiler (nvcc)") - #--------------------------------------------- # CPU instruction sets: The support is autodetected if turned ON diff --git a/config/linux.cmake b/config/linux.cmake index ff338231e277..6e9643fa6fed 100644 --- a/config/linux.cmake +++ b/config/linux.cmake @@ -71,14 +71,14 @@ set(USE_LAPACK ON CACHE BOOL "Build with lapack support") set(USE_TVM_OP OFF CACHE BOOL "Enable use of TVM operator build system.") #--------------------- -# Compilers +# Compiler #-------------------- -# Compilers are usually autodetected. Uncomment and modify the next 3 lines to -# choose manually: - -# set(CMAKE_C_COMPILER "" CACHE BOOL "C compiler") -# set(CMAKE_CXX_COMPILER "" CACHE BOOL "C++ compiler") -# set(CMAKE_CUDA_COMPILER "" CACHE BOOL "Cuda compiler (nvcc)") +# CPU Architecture to optimize for. With default settings, your build may not +# work on earlier CPUs than the one used by the system you are compiling on. +# To work with older CPU, set the -march, -mtune variables below to the +# respective architecture name of the target CPU (see GCC documentation). +set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -march=native -mtune=native" CACHE STRING "C compiler flags") +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=native -mtune=native" CACHE STRING "C++ compiler flags") #--------------------------------------------- diff --git a/config/linux_gpu.cmake b/config/linux_gpu.cmake index 50932d8d41d1..0508becf19e7 100644 --- a/config/linux_gpu.cmake +++ b/config/linux_gpu.cmake @@ -75,14 +75,15 @@ set(USE_LAPACK ON CACHE BOOL "Build with lapack support") set(USE_TVM_OP OFF CACHE BOOL "Enable use of TVM operator build system.") #--------------------- -# Compilers +# Compiler #-------------------- -# Compilers are usually autodetected. Uncomment and modify the next 3 lines to -# choose manually: +# CPU Architecture to optimize for. With default settings, your build may not +# work on earlier CPUs than the one used by the system you are compiling on. +# To work with older CPU, set the -march, -mtune variables below to the +# respective architecture name of the target CPU (see GCC documentation). -# set(CMAKE_C_COMPILER "" CACHE BOOL "C compiler") -# set(CMAKE_CXX_COMPILER "" CACHE BOOL "C++ compiler") -# set(CMAKE_CUDA_COMPILER "" CACHE BOOL "Cuda compiler (nvcc)") +set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -march=native -mtune=native" CACHE STRING "C compiler flags") +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=native -mtune=native" CACHE STRING "C++ compiler flags") #---------------------------------------------