diff --git a/cmake_targets/build_oai b/cmake_targets/build_oai index 6fb185c4a3..104c83de23 100755 --- a/cmake_targets/build_oai +++ b/cmake_targets/build_oai @@ -613,6 +613,21 @@ function main() { cd $DIR/$BUILD_DIR/build if [[ ${#CMAKE_C_FLAGS[@]} > 0 ]]; then CMAKE_CMD="$CMAKE_CMD -DCMAKE_C_FLAGS=\"${CMAKE_C_FLAGS[*]}\""; fi if [[ ${#CMAKE_CXX_FLAGS[@]} > 0 ]]; then CMAKE_CMD="$CMAKE_CMD -DCMAKE_CXX_FLAGS=\"${CMAKE_CXX_FLAGS[*]}\""; fi + + # if --noavx512 is not specified the AVX512 equals "True" by default + # override AVX512 to "False" if processor does not have avx512 + # this avoids having to specify --noavx512 systematically + if [ -f /proc/cpuinfo ]; then + if grep -q avx512 /proc/cpuinfo + then + echo_info "Processor has avx512 intrinsics" + else + echo_info "Processor does not have avx512 intrinsics" + echo_info "Forcing AVX512 to False" + AVX512="False" + fi + fi + # for historical reasons we build in a subdirectory cmake_targets/XYZ/build, # e.g., cmake_targets/ran_build/build, hence the ../../.. CMAKE_CMD="$CMAKE_CMD -DAVX512=\"${AVX512[*]}\" -DAVX2=\"${AVX2[*]}\" ../../.."