@@ -18,24 +18,25 @@ include(CheckCXXCompilerFlag)
1818# Function to check if the CPU supports bmi2
1919function (check_bmi2_support)
2020 execute_process (
21- COMMAND awk " /^vendor_id/{{print \$ 3; exit}}" /proc/cpuinfo
21+ COMMAND bash -c "awk ' /^vendor_id/{{print \$ 3; exit}}' /proc/cpuinfo"
2222 OUTPUT_VARIABLE VENDOR_ID
2323 OUTPUT_STRIP_TRAILING_WHITESPACE
2424 )
2525 execute_process (
26- COMMAND awk " /^cpu family/{{print \$ 4; exit}}" /proc/cpuinfo
26+ COMMAND bash -c "awk ' /^cpu family/{{print \$ 4; exit}}' /proc/cpuinfo"
2727 OUTPUT_VARIABLE CPU_FAMILY
2828 OUTPUT_STRIP_TRAILING_WHITESPACE
2929 )
3030 execute_process (
31- COMMAND grep -o " bmi2" /proc/cpuinfo
31+ COMMAND bash -c " grep -m1 -o ' bmi2' /proc/cpuinfo"
3232 OUTPUT_VARIABLE CPU_BMI2
3333 OUTPUT_STRIP_TRAILING_WHITESPACE
3434 )
3535
36- if (VENDOR_ID STREQUAL "AuthenticAMD" )
36+ if (VENDOR_ID STREQUAL "AuthenticAMD" )
3737 if (CPU_FAMILY GREATER_EQUAL "23" AND CPU_BMI2 STREQUAL "bmi2" )
3838 set (CPU_SUPPORTS_BMI2 TRUE PARENT_SCOPE)
39+ endif ()
3940 elseif (CPU_BMI2 STREQUAL "bmi2" )
4041 set (CPU_SUPPORTS_BMI2 TRUE PARENT_SCOPE)
4142 else ()
@@ -48,6 +49,8 @@ check_bmi2_support()
4849if (CPU_SUPPORTS_BMI2)
4950 message (STATUS "Adding BMI2 support" )
5051 add_definitions (-DHAS_BMI2)
52+ else ()
53+ message (STATUS "No BMI2 support" )
5154endif ()
5255
5356add_library (training_data_loader SHARED training_data_loader.cpp)
0 commit comments