Skip to content

Commit

Permalink
Updated benchmark with directory reorg
Browse files Browse the repository at this point in the history
  • Loading branch information
hivert committed Oct 29, 2023
1 parent d2f6ef7 commit 2e2903d
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 20 deletions.
6 changes: 3 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ endif()
###################
# Project Structure
add_subdirectory(examples)
add_subdirectory(benchmark)
add_subdirectory(doc)

include_directories(
Expand All @@ -77,11 +76,12 @@ include_directories(
#########
# Testing

IF (BUILD_TESTING)
if (BUILD_TESTING)
include(CTest)
enable_testing ()
add_subdirectory(tests)
ENDIF(BUILD_TESTING)
add_subdirectory(benchmark)
endif(BUILD_TESTING)

#####################

Expand Down
6 changes: 1 addition & 5 deletions benchmark/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,7 @@ else()
message(STATUS "Using system Catch2")
endif()

message(STATUS "Building tests")

include_directories(
${CMAKE_SOURCE_DIR}/include
${PROJECT_BINARY_DIR})
message(STATUS "Building benchmark")

set(benchmark_src
bench_epu8.cpp bench_perm16.cpp bench_bmat8.cpp sort.cpp inverse.cpp)
Expand Down
19 changes: 13 additions & 6 deletions benchmark/bench_bmat8.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
// #include "compilerinfo.hpp"
// #include "cpu_x86_impl.hpp"

#include "bmat8.hpp"
#include "hpcombi/bmat8.hpp"

// using namespace FeatureDetector;
// using namespace std;
Expand Down Expand Up @@ -52,8 +52,15 @@ std::vector<std::pair<BMat8, BMat8>> make_pair_sample(size_t n) {
return res;
}

std::vector<BMat8> sample = make_sample(1000);
std::vector<std::pair<BMat8, BMat8>> pair_sample = make_pair_sample(1000);
class Fix_BMat8 {
public:
Fix_BMat8()
: sample(make_sample(1000)), pair_sample(make_pair_sample(1000)) {}
~Fix_BMat8() {}
const std::vector<BMat8> sample;
std::vector<std::pair<BMat8, BMat8>>
pair_sample; // not const, transpose2 is in place
};

// template <typename TF, typename Sample>
// void myBench(const std::string &name, TF pfunc, Sample &sample) {
Expand Down Expand Up @@ -86,21 +93,21 @@ std::vector<std::pair<BMat8, BMat8>> pair_sample = make_pair_sample(1000);
return true; \
};

TEST_CASE("Row space size benchmarks 1000 BMat8", "[BMat8][000]") {
TEST_CASE_METHOD(Fix_BMat8, "Row space size benchmarks 1000 BMat8", "[BMat8][000]") {
BENCHMARK_MEM_FN(row_space_size_ref, sample);
BENCHMARK_MEM_FN(row_space_size_bitset, sample);
BENCHMARK_MEM_FN(row_space_size_incl1, sample);
BENCHMARK_MEM_FN(row_space_size_incl, sample);
BENCHMARK_MEM_FN(row_space_size, sample);
}

TEST_CASE("Transpose benchmarks 1000 BMat8", "[BMat8][000]") {
TEST_CASE_METHOD(Fix_BMat8, "Transpose benchmarks 1000 BMat8", "[BMat8][000]") {
BENCHMARK_MEM_FN(transpose, sample);
BENCHMARK_MEM_FN(transpose_mask, sample);
BENCHMARK_MEM_FN(transpose_maskd, sample);
}

TEST_CASE("Transpose pairs benchmarks 1000 BMat8", "[BMat8][002]") {
TEST_CASE_METHOD(Fix_BMat8, "Transpose pairs benchmarks 1000 BMat8", "[BMat8][002]") {
BENCHMARK_MEM_FN_PAIR(transpose, pair_sample);
BENCHMARK_MEM_FN_PAIR(transpose_mask, pair_sample);
BENCHMARK_MEM_FN_PAIR(transpose_maskd, pair_sample);
Expand Down
2 changes: 1 addition & 1 deletion benchmark/bench_fixture.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#ifndef BENCH_FIXTURE
#define BENCH_FIXTURE

#include "epu.hpp"
#include "hpcombi/epu.hpp"

using HPCombi::epu8;

Expand Down
6 changes: 1 addition & 5 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,9 @@ endif()

message(STATUS "Building tests")

include_directories(
${CMAKE_SOURCE_DIR}/include
${CMAKE_SOURCE_DIR}/include/fallback
${PROJECT_BINARY_DIR})

set(test_src
test_epu.cpp test_perm16.cpp test_perm_all.cpp test_bmat8.cpp)

foreach(f ${test_src})
get_filename_component(testName ${f} NAME_WE)
add_executable (${testName} ${f} test_main.cpp)
Expand Down

0 comments on commit 2e2903d

Please sign in to comment.