From e80601b216f2525821e4ff85737c5072749fa668 Mon Sep 17 00:00:00 2001 From: Enrico Seiler Date: Fri, 13 Dec 2024 17:00:37 +0100 Subject: [PATCH] [INFRA] Use SDE to emulate AVX512 in tests --- test/unit/CMakeLists.txt | 13 +++++-------- test/unit/hibf/CMakeLists.txt | 17 +++++++++++++++-- 2 files changed, 20 insertions(+), 10 deletions(-) diff --git a/test/unit/CMakeLists.txt b/test/unit/CMakeLists.txt index 5f91a718..09b5af49 100644 --- a/test/unit/CMakeLists.txt +++ b/test/unit/CMakeLists.txt @@ -12,13 +12,12 @@ include (diagnostics/list_missing_unit_tests) include (diagnostics/list_unused_unit_tests) include (include_dependencies/add_include_dependencies) -option (HIBF_VERBOSE_TESTS "Run each test case individually" OFF) option (HIBF_USE_INCLUDE_DEPENDENCIES "Build tests in an hierarchical order (by an include graph, i.e. tests with less dependencies are build first)" OFF) macro (hibf_test unit_test_cpp) - cmake_parse_arguments (HIBF_TEST "" "" "CYCLIC_DEPENDING_INCLUDES" ${ARGN}) + cmake_parse_arguments (HIBF_TEST "" "SDE" "CYCLIC_DEPENDING_INCLUDES" ${ARGN}) file (RELATIVE_PATH unit_test "${CMAKE_SOURCE_DIR}" "${CMAKE_CURRENT_LIST_DIR}/${unit_test_cpp}") hibf_test_component (target "${unit_test}" TARGET_NAME) @@ -28,12 +27,10 @@ macro (hibf_test unit_test_cpp) target_link_libraries (${target} hibf::test::unit) add_include_dependencies (${target} "${HIBF_TEST_CYCLIC_DEPENDING_INCLUDES}") collect_used_test (${target}) - if (HIBF_VERBOSE_TESTS) - gtest_discover_tests ( - ${target} - TEST_PREFIX "${test_name}::" - PROPERTIES - TIMEOUT "30") + + if (HIBF_TEST_SDE) + set (TARGET_WITH_SDE "${HIBF_TEST_SDE}" "-cnl" "--" "./${target}") + add_test (NAME "${test_name}_sde" COMMAND ${TARGET_WITH_SDE}) else () add_test (NAME "${test_name}" COMMAND ${target}) endif () diff --git a/test/unit/hibf/CMakeLists.txt b/test/unit/hibf/CMakeLists.txt index 49da8e71..67354cfe 100644 --- a/test/unit/hibf/CMakeLists.txt +++ b/test/unit/hibf/CMakeLists.txt @@ -7,11 +7,24 @@ add_subdirectories () hibf_test (bit_vector_test.cpp) hibf_test (config_test.cpp) hibf_test (counting_vector_test.cpp) -hibf_test (counting_vector_avx512_test.cpp) hibf_test (hierarchical_interleaved_bloom_filter_test.cpp) hibf_test (insert_iterator_test.cpp) hibf_test (interleaved_bloom_filter_test.cpp) -hibf_test (interleaved_bloom_filter_avx512_test.cpp) hibf_test (path_test.cpp) hibf_test (print_test.cpp) hibf_test (timer_test.cpp) + +# If available, use Intel's Software Development Emulator (SDE) to emulate AVX-512 instructions. +# See https://www.intel.com/content/www/us/en/developer/articles/tool/software-development-emulator.html +find_program (SDE64_BIN sde64) + +if (SDE64_BIN) + hibf_test (counting_vector_avx512_test.cpp SDE "${SDE64_BIN}") + target_compile_options (counting_vector_avx512_test PRIVATE -mavx512bw -mavx512f) + + hibf_test (interleaved_bloom_filter_avx512_test.cpp SDE "${SDE64_BIN}") + target_compile_options (interleaved_bloom_filter_avx512_test PRIVATE -mavx512bw -mavx512f) +else () + hibf_test (counting_vector_avx512_test.cpp) + hibf_test (interleaved_bloom_filter_avx512_test.cpp) +endif ()