Skip to content

Commit

Permalink
add option for sse4 and avs512 (#3853) (#3854)
Browse files Browse the repository at this point in the history
(cherry picked from commit 7274811)

Co-authored-by: Steve Macenski <[email protected]>
  • Loading branch information
mergify[bot] and SteveMacenski authored Oct 2, 2023
1 parent 10606c5 commit cb7340c
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion nav2_mppi_controller/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,19 @@ nav2_package()

include(CheckCXXCompilerFlag)

check_cxx_compiler_flag("-mno-avx512f" COMPILER_SUPPORTS_AVX512)
check_cxx_compiler_flag("-msse4.2" COMPILER_SUPPORTS_SSE4)
check_cxx_compiler_flag("-mavx2" COMPILER_SUPPORTS_AVX2)
check_cxx_compiler_flag("-mfma" COMPILER_SUPPORTS_FMA)

if(COMPILER_SUPPORTS_AVX512)
add_compile_options(-mno-avx512f)
endif()

if(COMPILER_SUPPORTS_SSE4)
add_compile_options(-msse4.2)
endif()

if(COMPILER_SUPPORTS_AVX2)
add_compile_options(-mavx2)
endif()
Expand All @@ -48,7 +58,7 @@ if(COMPILER_SUPPORTS_FMA)
endif()

# If building one the same hardware to be deployed on, try `-march=native`!
add_compile_options(-O3 -finline-limit=10000000 -ffp-contract=fast -ffast-math -mtune=generic -mno-avx512f)
add_compile_options(-O3 -finline-limit=10000000 -ffp-contract=fast -ffast-math -mtune=generic)

add_library(mppi_controller SHARED
src/controller.cpp
Expand Down

0 comments on commit cb7340c

Please sign in to comment.