From 23d287e29e096f38feff42ff9e72c92493516659 Mon Sep 17 00:00:00 2001 From: Joris Vaillant Date: Wed, 29 Nov 2023 15:08:24 +0100 Subject: [PATCH 1/2] Add EIGENRAND_BUILD_BENCHMARK cmake option --- CMakeLists.txt | 33 ++++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 799226c..1313723 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,8 +4,10 @@ project(EigenRand VERSION 0.5.0 DESCRIPTION "EigenRand, Random Number Generator include(GNUInstallDirs) include(FetchContent) +enable_testing() option(EIGENRAND_BUILD_TEST "Build Test sets" ON) +option(EIGENRAND_BUILD_BENCHMARK "Build Benchmark sets" ON) option(EIGENRAND_CMAKE_VERBOSE "Define flags for cmake verbosity" OFF) @@ -97,20 +99,22 @@ target_include_directories(eigenrand INTERFACE ) add_library(EigenRand::EigenRand ALIAS eigenrand) -set(ITEMS - benchmark/benchmark.cpp - benchmark/benchmark_mv.cpp - benchmark/benchmark_disc.cpp - benchmark/benchmark_vectorize_over_params.cpp - benchmark/accuracy.cpp -) -foreach(app ${ITEMS}) - get_filename_component(app_name ${app} NAME_WE) - add_executable(${PROJECT_NAME}-${app_name} ${app}) - target_link_libraries(${PROJECT_NAME}-${app_name} PRIVATE eigenrand) - install(TARGETS ${PROJECT_NAME}-${app_name} DESTINATION bin) - add_test(NAME ${PROJECT_NAME}-${app_name} COMMAND ${PROJECT_NAME}-${app_name}) -endforeach() +if(EIGENRAND_BUILD_BENCHMARK) + set(ITEMS + benchmark/benchmark.cpp + benchmark/benchmark_mv.cpp + benchmark/benchmark_disc.cpp + benchmark/benchmark_vectorize_over_params.cpp + benchmark/accuracy.cpp + ) + foreach(app ${ITEMS}) + get_filename_component(app_name ${app} NAME_WE) + add_executable(${PROJECT_NAME}-${app_name} ${app}) + target_link_libraries(${PROJECT_NAME}-${app_name} PRIVATE eigenrand) + install(TARGETS ${PROJECT_NAME}-${app_name} DESTINATION bin) + add_test(NAME ${PROJECT_NAME}-${app_name} COMMAND ${PROJECT_NAME}-${app_name}) + endforeach() +endif() set(FETCHCONTENT_SOURCE_DIR_GOOGLETEST ${CMAKE_CURRENT_SOURCE_DIR}/googletest) @@ -122,7 +126,6 @@ if(EIGENRAND_BUILD_TEST) if (NOT TARGET gtest) message(STATUS FATAL_ERROR "gtest target not found, is there a problem with googltest?") endif() - enable_testing() add_subdirectory( test ) endif() From 62d1e1c07015b238cd8792246e43b43bbb285e56 Mon Sep 17 00:00:00 2001 From: Joris Vaillant Date: Fri, 1 Dec 2023 11:52:36 +0100 Subject: [PATCH 2/2] Include cstdint in MorePacketMath.h to avoid build issue with old Eigen3 release --- EigenRand/MorePacketMath.h | 1 + 1 file changed, 1 insertion(+) diff --git a/EigenRand/MorePacketMath.h b/EigenRand/MorePacketMath.h index b6ccd01..9c3fe6c 100644 --- a/EigenRand/MorePacketMath.h +++ b/EigenRand/MorePacketMath.h @@ -13,6 +13,7 @@ #define EIGENRAND_MORE_PACKET_MATH_H #include +#include #define EIGENRAND_PRINT_PACKET(p) do { using _MTy = typename std::remove_const::type>::type; typename std::conditional::value, float, typename std::conditional::value, double, int>::type>::type f[4]; Eigen::internal::pstore(f, p); std::cout << #p " " << f[0] << " " << f[1] << " " << f[2] << " " << f[3] << std::endl; } while(0)