From da77ff2b7d50ba21264c833130e5b9a28f0c516d Mon Sep 17 00:00:00 2001 From: Tomer Even Date: Fri, 18 Mar 2022 12:17:23 +0200 Subject: [PATCH] First commit --- .clang-format | 66 + .idea/.gitignore | 8 + .idea/.name | 1 + .idea/Public-PF.iml | 2 + .idea/codeStyles/Project.xml | 14 + .idea/codeStyles/codeStyleConfig.xml | 5 + .idea/misc.xml | 4 + .idea/modules.xml | 8 + .idea/vcs.xml | 6 + Bloom_Filter/Impala512.h | 210 ++ Bloom_Filter/bloom.hpp | 453 +++ Bloom_Filter/simd-block-fixed-fpp.h | 500 ++++ Bloom_Filter/simd-block.h | 152 + CMakeLists.txt | 116 + LICENSE.md | 13 + Prefix-Filter/Shift_op.cpp | 2539 +++++++++++++++++ Prefix-Filter/Shift_op.hpp | 2148 ++++++++++++++ Prefix-Filter/min_pd256.cpp | 41 + Prefix-Filter/min_pd256.hpp | 549 ++++ README.md | 108 + RunAll.sh | 33 + TC-Shortcut/TC-shortcut.hpp | 309 ++ TC-Shortcut/tc-sym.cpp | 135 + TC-Shortcut/tc-sym.hpp | 733 +++++ Tests/PerfEvent.hpp | 266 ++ Tests/smart_tests.cpp | 171 ++ Tests/smart_tests.hpp | 688 +++++ Tests/wrappers.hpp | 959 +++++++ .../.cmake/api/v1/query/cache-v2 | 0 .../.cmake/api/v1/query/cmakeFiles-v1 | 0 .../.cmake/api/v1/query/codemodel-v2 | 0 .../.cmake/api/v1/query/toolchains-v1 | 0 .../reply/cache-v2-2dd2a3e80239b44d83cc.json | 1147 ++++++++ .../cmakeFiles-v1-eb5f60b98dcb2065ce32.json | 729 +++++ .../codemodel-v2-5879e526388a2efa61dd.json | 150 + ...irectory-.-Debug-f5ebdc15457944623624.json | 14 + .../reply/index-2022-03-18T10-15-38-0219.json | 108 + ...et-example-Debug-f2fd9bd66abbfca03f37.json | 271 ++ ...t-example0-Debug-722e45bf24620d8a1287.json | 275 ++ ...sure_built-Debug-0ba116b65bf3d7ab6884.json | 271 ++ ...ure_built0-Debug-1c26e7153ab9b4dbb397.json | 275 ++ ...ure_built3-Debug-9e60f0edabd112451332.json | 271 ++ ...easure_fpp-Debug-6218804baa2d893c8235.json | 271 ++ ...asure_fpp0-Debug-ae3e716da61914872325.json | 275 ++ ...asure_fpp3-Debug-12090f7133d04d45c993.json | 271 ++ ...asure_perf-Debug-a7f31f032634834b67c5.json | 271 ++ ...sure_perf0-Debug-b41767523d8bde5ed7bd.json | 275 ++ ...sure_perf3-Debug-1815e855f242cbd76a5a.json | 271 ++ .../toolchains-v1-b0b7064a037a803f7bb5.json | 107 + cmake-build-debug/CMakeCache.txt | 362 +++ .../CMakeFiles/3.21.1/CMakeCCompiler.cmake | 80 + .../CMakeFiles/3.21.1/CMakeCXXCompiler.cmake | 91 + .../3.21.1/CMakeDetermineCompilerABI_C.bin | Bin 0 -> 16656 bytes .../3.21.1/CMakeDetermineCompilerABI_CXX.bin | Bin 0 -> 16672 bytes .../CMakeFiles/3.21.1/CMakeSystem.cmake | 15 + .../3.21.1/CompilerIdC/CMakeCCompilerId.c | 807 ++++++ .../CMakeFiles/3.21.1/CompilerIdC/a.out | Bin 0 -> 16704 bytes .../CompilerIdCXX/CMakeCXXCompilerId.cpp | 795 ++++++ .../CMakeFiles/3.21.1/CompilerIdCXX/a.out | Bin 0 -> 16712 bytes cmake-build-debug/CMakeFiles/CMakeOutput.log | 427 +++ .../CMakeFiles/TargetDirectories.txt | 13 + .../CMakeFiles/clion-environment.txt | Bin 0 -> 169 bytes cmake-build-debug/CMakeFiles/clion-log.txt | 16 + .../CMakeFiles/cmake.check_cache | 1 + cmake-build-debug/CMakeFiles/rules.ninja | 254 ++ .../Testing/Temporary/LastTest.log | 3 + cmake-build-debug/build.ninja | 925 ++++++ cmake-build-debug/cmake_install.cmake | 54 + cuckoofilter/.clang-format | 95 + cuckoofilter/.gitignore | 11 + cuckoofilter/LICENSE | 13 + cuckoofilter/Makefile | 43 + cuckoofilter/README.md | 93 + cuckoofilter/benchmarks/Makefile | 23 + .../benchmarks/bulk-insert-and-query.cc | 255 ++ cuckoofilter/benchmarks/conext-figure5.cc | 84 + cuckoofilter/benchmarks/conext-table3.cc | 91 + cuckoofilter/benchmarks/random.h | 45 + cuckoofilter/benchmarks/timing.h | 12 + cuckoofilter/example/test.cc | 52 + cuckoofilter/src/bitsutil.h | 35 + cuckoofilter/src/cuckoofilter.h | 267 ++ cuckoofilter/src/cuckoofilter_stable.h | 271 ++ cuckoofilter/src/debug.h | 54 + cuckoofilter/src/hashutil.cc | 782 +++++ cuckoofilter/src/hashutil.h | 115 + cuckoofilter/src/packedtable.h | 438 +++ cuckoofilter/src/permencoding.h | 88 + cuckoofilter/src/printutil.cc | 24 + cuckoofilter/src/printutil.h | 32 + cuckoofilter/src/simd-block-fixed-fpp.h | 488 ++++ cuckoofilter/src/simd-block.h | 141 + cuckoofilter/src/singletable.h | 268 ++ example.cpp | 20 + hashutil.h | 289 ++ main-built.cpp | 85 + main-fpp.cpp | 71 + main-perf.cpp | 67 + scripts/Generate-median-csv.py | 338 +++ scripts/Naming.py | 59 + scripts/__pycache__/Naming.cpython-38.pyc | Bin 0 -> 1752 bytes scripts/arg-plotter.py | 640 +++++ scripts/build-csv-parser.py | 133 + scripts/fpp-parser-server.py | 108 + 104 files changed, 24962 insertions(+) create mode 100644 .clang-format create mode 100644 .idea/.gitignore create mode 100644 .idea/.name create mode 100644 .idea/Public-PF.iml create mode 100644 .idea/codeStyles/Project.xml create mode 100644 .idea/codeStyles/codeStyleConfig.xml create mode 100644 .idea/misc.xml create mode 100644 .idea/modules.xml create mode 100644 .idea/vcs.xml create mode 100644 Bloom_Filter/Impala512.h create mode 100644 Bloom_Filter/bloom.hpp create mode 100644 Bloom_Filter/simd-block-fixed-fpp.h create mode 100644 Bloom_Filter/simd-block.h create mode 100644 CMakeLists.txt create mode 100644 LICENSE.md create mode 100644 Prefix-Filter/Shift_op.cpp create mode 100644 Prefix-Filter/Shift_op.hpp create mode 100644 Prefix-Filter/min_pd256.cpp create mode 100644 Prefix-Filter/min_pd256.hpp create mode 100644 README.md create mode 100755 RunAll.sh create mode 100644 TC-Shortcut/TC-shortcut.hpp create mode 100644 TC-Shortcut/tc-sym.cpp create mode 100644 TC-Shortcut/tc-sym.hpp create mode 100644 Tests/PerfEvent.hpp create mode 100644 Tests/smart_tests.cpp create mode 100644 Tests/smart_tests.hpp create mode 100644 Tests/wrappers.hpp create mode 100644 cmake-build-debug/.cmake/api/v1/query/cache-v2 create mode 100644 cmake-build-debug/.cmake/api/v1/query/cmakeFiles-v1 create mode 100644 cmake-build-debug/.cmake/api/v1/query/codemodel-v2 create mode 100644 cmake-build-debug/.cmake/api/v1/query/toolchains-v1 create mode 100644 cmake-build-debug/.cmake/api/v1/reply/cache-v2-2dd2a3e80239b44d83cc.json create mode 100644 cmake-build-debug/.cmake/api/v1/reply/cmakeFiles-v1-eb5f60b98dcb2065ce32.json create mode 100644 cmake-build-debug/.cmake/api/v1/reply/codemodel-v2-5879e526388a2efa61dd.json create mode 100644 cmake-build-debug/.cmake/api/v1/reply/directory-.-Debug-f5ebdc15457944623624.json create mode 100644 cmake-build-debug/.cmake/api/v1/reply/index-2022-03-18T10-15-38-0219.json create mode 100644 cmake-build-debug/.cmake/api/v1/reply/target-example-Debug-f2fd9bd66abbfca03f37.json create mode 100644 cmake-build-debug/.cmake/api/v1/reply/target-example0-Debug-722e45bf24620d8a1287.json create mode 100644 cmake-build-debug/.cmake/api/v1/reply/target-measure_built-Debug-0ba116b65bf3d7ab6884.json create mode 100644 cmake-build-debug/.cmake/api/v1/reply/target-measure_built0-Debug-1c26e7153ab9b4dbb397.json create mode 100644 cmake-build-debug/.cmake/api/v1/reply/target-measure_built3-Debug-9e60f0edabd112451332.json create mode 100644 cmake-build-debug/.cmake/api/v1/reply/target-measure_fpp-Debug-6218804baa2d893c8235.json create mode 100644 cmake-build-debug/.cmake/api/v1/reply/target-measure_fpp0-Debug-ae3e716da61914872325.json create mode 100644 cmake-build-debug/.cmake/api/v1/reply/target-measure_fpp3-Debug-12090f7133d04d45c993.json create mode 100644 cmake-build-debug/.cmake/api/v1/reply/target-measure_perf-Debug-a7f31f032634834b67c5.json create mode 100644 cmake-build-debug/.cmake/api/v1/reply/target-measure_perf0-Debug-b41767523d8bde5ed7bd.json create mode 100644 cmake-build-debug/.cmake/api/v1/reply/target-measure_perf3-Debug-1815e855f242cbd76a5a.json create mode 100644 cmake-build-debug/.cmake/api/v1/reply/toolchains-v1-b0b7064a037a803f7bb5.json create mode 100644 cmake-build-debug/CMakeCache.txt create mode 100644 cmake-build-debug/CMakeFiles/3.21.1/CMakeCCompiler.cmake create mode 100644 cmake-build-debug/CMakeFiles/3.21.1/CMakeCXXCompiler.cmake create mode 100755 cmake-build-debug/CMakeFiles/3.21.1/CMakeDetermineCompilerABI_C.bin create mode 100755 cmake-build-debug/CMakeFiles/3.21.1/CMakeDetermineCompilerABI_CXX.bin create mode 100644 cmake-build-debug/CMakeFiles/3.21.1/CMakeSystem.cmake create mode 100644 cmake-build-debug/CMakeFiles/3.21.1/CompilerIdC/CMakeCCompilerId.c create mode 100755 cmake-build-debug/CMakeFiles/3.21.1/CompilerIdC/a.out create mode 100644 cmake-build-debug/CMakeFiles/3.21.1/CompilerIdCXX/CMakeCXXCompilerId.cpp create mode 100755 cmake-build-debug/CMakeFiles/3.21.1/CompilerIdCXX/a.out create mode 100644 cmake-build-debug/CMakeFiles/CMakeOutput.log create mode 100644 cmake-build-debug/CMakeFiles/TargetDirectories.txt create mode 100644 cmake-build-debug/CMakeFiles/clion-environment.txt create mode 100644 cmake-build-debug/CMakeFiles/clion-log.txt create mode 100644 cmake-build-debug/CMakeFiles/cmake.check_cache create mode 100644 cmake-build-debug/CMakeFiles/rules.ninja create mode 100644 cmake-build-debug/Testing/Temporary/LastTest.log create mode 100644 cmake-build-debug/build.ninja create mode 100644 cmake-build-debug/cmake_install.cmake create mode 100644 cuckoofilter/.clang-format create mode 100644 cuckoofilter/.gitignore create mode 100644 cuckoofilter/LICENSE create mode 100644 cuckoofilter/Makefile create mode 100644 cuckoofilter/README.md create mode 100644 cuckoofilter/benchmarks/Makefile create mode 100644 cuckoofilter/benchmarks/bulk-insert-and-query.cc create mode 100644 cuckoofilter/benchmarks/conext-figure5.cc create mode 100644 cuckoofilter/benchmarks/conext-table3.cc create mode 100644 cuckoofilter/benchmarks/random.h create mode 100644 cuckoofilter/benchmarks/timing.h create mode 100644 cuckoofilter/example/test.cc create mode 100644 cuckoofilter/src/bitsutil.h create mode 100644 cuckoofilter/src/cuckoofilter.h create mode 100644 cuckoofilter/src/cuckoofilter_stable.h create mode 100644 cuckoofilter/src/debug.h create mode 100644 cuckoofilter/src/hashutil.cc create mode 100644 cuckoofilter/src/hashutil.h create mode 100644 cuckoofilter/src/packedtable.h create mode 100644 cuckoofilter/src/permencoding.h create mode 100644 cuckoofilter/src/printutil.cc create mode 100644 cuckoofilter/src/printutil.h create mode 100644 cuckoofilter/src/simd-block-fixed-fpp.h create mode 100644 cuckoofilter/src/simd-block.h create mode 100644 cuckoofilter/src/singletable.h create mode 100644 example.cpp create mode 100644 hashutil.h create mode 100644 main-built.cpp create mode 100644 main-fpp.cpp create mode 100644 main-perf.cpp create mode 100755 scripts/Generate-median-csv.py create mode 100644 scripts/Naming.py create mode 100644 scripts/__pycache__/Naming.cpython-38.pyc create mode 100755 scripts/arg-plotter.py create mode 100755 scripts/build-csv-parser.py create mode 100755 scripts/fpp-parser-server.py diff --git a/.clang-format b/.clang-format new file mode 100644 index 0000000..42463e8 --- /dev/null +++ b/.clang-format @@ -0,0 +1,66 @@ +# Generated from CLion C/C++ Code Style settings +BasedOnStyle: LLVM +AccessModifierOffset: -4 +AlignAfterOpenBracket: Align +AlignConsecutiveAssignments: false +AlignOperands: true +AllowAllArgumentsOnNextLine: false +AllowAllConstructorInitializersOnNextLine: false +AllowAllParametersOfDeclarationOnNextLine: false +AllowShortBlocksOnASingleLine: Always +AllowShortCaseLabelsOnASingleLine: false +AllowShortFunctionsOnASingleLine: All +AllowShortIfStatementsOnASingleLine: Always +AllowShortLambdasOnASingleLine: All +AllowShortLoopsOnASingleLine: true +AlwaysBreakAfterReturnType: None +AlwaysBreakTemplateDeclarations: Yes +BreakBeforeBraces: Custom +BraceWrapping: + AfterCaseLabel: false + AfterClass: false + AfterControlStatement: Never + AfterEnum: false + AfterFunction: false + AfterNamespace: false + AfterUnion: false + BeforeCatch: false + BeforeElse: false + IndentBraces: false + SplitEmptyFunction: false + SplitEmptyRecord: true +BreakBeforeBinaryOperators: None +BreakBeforeTernaryOperators: true +BreakConstructorInitializers: BeforeColon +BreakInheritanceList: BeforeColon +ColumnLimit: 0 +CompactNamespaces: false +ContinuationIndentWidth: 8 +IndentCaseLabels: true +IndentPPDirectives: None +IndentWidth: 4 +KeepEmptyLinesAtTheStartOfBlocks: true +MaxEmptyLinesToKeep: 2 +NamespaceIndentation: All +ObjCSpaceAfterProperty: false +ObjCSpaceBeforeProtocolList: true +PointerAlignment: Right +ReflowComments: false +SpaceAfterCStyleCast: true +SpaceAfterLogicalNot: false +SpaceAfterTemplateKeyword: false +SpaceBeforeAssignmentOperators: true +SpaceBeforeCpp11BracedList: false +SpaceBeforeCtorInitializerColon: true +SpaceBeforeInheritanceColon: true +SpaceBeforeParens: ControlStatements +SpaceBeforeRangeBasedForLoopColon: true +SpaceInEmptyParentheses: false +SpacesBeforeTrailingComments: 0 +SpacesInAngles: false +SpacesInCStyleCastParentheses: false +SpacesInContainerLiterals: false +SpacesInParentheses: false +SpacesInSquareBrackets: false +TabWidth: 4 +UseTab: Never diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..13566b8 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,8 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Editor-based HTTP Client requests +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/.idea/.name b/.idea/.name new file mode 100644 index 0000000..95731c1 --- /dev/null +++ b/.idea/.name @@ -0,0 +1 @@ +APD_ONLY \ No newline at end of file diff --git a/.idea/Public-PF.iml b/.idea/Public-PF.iml new file mode 100644 index 0000000..f08604b --- /dev/null +++ b/.idea/Public-PF.iml @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/.idea/codeStyles/Project.xml b/.idea/codeStyles/Project.xml new file mode 100644 index 0000000..91a5135 --- /dev/null +++ b/.idea/codeStyles/Project.xml @@ -0,0 +1,14 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/codeStyles/codeStyleConfig.xml b/.idea/codeStyles/codeStyleConfig.xml new file mode 100644 index 0000000..79ee123 --- /dev/null +++ b/.idea/codeStyles/codeStyleConfig.xml @@ -0,0 +1,5 @@ + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..79b3c94 --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..ea29bce --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/Bloom_Filter/Impala512.h b/Bloom_Filter/Impala512.h new file mode 100644 index 0000000..244bf74 --- /dev/null +++ b/Bloom_Filter/Impala512.h @@ -0,0 +1,210 @@ +// Copied from Apache Impala (incubating), usable under the terms in the Apache License, +// Version 2.0. + +// This is a block Bloom filter (from Putze et al.'s "Cache-, Hash- and Space-Efficient +// Bloom Filters") with some twists: +// +// 1. Each block is a split Bloom filter - see Section 2.1 of Broder and Mitzenmacher's +// "Network Applications of Bloom Filters: A Survey". +// +// 2. The number of bits set per Add() is contant in order to take advantage of SIMD +// instructions. + +#pragma once + +#include +#include + +#include +#include + +#include "../hashutil.h" + + +using uint32_t = ::std::uint32_t; +using uint64_t = ::std::uint64_t; + +namespace Impala { + __attribute__((always_inline)) inline uint32_t reduce(uint32_t hash, uint32_t n) { + // http://lemire.me/blog/2016/06/27/a-fast-alternative-to-the-modulo-reduction/ + return (uint32_t) (((uint64_t) hash * n) >> 32); + } + + __attribute__((always_inline)) inline uint64_t reduce64(uint64_t hash, uint64_t n) { + // return hash % n; + // http://lemire.me/blog/2016/06/27/a-fast-alternative-to-the-modulo-reduction/ + return (uint64_t) (((__uint128_t) hash * (__uint128_t) n) >> 64); + // return (uint32_t) (((uint64_t) hash * n) >> 32); + } + + static inline uint64_t rotl64(uint64_t n, unsigned int c) { + // assumes width is a power of 2 + const unsigned int mask = (CHAR_BIT * sizeof(n) - 1); + // assert ( (c<=mask) &&"rotate by type width or more"); + c &= mask; + return (n << c) | (n >> ((-c) & mask)); + } + + static inline size_t get_number_of_buckets(size_t max_items) { + constexpr size_t log2_one_over_eps = 8; + constexpr double overhead = 1.5225; + constexpr size_t bucket_size_in_bits = 512; + size_t blooms_m = std::ceil(max_items * log2_one_over_eps * overhead); + size_t number_of_buckets = (blooms_m + bucket_size_in_bits - 1) / bucket_size_in_bits; + return number_of_buckets; + } +}// namespace Impala + +#include + +template +class Impala512 { +private: + // The filter is divided up into Buckets: + using Bucket = uint64_t[8]; + + const int bucketCount; + + Bucket *directory_; + + HashFamily hasher_; + +public: + // Consumes at most (1 << log_heap_space) bytes on the heap: + explicit Impala512(const int bits); + + ~Impala512() noexcept; + + void Add(const uint64_t key) noexcept; + + bool Find(const uint64_t key) const noexcept; + + uint64_t SizeInBytes() const { return sizeof(Bucket) * bucketCount; } + + size_t get_cap() const noexcept { + return -1; + } + float density() const noexcept { + size_t set_bits = 0; + for (int i = 0; i < bucketCount; i++) { + uint64_t temp; + memcpy(&temp, directory_+ i, 8); + set_bits += _mm_popcnt_u64(temp); + } + float res = 1.0 * set_bits / (bucketCount * 64); + return res; + } + +private: + // A helper function for Insert()/Find(). Turns a 64-bit hash into a 512-bit Bucket + // with 1 single 1-bit set in each 32-bit lane. + static __m512i MakeMask(const uint64_t hash) noexcept; +}; + +template +Impala512::Impala512(const int n) + : bucketCount(Impala::get_number_of_buckets(n)), + directory_(nullptr), + hasher_() { + if (!__builtin_cpu_supports("avx2")) { + throw ::std::runtime_error("Impala512 does not work without AVX2 instructions"); + } + const size_t alloc_size = bucketCount * sizeof(Bucket); + const int malloc_failed = + posix_memalign(reinterpret_cast(&directory_), 64, alloc_size); + if (malloc_failed) throw ::std::bad_alloc(); + // std::cout << "Ctor: SIMD-fixed byte size: " << SizeInBytes() << std::endl; + memset(directory_, 0, alloc_size); +} + +template +Impala512::~Impala512() noexcept { + // std::cout << "Dtor: SIMD-fixed byte size: " << SizeInBytes() << std::endl; + // std::cout << "density: " << density() << std::endl; + free(directory_); + directory_ = nullptr; +} + +// The SIMD reinterpret_casts technically violate C++'s strict aliasing rules. However, we +// compile with -fno-strict-aliasing. +template +[[gnu::always_inline]] inline __m512i +Impala512::MakeMask(const uint64_t hash) noexcept { + const __m512i ones = _mm512_set1_epi64(1); + // Odd contants for hashing: + const __m512i rehash = _mm512_setr_epi64(0x89cdc1c02b2352b9ULL, + 0x2b9aed3c5d9c5085ULL, + 0xfb087273c257911bULL, + 0x5ffd7847830af377ULL, + 0x287348157aed6753ULL, + 0x4e7292d5d251e97dULL, + 0xe00e4fc1185d71cbULL, + 0x4e3ebc18dc4c950bULL); + // const __m512i rehash = _mm512_setr_epi64(0x47b6137bU, 0x44974d91U, 0x8824ad5bU, 0xa2b7289dU, 0x705495c7U, 0x2df1424bU, 0x9efc4947U, 0x5c6bfb31U); + // Load hash into a YMM register, repeated eight times + __m512i hash_data = _mm512_set1_epi64(hash); + // Multiply-shift hashing ala Dietzfelbinger et al.: multiply 'hash' by eight different + // odd constants, then keep the 5 most significant bits from each product. + hash_data = _mm512_mullo_epi64(rehash, hash_data); + hash_data = _mm512_srli_epi64(hash_data, 64 - 6); + // Use these 5 bits to shift a single bit to a location in each 32-bit lane + /* #ifndef DNDEBUG + uint64_t a[8] = {0}; + memcpy(a, (uint64_t *) (&hash_data), 64); + if ((hash & ((1ULL<<20)-1)) == 0){ + std::cout << "hash: " << hash << std::endl; + for (size_t i = 0; i < 8; i++) { + std::cout << "a[i]: " << a[i] << std::endl; + } + } + auto temp = _mm512_sllv_epi64(ones, hash_data); + + // uint64_t a[8] = {0}; + memcpy(a, (uint64_t *) (&temp), 64); + int s = 0; + for (size_t i = 0; i < 8; i++) { + auto block_temp = _mm_popcnt_u64(a[i]); + assert(block_temp == 1); + s += _mm_popcnt_u64(a[i]); + } + if (s != 8) { + std::cout << "s: " << s << std::endl; + for (size_t i = 0; i < 8; i++) { + std::cout << "a[i]: " << a[i] << std::endl; + } + } + assert(s == 8); +#endif + */ + return _mm512_sllv_epi64(ones, hash_data); +} + +template +[[gnu::always_inline]] inline void +Impala512::Add(const uint64_t key) noexcept { + const auto hash = hasher_(key); + const uint32_t bucket_idx = Impala::reduce(Impala::rotl64(hash, 32), bucketCount); + // const uint32_t bucket_idx = Impala::reduce64(hash, bucketCount); + const __m512i mask = MakeMask(hash); + __m512i *const bucket = &reinterpret_cast<__m512i *>(directory_)[bucket_idx]; + _mm512_store_si512(bucket, _mm512_or_si512(*bucket, mask)); + assert(Find(key)); +} + +template +[[gnu::always_inline]] inline bool +Impala512::Find(const uint64_t key) const noexcept { + const auto hash = hasher_(key); + // const uint32_t bucket_idx = Impala::reduce64(hash, bucketCount); + const uint32_t bucket_idx = Impala::reduce(Impala::rotl64(hash, 32), bucketCount); + const __m512i mask = MakeMask(hash); + const __m512i bucket = reinterpret_cast<__m512i *>(directory_)[bucket_idx]; + // We should return true if 'bucket' has a one wherever 'mask' does. _mm512_testc_si512 + // takes the negation of its first argument and ands that with its second argument. In + // our case, the result is zero everywhere iff there is a one in 'bucket' wherever + // 'mask' is one. testc returns 1 if the result is 0 everywhere and returns 0 otherwise. + constexpr __m512i zero_vec = {0, 0, 0, 0, 0, 0, 0, 0}; + const __m512i res = _mm512_andnot_epi64(bucket, mask); + return _mm512_cmpeq_epi64_mask(res, zero_vec) == 0xff; + // const __m256i* array = reinterpret_cast<__m256i *>(&res); +} diff --git a/Bloom_Filter/bloom.hpp b/Bloom_Filter/bloom.hpp new file mode 100644 index 0000000..fd14e64 --- /dev/null +++ b/Bloom_Filter/bloom.hpp @@ -0,0 +1,453 @@ +/* Taken from https://github.com/FastFilter/fastfilter_cpp */ +#ifndef BLOOM_FILTER_BLOOM_FILTER_H_ +#define BLOOM_FILTER_BLOOM_FILTER_H_ + +#include +#include +#include + +#include "../hashutil.h" + +using namespace std; +using namespace hashing; + +namespace bloomfilter { + // status returned by a Bloom filter operation + enum Status { + Ok = 0, + NotFound = 1, + NotEnoughSpace = 2, + NotSupported = 3, + }; + + inline uint32_t reduce(uint32_t hash, uint32_t n) { + // http://lemire.me/blog/2016/06/27/a-fast-alternative-to-the-modulo-reduction/ + return (uint32_t) (((uint64_t) hash * n) >> 32); + } + + /** +* Given a value "word", produces an integer in [0,p) without division. +* The function is as fair as possible in the sense that if you iterate +* through all possible values of "word", then you will generate all +* possible outputs as uniformly as possible. +*/ + static inline uint32_t fastrange32(uint32_t word, uint32_t p) { + // http://lemire.me/blog/2016/06/27/a-fast-alternative-to-the-modulo-reduction/ + return (uint32_t) (((uint64_t) word * (uint64_t) p) >> 32); + } + + + /** +* Given a value "word", produces an integer in [0,p) without division. +* The function is as fair as possible in the sense that if you iterate +* through all possible values of "word", then you will generate all +* possible outputs as uniformly as possible. +*/ + static inline uint64_t fastrange64(uint64_t word, uint64_t p) { + // http://lemire.me/blog/2016/06/27/a-fast-alternative-to-the-modulo-reduction/ + // #ifdef __SIZEOF_INT128__// then we know we have a 128-bit int + return (uint64_t) (((__uint128_t) word * (__uint128_t) p) >> 64); + } + + +#ifndef UINT32_MAX +#define UINT32_MAX (0xffffffff) +#endif// UINT32_MAX + + /** +* Given a value "word", produces an integer in [0,p) without division. +* The function is as fair as possible in the sense that if you iterate +* through all possible values of "word", then you will generate all +* possible outputs as uniformly as possible. +*/ + static inline size_t fastrangesize(uint64_t word, size_t p) { +#if (SIZE_MAX == UINT32_MAX) + return (size_t) fastrange32(word, p); +#else // assume 64-bit + return (size_t) fastrange64(word, p); +#endif// SIZE_MAX == UINT32_MAX + } + + static inline size_t getBestK(size_t bitsPerItem) { + return max(1, (int) round((double) bitsPerItem * log(2))); + } + + inline uint64_t getBit(uint32_t index) { return 1L << (index & 63); } + + template + class BloomFilter { + public: + uint64_t *data; + size_t size; + size_t arrayLength; + size_t bitCount; + int kk; + HashFamily hasher; + + double BitsPerItem() const { return k; } + + explicit BloomFilter(const size_t n) : hasher() { + this->size = 0; + this->kk = getBestK(bits_per_item); + this->bitCount = n * bits_per_item; + this->arrayLength = (bitCount + 63) / 64; + data = new uint64_t[arrayLength]; + std::fill_n(data, arrayLength, 0); + } + + ~BloomFilter() { delete[] data; } + + // Add an item to the filter. + Status Add(const ItemType &item); + + // Add multiple items to the filter. + Status AddAll(const vector &data, const size_t start, + const size_t end) { + return AddAll(data.data(), start, end); + } + Status AddAll(const ItemType *data, const size_t start, + const size_t end); + // Report if the item is inserted, with false positive rate. + Status Contain(const ItemType &item) const; + + /* methods for providing stats */ + // summary infomation + std::string Info() const; + + // number of current inserted items; + size_t Size() const { return size; } + + // size of the filter in bytes. + size_t SizeInBytes() const { return arrayLength * 8; } + + std::string get_name() const { + size_t BPI = bits_per_item; + size_t hash_k = k; + std::string name = "Lem-BF-" + std::to_string(BPI) + "[k=" + std::to_string(hash_k) + "]"; + return name; + // if (branchless) { + // return name + "-{branchless}"; + // } else { + // return name + "-{with-branch}"; + // } + } + }; + + template + Status BloomFilter::Add( + const ItemType &key) { + uint64_t hash = hasher(key); + uint64_t a = (hash >> 32) | (hash << 32); + uint64_t b = hash; + for (int i = 0; i < k; i++) { + // int index = reduce(a, this->bitCount); + // data[index >> 6] |= getBit(index); + // reworked to avoid overflows + // use the fact that reduce is not very sensitive to lower bits of a + data[fastrangesize(a, this->arrayLength)] |= getBit(a); + a += b; + } + return Ok; + } + + const int blockShift = 15; + const int blockLen = 1 << blockShift; + + inline void applyBlock(uint32_t *tmp, int block, int len, uint64_t *data) { + for (int i = 0; i < len; i++) { + uint32_t index = tmp[(block << blockShift) + i]; + data[index >> 6] |= getBit(index); + } + } + + template + Status BloomFilter::AddAll( + const ItemType *keys, const size_t start, const size_t end) { + // we have that AddAll assumes that arrayLength << 6 is a + // 32-bit integer + if (arrayLength > 0x3ffffff) { + for (size_t i = start; i < end; i++) { + Add(keys[i]); + } + return Ok; + } + int blocks = 1 + arrayLength / blockLen; + uint32_t *tmp = new uint32_t[blocks * blockLen]; + int *tmpLen = new int[blocks](); + for (size_t i = start; i < end; i++) { + uint64_t key = keys[i]; + uint64_t hash = hasher(key); + uint64_t a = (hash >> 32) | (hash << 32); + uint64_t b = hash; + for (int j = 0; j < k; j++) { + int index = fastrangesize(a, this->arrayLength); + int block = index >> blockShift; + int len = tmpLen[block]; + tmp[(block << blockShift) + len] = (index << 6) + (a & 63); + tmpLen[block] = len + 1; + if (len + 1 == blockLen) { + applyBlock(tmp, block, len + 1, data); + tmpLen[block] = 0; + } + a += b; + } + } + for (int block = 0; block < blocks; block++) { + applyBlock(tmp, block, tmpLen[block], data); + } + delete[] tmp; + delete[] tmpLen; + return Ok; + } + + inline char bittest64(const uint64_t *t, uint64_t bit) { + return (*t & (1L << (bit & 63))) != 0; + } + template + Status BloomFilter::Contain( + const ItemType &key) const { + uint64_t hash = hasher(key); + uint64_t a = (hash >> 32) | (hash << 32); + uint64_t b = hash; + if (branchless && k >= 3) { + int b0 = data[fastrangesize(a, this->arrayLength)] >> (a & 63); + a += b; + int b1 = data[fastrangesize(a, this->arrayLength)] >> (a & 63); + a += b; + int b2 = data[fastrangesize(a, this->arrayLength)] >> (a & 63); + if ((b0 & b1 & b2 & 1) == 0) { + return NotFound; + } + for (int i = 3; i < k; i++) { + a += b; + if (((data[fastrangesize(a, this->arrayLength)] >> (a & 63)) & 1) == 0) { + return NotFound; + } + } + return Ok; + } + for (int i = 0; i < k; i++) { + if ((data[fastrangesize(a, this->arrayLength)] & getBit(a)) == 0) { + return NotFound; + } + a += b; + } + return Ok; + } + + template + std::string + BloomFilter::Info() const { + std::stringstream ss; + ss << "BloomFilter Status:\n" + << "\t\tKeys stored: " << Size() << "\n"; + if (Size() > 0) { + ss << "\t\tk: " << BitsPerItem() << "\n"; + } else { + ss << "\t\tk: N/A\n"; + } + return ss.str(); + } + + template + class BF_MA { + public: + uint64_t *data; + // const size_t m; + size_t cap = 0; + size_t arrayLength; + size_t bitCount; + int kk = k; + HashFamily hasher; + + double BitsPerItem() const { return k; } + + size_t get_m(size_t n) { + size_t res = (n * m_up + m_down - 1) / m_down; + assert(res > 0); + assert(res < (1ULL << 60u)); + return res; + } + + explicit BF_MA(const size_t n) : bitCount(get_m(n)), + arrayLength((get_m(n) + 63) / 64), hasher() { + // + // arrayLength((bitCount + 63) / 64),bitCount(n * bits_per_item),kk(k),hasher() { + // this->cap = 0; + // this->kk = getBestK(bits_per_item); + // this->bitCount = n * bits_per_item; + // bitCount(n * bits_per_item) this->arrayLength = (bitCount + 63) / 64; + data = new uint64_t[arrayLength]; + std::fill_n(data, arrayLength, 0); + } + + ~BF_MA() { delete[] data; } + + // Add an item to the filter. + Status Add(const uint64_t &item); + + + // Report if the item is inserted, with false positive rate. + Status Contain(const uint64_t &item) const; + + Status contain_branchless(const uint64_t &item) const; + + /* methods for providing stats */ + // summary infomation + std::string Info() const; + + // number of current inserted items; + size_t get_cap() const { return cap; } + + // size of the filter in bytes. + size_t SizeInBytes() const { return arrayLength * 8; } + + std::string get_name() const { + float BPI = (100 * m_up / m_down) / 100.0; + // double BPI = BPI_full * 100 + + size_t hash_k = k; + std::string name = "BF-MA-[bpi=10,k=" + std::to_string(k) + "]"; + // std::string name = "BF-MA-" + std::to_string(BPI) + "[k=" + std::to_string(k) + "]"; + + if (branchless) { + return name + "-{branchless}"; + } else { + return name + "-{with-branch}"; + } + } + }; + + template + Status BF_MA::Add(const uint64_t &key) { + cap++; + uint64_t hash = hasher(key); + uint64_t a = (hash >> 32) | (hash << 32); + uint64_t b = hash; + for (int i = 0; i < k; i++) { + // int index = reduce(a, this->bitCount); + // data[index >> 6] |= getBit(index); + // reworked to avoid overflows + // use the fact that reduce is not very sensitive to lower bits of a + data[fastrangesize(a, this->arrayLength)] |= getBit(a); + a += b; + } + return Ok; + } + template + Status BF_MA::Contain( + const uint64_t &key) const { + uint64_t hash = hasher(key); + uint64_t a = (hash >> 32) | (hash << 32); + uint64_t b = hash; + + for (int i = 0; i < k; i++) { + if ((data[fastrangesize(a, this->arrayLength)] & getBit(a)) == 0) { + return NotFound; + } + a += b; + } + return Ok; + + + + + + + + + + + + if ((k == 2) and branchless) { + int b0 = data[fastrangesize(a, this->arrayLength)] >> (a & 63); + a += b; + int b1 = data[fastrangesize(a, this->arrayLength)] >> (a & 63); + if ((b0 & b1 & 1) == 0) + return NotFound; + return Ok; + } else if (k == 2) { + if (!(data[fastrangesize(a, this->arrayLength)] >> (a & 63))) + return NotFound; + + a += b; + if (data[fastrangesize(a, this->arrayLength)] >> (a & 63)) { + return Ok; + } + return NotFound; + } + + if (branchless && k >= 3) { + int b0 = data[fastrangesize(a, this->arrayLength)] >> (a & 63); + a += b; + int b1 = data[fastrangesize(a, this->arrayLength)] >> (a & 63); + a += b; + int b2 = data[fastrangesize(a, this->arrayLength)] >> (a & 63); + if ((b0 & b1 & b2 & 1) == 0) { + return NotFound; + } + for (int i = 3; i < k; i++) { + a += b; + if (((data[fastrangesize(a, this->arrayLength)] >> (a & 63)) & 1) == 0) { + return NotFound; + } + } + return Ok; + } + for (int i = 0; i < k; i++) { + if ((data[fastrangesize(a, this->arrayLength)] & getBit(a)) == 0) { + return NotFound; + } + a += b; + } + return Ok; + } + + /* template + Status BF_MA::contain_branchless( + const uint64_t &key) const { + uint64_t hash = hasher(key); + uint64_t a = (hash >> 32) | (hash << 32); + uint64_t b = hash; + size_t locations[k] = {0}; + for (size_t i = 0; i < k; i++) + { + locations[i] = fastrangesize(a, this->arrayLength); + a += b; + } + + int res = 1u; + for (size_t i = 0; i < k; i++) + { + res &= data[locations[i]] >> () + } + + + } + + */ + template + std::string + BF_MA::Info() const { + std::stringstream ss; + ss << "BloomFilter Status:\n" + << "\t\tKeys stored: " << get_cap() << "\n"; + if (get_cap() > 0) { + ss << "\t\tk: " << BitsPerItem() << "\n"; + } else { + ss << "\t\tk: N/A\n"; + } + return ss.str(); + } + + +}// namespace bloomfilter + +#endif// BLOOM_FILTER_BLOOM_FILTER_H_ diff --git a/Bloom_Filter/simd-block-fixed-fpp.h b/Bloom_Filter/simd-block-fixed-fpp.h new file mode 100644 index 0000000..6cfc544 --- /dev/null +++ b/Bloom_Filter/simd-block-fixed-fpp.h @@ -0,0 +1,500 @@ +// Copied from Apache Impala (incubating), usable under the terms in the Apache License, +// Version 2.0. + +// This is a block Bloom filter (from Putze et al.'s "Cache-, Hash- and Space-Efficient +// Bloom Filters") with some twists: +// +// 1. Each block is a split Bloom filter - see Section 2.1 of Broder and Mitzenmacher's +// "Network Applications of Bloom Filters: A Survey". +// +// 2. The number of bits set per Add() is contant in order to take advantage of SIMD +// instructions. + +#pragma once + +#include +#include + +#include +#include + +#include "../hashutil.h" + + +using uint32_t = ::std::uint32_t; +using uint64_t = ::std::uint64_t; + +__attribute__((always_inline)) +inline uint32_t reduce(uint32_t hash, uint32_t n) { + // http://lemire.me/blog/2016/06/27/a-fast-alternative-to-the-modulo-reduction/ + return (uint32_t) (((uint64_t) hash * n) >> 32); +} + +static inline uint64_t rotl64(uint64_t n, unsigned int c) { + // assumes width is a power of 2 + const unsigned int mask = (CHAR_BIT * sizeof(n) - 1); + // assert ( (c<=mask) &&"rotate by type width or more"); + c &= mask; + return (n << c) | (n >> ((-c) & mask)); +} + +#ifdef __AVX2__ + +#include + +template +class SimdBlockFilterFixed { +private: + // The filter is divided up into Buckets: + using Bucket = uint32_t[8]; + + const int bucketCount; + + Bucket *directory_; + + HashFamily hasher_; + +public: + // Consumes at most (1 << log_heap_space) bytes on the heap: + explicit SimdBlockFilterFixed(const int bits); + + ~SimdBlockFilterFixed() noexcept; + + void Add(const uint64_t key) noexcept; + + // Add multiple items to the filter. + void AddAll(const std::vector &data, const size_t start, const size_t end) { + return AddAll(data.data(), start, end); + } + + void AddAll(const uint64_t *data, const size_t start, const size_t end); + + bool Find(const uint64_t key) const noexcept; + + uint64_t SizeInBytes() const { return sizeof(Bucket) * bucketCount; } + + size_t get_cap() const noexcept { + return -1; + } +private: + // A helper function for Insert()/Find(). Turns a 32-bit hash into a 256-bit Bucket + // with 1 single 1-bit set in each 32-bit lane. + static __m256i MakeMask(const uint32_t hash) noexcept; + + void ApplyBlock(uint64_t *tmp, int block, int len); + +}; + +template +SimdBlockFilterFixed::SimdBlockFilterFixed(const int bits) +// bits / 16: fpp 0.1777%, 75.1% +// bits / 20: fpp 0.4384%, 63.4% +// bits / 22: fpp 0.6692%, 61.1% +// bits / 24: fpp 0.9765%, 59.7% <<== seems to be best (1% fpp seems important) +// bits / 26: fpp 1.3769%, 59.3% +// bits / 28: fpp 1.9197%, 60.3% +// bits / 32: fpp 3.3280%, 63.0% + : bucketCount(::std::max(1, bits / 24)), + directory_(nullptr), + hasher_() { + if (!__builtin_cpu_supports("avx2")) { + throw ::std::runtime_error("SimdBlockFilterFixed does not work without AVX2 instructions"); + } + const size_t alloc_size = bucketCount * sizeof(Bucket); + const int malloc_failed = + posix_memalign(reinterpret_cast(&directory_), 64, alloc_size); + if (malloc_failed) throw ::std::bad_alloc(); + // std::cout << "Ctor: SIMD-fixed byte size: " << SizeInBytes() << std::endl; + memset(directory_, 0, alloc_size); +} + +template +SimdBlockFilterFixed::~SimdBlockFilterFixed() noexcept { + // std::cout << "Dtor: SIMD-fixed byte size: " << SizeInBytes() << std::endl; + free(directory_); + directory_ = nullptr; +} + +// The SIMD reinterpret_casts technically violate C++'s strict aliasing rules. However, we +// compile with -fno-strict-aliasing. +template +[[gnu::always_inline]] inline __m256i +SimdBlockFilterFixed::MakeMask(const uint32_t hash) noexcept { + const __m256i ones = _mm256_set1_epi32(1); + // Odd contants for hashing: + const __m256i rehash = _mm256_setr_epi32(0x47b6137bU, 0x44974d91U, 0x8824ad5bU, + 0xa2b7289dU, 0x705495c7U, 0x2df1424bU, 0x9efc4947U, 0x5c6bfb31U); + // Load hash into a YMM register, repeated eight times + __m256i hash_data = _mm256_set1_epi32(hash); + // Multiply-shift hashing ala Dietzfelbinger et al.: multiply 'hash' by eight different + // odd constants, then keep the 5 most significant bits from each product. + hash_data = _mm256_mullo_epi32(rehash, hash_data); + hash_data = _mm256_srli_epi32(hash_data, 27); + // Use these 5 bits to shift a single bit to a location in each 32-bit lane + return _mm256_sllv_epi32(ones, hash_data); +} + +template +[[gnu::always_inline]] inline void +SimdBlockFilterFixed::Add(const uint64_t key) noexcept { + const auto hash = hasher_(key); + const uint32_t bucket_idx = reduce(rotl64(hash, 32), bucketCount); + const __m256i mask = MakeMask(hash); + __m256i *const bucket = &reinterpret_cast<__m256i *>(directory_)[bucket_idx]; + _mm256_store_si256(bucket, _mm256_or_si256(*bucket, mask)); +} + +const int blockShift = 14; +const int blockLen = 1 << blockShift; + +template +void SimdBlockFilterFixed::ApplyBlock(uint64_t *tmp, int block, int len) { + for (int i = 0; i < len; i += 2) { + uint64_t hash = tmp[(block << blockShift) + i]; + uint32_t bucket_idx = tmp[(block << blockShift) + i + 1]; + const __m256i mask = MakeMask(hash); + __m256i *const bucket = &reinterpret_cast<__m256i *>(directory_)[bucket_idx]; + _mm256_store_si256(bucket, _mm256_or_si256(*bucket, mask)); + } +} + +template +void SimdBlockFilterFixed::AddAll( + const uint64_t *keys, const size_t start, const size_t end) { + int blocks = 1 + bucketCount / blockLen; + uint64_t *tmp = new uint64_t[blocks * blockLen]; + int *tmpLen = new int[blocks](); + for (size_t i = start; i < end; i++) { + uint64_t key = keys[i]; + uint64_t hash = hasher_(key); + uint32_t bucket_idx = reduce(rotl64(hash, 32), bucketCount); + int block = bucket_idx >> blockShift; + int len = tmpLen[block]; + tmp[(block << blockShift) + len] = hash; + tmp[(block << blockShift) + len + 1] = bucket_idx; + tmpLen[block] = len + 2; + if (len + 2 == blockLen) { + ApplyBlock(tmp, block, len + 1); + tmpLen[block] = 0; + } + } + for (int block = 0; block < blocks; block++) { + ApplyBlock(tmp, block, tmpLen[block]); + } + delete[] tmp; + delete[] tmpLen; +} + +template +[[gnu::always_inline]] inline bool +SimdBlockFilterFixed::Find(const uint64_t key) const noexcept { + const auto hash = hasher_(key); + const uint32_t bucket_idx = reduce(rotl64(hash, 32), bucketCount); + const __m256i mask = MakeMask(hash); + const __m256i bucket = reinterpret_cast<__m256i *>(directory_)[bucket_idx]; + // We should return true if 'bucket' has a one wherever 'mask' does. _mm256_testc_si256 + // takes the negation of its first argument and ands that with its second argument. In + // our case, the result is zero everywhere iff there is a one in 'bucket' wherever + // 'mask' is one. testc returns 1 if the result is 0 everywhere and returns 0 otherwise. + return _mm256_testc_si256(bucket, mask); +} + +/////////////////////////////////////////////////////////////////// +/// 64-byte version +/////////////////////////////////////////////////////////////////// + + +struct mask64bytes { + __m256i first; + __m256i second; +}; + +typedef struct mask64bytes mask64bytes_t; + +template +class SimdBlockFilterFixed64 { +private: + // The filter is divided up into Buckets: + using Bucket = mask64bytes_t; + + const int bucketCount; + + Bucket *directory_; + + HashFamily hasher_; + +public: + // Consumes at most (1 << log_heap_space) bytes on the heap: + explicit SimdBlockFilterFixed64(const int bits); + + ~SimdBlockFilterFixed64() noexcept; + + void Add(const uint64_t key) noexcept; + + bool Find(const uint64_t key) const noexcept; + + uint64_t SizeInBytes() const { return sizeof(Bucket) * bucketCount; } + +private: + static mask64bytes_t MakeMask(const uint64_t hash) noexcept; + + +}; + +template +SimdBlockFilterFixed64::SimdBlockFilterFixed64(const int bits) + + : bucketCount(::std::max(1, bits / 50)), + directory_(nullptr), + hasher_() { + if (!__builtin_cpu_supports("avx2")) { + throw ::std::runtime_error("SimdBlockFilterFixed64 does not work without AVX2 instructions"); + } + const size_t alloc_size = bucketCount * sizeof(Bucket); + const int malloc_failed = + posix_memalign(reinterpret_cast(&directory_), 64, alloc_size); + if (malloc_failed) throw ::std::bad_alloc(); + memset(directory_, 0, alloc_size); +} + +template +SimdBlockFilterFixed64::~SimdBlockFilterFixed64() noexcept { + free(directory_); + directory_ = nullptr; +} + + +template +[[gnu::always_inline]] inline mask64bytes_t +SimdBlockFilterFixed64::MakeMask(const uint64_t hash) noexcept { + const __m256i ones = _mm256_set1_epi64x(1); + const __m256i rehash1 = _mm256_setr_epi32(0x47b6137bU, 0x44974d91U, 0x8824ad5bU, + 0xa2b7289dU, 0x705495c7U, 0x2df1424bU, 0x9efc4947U, 0x5c6bfb31U); + mask64bytes_t answer; + __m256i hash_data = _mm256_set1_epi32(hash); + __m256i h = _mm256_mullo_epi32(rehash1, hash_data); + h = _mm256_srli_epi32(h, 26); + answer.first = _mm256_unpackhi_epi32(h, _mm256_setzero_si256()); + answer.first = _mm256_sllv_epi64(ones, answer.first); + answer.second = _mm256_unpacklo_epi32(h, _mm256_setzero_si256()); + answer.second = _mm256_sllv_epi64(ones, answer.second); + return answer; +} + +template +[[gnu::always_inline]] inline void +SimdBlockFilterFixed64::Add(const uint64_t key) noexcept { + const auto hash = hasher_(key); + const uint32_t bucket_idx = reduce(rotl64(hash, 32), bucketCount); + mask64bytes_t mask = MakeMask(hash); + mask64bytes_t *const bucket = &reinterpret_cast(directory_)[bucket_idx]; + bucket->first = _mm256_or_si256(mask.first, bucket->first); + bucket->second = _mm256_or_si256(mask.second, bucket->second); +} + +template +[[gnu::always_inline]] inline bool +SimdBlockFilterFixed64::Find(const uint64_t key) const noexcept { + const auto hash = hasher_(key); + const uint32_t bucket_idx = reduce(rotl64(hash, 32), bucketCount); + const mask64bytes_t mask = MakeMask(hash); + const mask64bytes_t bucket = reinterpret_cast(directory_)[bucket_idx]; + return _mm256_testc_si256(bucket.first, mask.first) & _mm256_testc_si256(bucket.second, mask.second); +} + +#endif //__AVX2__ + +/////////////////// +// 16-byte version ARM +////////////////// +#ifdef __aarch64__ +#include + +template +class SimdBlockFilterFixed { + private: + // The filter is divided up into Buckets: + using Bucket = uint16x8_t; + + const int bucketCount; + + Bucket* directory_; + + HashFamily hasher_; + + public: + // Consumes at most (1 << log_heap_space) bytes on the heap: + explicit SimdBlockFilterFixed(const int bits); + ~SimdBlockFilterFixed() noexcept; + void Add(const uint64_t key) noexcept; + + // Add multiple items to the filter. + void AddAll(const vector& data, const size_t start, const size_t end) { + return AddAll(data.data(),start,end); + } + + void AddAll(const uint64_t* data, const size_t start, const size_t end); + + bool Find(const uint64_t key) const noexcept; + uint64_t SizeInBytes() const { return sizeof(Bucket) * bucketCount; } + + private: + // A helper function for Insert()/Find(). Turns a 32-bit hash into a 256-bit Bucket + // with 1 single 1-bit set in each 32-bit lane. + static Bucket MakeMask(const uint16_t hash) noexcept; + + void ApplyBlock(uint64_t* tmp, int block, int len); + +}; + +template +SimdBlockFilterFixed::SimdBlockFilterFixed(const int bits) + : bucketCount(::std::max(1, bits / 10)), + directory_(nullptr), + hasher_() { + const size_t alloc_size = bucketCount * sizeof(Bucket); + const int malloc_failed = + posix_memalign(reinterpret_cast(&directory_), 64, alloc_size); + if (malloc_failed) throw ::std::bad_alloc(); + memset(directory_, 0, alloc_size); +} + +template +SimdBlockFilterFixed::~SimdBlockFilterFixed() noexcept { + free(directory_); + directory_ = nullptr; +} + +template +[[gnu::always_inline]] inline uint16x8_t +SimdBlockFilterFixed::MakeMask(const uint16_t hash) noexcept { + const uint16x8_t ones = {1,1,1,1,1,1,1,1}; + const uint16x8_t rehash = {0x79d8, 0xe722, 0xf2fb, 0x21ec, 0x121b, 0x2302, 0x705a, 0x6e87}; + uint16x8_t hash_data = {hash,hash,hash,hash,hash,hash,hash,hash}; + uint16x8_t answer = vmulq_u16(hash_data,rehash); + answer = vshrq_n_u16(answer, 12); + answer = vshlq_u16(ones, vreinterpretq_s16_u16(answer)); + return answer; +} + +template +[[gnu::always_inline]] inline void +SimdBlockFilterFixed::Add(const uint64_t key) noexcept { + const auto hash = hasher_(key); + const uint32_t bucket_idx = reduce(rotl64(hash, 32), bucketCount); + const uint16x8_t mask = MakeMask(hash); + uint16x8_t bucket = directory_[bucket_idx]; + directory_[bucket_idx] = vorrq_u16(mask, bucket); +} + +template +[[gnu::always_inline]] inline bool +SimdBlockFilterFixed::Find(const uint64_t key) const noexcept { + const auto hash = hasher_(key); + const uint32_t bucket_idx = reduce(rotl64(hash, 32), bucketCount); + const uint16x8_t mask = MakeMask(hash); + const uint16x8_t bucket = directory_[bucket_idx]; + uint16x8_t an = vbicq_u16(mask, bucket); + uint64x2_t v64 = vreinterpretq_u64_u16(an); + uint32x2_t v32 = vqmovn_u64(v64); + uint64x1_t result = vreinterpret_u64_u32(v32); + return vget_lane_u64(result, 0) == 0; +} + + + +#endif // __aarch64__ + + +/////////////////////////////////////////////////////////////////// +/// 16-byte version (not very good) +/////////////////////////////////////////////////////////////////// + +#ifdef __SSE41__ + +#include + +template +class SimdBlockFilterFixed16 { + private: + // The filter is divided up into Buckets: + using Bucket = __m128i; + + const int bucketCount; + + Bucket* directory_; + + HashFamily hasher_; + + public: + // Consumes at most (1 << log_heap_space) bytes on the heap: + explicit SimdBlockFilterFixed16(const int bits); + ~SimdBlockFilterFixed16() noexcept; + void Add(const uint64_t key) noexcept; + + bool Find(const uint64_t key) const noexcept; + uint64_t SizeInBytes() const { return sizeof(Bucket) * bucketCount; } + + private: + static __m128i MakeMask(const uint64_t hash) noexcept; + + +}; + +template +SimdBlockFilterFixed16::SimdBlockFilterFixed16(const int bits) + + : bucketCount(::std::max(1, bits / 10)), + directory_(nullptr), + hasher_() { + const size_t alloc_size = bucketCount * sizeof(Bucket); + const int malloc_failed = + posix_memalign(reinterpret_cast(&directory_), 64, alloc_size); + if (malloc_failed) throw ::std::bad_alloc(); + memset(directory_, 0, alloc_size); +} + +template +SimdBlockFilterFixed16::~SimdBlockFilterFixed16() noexcept { + free(directory_); + directory_ = nullptr; +} + + +template +[[gnu::always_inline]] inline __m128i +SimdBlockFilterFixed16::MakeMask(const uint64_t hash) noexcept { + const __m128i rehash1 = _mm_setr_epi16(0x47b5, 0x4497, 0x8823, + 0xa2b7, 0x7053, 0x2df1, 0x9efc, 0x5c6b); + __m128i hash_data = _mm_set1_epi32(hash ); + __m128i h = _mm_mulhi_epi16(rehash1, hash_data); +return _mm_shuffle_epi8(_mm_set_epi8(1,2,4,8,16,32,64,-128,1,2,4,8,16,32,64,-128),h); +} + + + + +template +[[gnu::always_inline]] inline void +SimdBlockFilterFixed16::Add(const uint64_t key) noexcept { + const auto hash = hasher_(key); + const uint32_t bucket_idx = reduce(rotl64(hash, 32), bucketCount); + __m128i mask = MakeMask(hash); + __m128i* const bucket = reinterpret_cast<__m128i*>(directory_) + bucket_idx; + __m128i bucketvalue = _mm_loadu_si128(bucket); + bucketvalue = _mm_or_si128(bucketvalue, mask); + _mm_storeu_si128(bucket,bucketvalue); +} + +template +[[gnu::always_inline]] inline bool +SimdBlockFilterFixed16::Find(const uint64_t key) const noexcept { + const auto hash = hasher_(key); + const uint32_t bucket_idx = reduce(rotl64(hash, 32), bucketCount); + const __m128i mask = MakeMask(hash); + __m128i* const bucket = reinterpret_cast<__m128i*>(directory_) + bucket_idx; + __m128i bucketvalue = _mm_loadu_si128(bucket); + return _mm_testc_si128(bucketvalue,mask); +} + +#endif // #ifdef __SSE41__ diff --git a/Bloom_Filter/simd-block.h b/Bloom_Filter/simd-block.h new file mode 100644 index 0000000..a3b3b4c --- /dev/null +++ b/Bloom_Filter/simd-block.h @@ -0,0 +1,152 @@ +// Copied from Apache Impala (incubating), usable under the terms in the Apache License, +// Version 2.0. + +// This is a block Bloom filter (from Putze et al.'s "Cache-, Hash- and Space-Efficient +// Bloom Filters") with some twists: +// +// 1. Each block is a split Bloom filter - see Section 2.1 of Broder and Mitzenmacher's +// "Network Applications of Bloom Filters: A Survey". +// +// 2. The number of bits set per Add() is contant in order to take advantage of SIMD +// instructions. + +#pragma once + + +#include +#include + +#include +#include + +#include "../hashutil.h" +#include + + +using uint32_t = ::std::uint32_t; +using uint64_t = ::std::uint64_t; + +template +class SimdBlockFilter { +private: + // The filter is divided up into Buckets: + using Bucket = uint32_t[8]; + + // log2(number of bytes in a bucket): + static constexpr int LOG_BUCKET_BYTE_SIZE = 5; + + static_assert( + (1 << LOG_BUCKET_BYTE_SIZE) == sizeof(Bucket) && sizeof(Bucket) == sizeof(__m256i), + "Bucket sizing has gone awry."); + + // log_num_buckets_ is the log (base 2) of the number of buckets in the directory: + const int log_num_buckets_; + + // directory_mask_ is (1 << log_num_buckets_) - 1. It is precomputed in the contructor + // for efficiency reasons: + const uint32_t directory_mask_; + + Bucket *directory_; + + HashFamily hasher_; + +public: + // Consumes at most (1 << log_heap_space) bytes on the heap: + explicit SimdBlockFilter(const int log_heap_space); + + SimdBlockFilter(SimdBlockFilter &&that) + : log_num_buckets_(that.log_num_buckets_), + directory_mask_(that.directory_mask_), + directory_(that.directory_), + hasher_(that.hasher_) {} + + ~SimdBlockFilter() noexcept; + + void Add(const uint64_t key) noexcept; + + bool Find(const uint64_t key) const noexcept; + + uint64_t SizeInBytes() const { return sizeof(Bucket) * (1ull << log_num_buckets_); } + + size_t get_cap() const noexcept { + return -1; + } +private: + // A helper function for Insert()/Find(). Turns a 32-bit hash into a 256-bit Bucket + // with 1 single 1-bit set in each 32-bit lane. + static __m256i MakeMask(const uint32_t hash) noexcept; + + SimdBlockFilter(const SimdBlockFilter &) = delete; + + void operator=(const SimdBlockFilter &) = delete; +}; + +template +SimdBlockFilter::SimdBlockFilter(const int log_heap_space) + : // Since log_heap_space is in bytes, we need to convert it to the number of Buckets + // we will use. + log_num_buckets_(::std::max(1, log_heap_space - LOG_BUCKET_BYTE_SIZE)), + // Don't use log_num_buckets_ if it will lead to undefined behavior by a shift that is + // too large. + directory_mask_((1ull << ::std::min(63, log_num_buckets_)) - 1), + directory_(nullptr), + hasher_() { + if (!__builtin_cpu_supports("avx2")) { + throw ::std::runtime_error("SimdBlockFilter does not work without AVX2 instructions"); + } + const size_t alloc_size = 1ull << (log_num_buckets_ + LOG_BUCKET_BYTE_SIZE); + const int malloc_failed = + posix_memalign(reinterpret_cast(&directory_), 64, alloc_size); + if (malloc_failed) throw ::std::bad_alloc(); + memset(directory_, 0, alloc_size); +} + +template +SimdBlockFilter::~SimdBlockFilter() noexcept { + // std::cout << "SIMD byte size: " << SizeInBytes() << std::endl; + free(directory_); + directory_ = nullptr; +} + +// The SIMD reinterpret_casts technically violate C++'s strict aliasing rules. However, we +// compile with -fno-strict-aliasing. +template +[[gnu::always_inline]] inline __m256i +SimdBlockFilter::MakeMask(const uint32_t hash) noexcept { + const __m256i ones = _mm256_set1_epi32(1); + // Odd contants for hashing: + const __m256i rehash = _mm256_setr_epi32(0x47b6137bU, 0x44974d91U, 0x8824ad5bU, + 0xa2b7289dU, 0x705495c7U, 0x2df1424bU, 0x9efc4947U, 0x5c6bfb31U); + // Load hash into a YMM register, repeated eight times + __m256i hash_data = _mm256_set1_epi32(hash); + // Multiply-shift hashing ala Dietzfelbinger et al.: multiply 'hash' by eight different + // odd constants, then keep the 5 most significant bits from each product. + hash_data = _mm256_mullo_epi32(rehash, hash_data); + hash_data = _mm256_srli_epi32(hash_data, 27); + // Use these 5 bits to shift a single bit to a location in each 32-bit lane + return _mm256_sllv_epi32(ones, hash_data); +} + +template +[[gnu::always_inline]] inline void +SimdBlockFilter::Add(const uint64_t key) noexcept { + const auto hash = hasher_(key); + const uint32_t bucket_idx = hash & directory_mask_; + const __m256i mask = MakeMask(hash >> log_num_buckets_); + __m256i *const bucket = &reinterpret_cast<__m256i *>(directory_)[bucket_idx]; + _mm256_store_si256(bucket, _mm256_or_si256(*bucket, mask)); +} + +template +[[gnu::always_inline]] inline bool +SimdBlockFilter::Find(const uint64_t key) const noexcept { + const auto hash = hasher_(key); + const uint32_t bucket_idx = hash & directory_mask_; + const __m256i mask = MakeMask(hash >> log_num_buckets_); + const __m256i bucket = reinterpret_cast<__m256i *>(directory_)[bucket_idx]; + // We should return true if 'bucket' has a one wherever 'mask' does. _mm256_testc_si256 + // takes the negation of its first argument and ands that with its second argument. In + // our case, the result is zero everywhere iff there is a one in 'bucket' wherever + // 'mask' is one. testc returns 1 if the result is 0 everywhere and returns 0 otherwise. + return _mm256_testc_si256(bucket, mask); +} diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..4fe62c2 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,116 @@ +cmake_minimum_required(VERSION 3.10) + +# set(CMAKE_C_COMPILER gcc-10) +# set(CMAKE_CXX_COMPILER g++-10) +# set(CMAKE_C_COMPILER clang) +# set(CMAKE_CXX_COMPILER clang++) +set(CMAKE_CXX_STANDARD 17) +project(APD_ONLY) + +# set(COMPILE_FLAGS "-fprofile-instr-generate -fcoverage-mapping") +# set(CMAKE_EXE_LINKER_FLAGS "-fprofile-instr-generate") + +set(CMAKE_CXX_FLAGS "-march=native") + +# Seems like those are necessary. +# set(CMAKE_CXX_FLAGS "-mavx2 -mbmi -mbmi2 -mlzcnt -mpopcnt -mavx512vl -mavx512vbmi -mavx512dq -mavx512f -mavx512cd") + +#-fsanitize=undefined +#-fsanitize=memory +#set (CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -fsanitize=undefined -fno-omit-frame-pointer") +#set (CMAKE_LINKER_FLAGS_DEBUG "${CMAKE_LINKER_FLAGS_DEBUG} -fsanitize=address -fno-omit-frame-pointer") + +set(PF_FILES + Prefix-Filter/Shift_op.hpp Prefix-Filter/Shift_op.cpp + Prefix-Filter/min_pd256.hpp Prefix-Filter/min_pd256.cpp +) + +set(CF_FILES + cuckoofilter/src/bitsutil.h cuckoofilter/src/permencoding.h + cuckoofilter/src/printutil.cc cuckoofilter/src/debug.h + cuckoofilter/src/singletable.h cuckoofilter/src/packedtable.h + cuckoofilter/src/cuckoofilter.h + cuckoofilter/src/cuckoofilter_stable.h + ) + +set(TESTS_FILES + hashutil.h + Tests/wrappers.hpp + Tests/smart_tests.hpp + Tests/smart_tests.cpp + # Tests/PerfEvent.hpp + ) + +set(TC_SHORTCUT_FILES +# hashutil.h + TC-Shortcut/tc-sym.hpp + TC-Shortcut/tc-sym.cpp + TC-Shortcut/TC-shortcut.hpp) + + +set(Bloom_Files + Bloom_Filter/simd-block.h + Bloom_Filter/simd-block-fixed-fpp.h + Bloom_Filter/Impala512.h + Bloom_Filter/bloom.hpp + # Bloom_Filter/bloom-simple.hpp +) + +set(ALL_FILES_NM + ${Bloom_Files} + ${TESTS_FILES} + ${PF_FILES} + + ${CF_FILES} + ${TC_SHORTCUT_FILES} + + ) +set(ALL_FILES + ${ALL_FILES_NM} + # ${XOR_FILES} + all_main.cpp + ) + + +################################################################################ +################################################################################ +################################################################################ +################################################################################ +# Measure built +add_executable(measure_built0 ${ALL_FILES_NM} main-built.cpp) +add_executable(measure_built3 ${ALL_FILES_NM} main-built.cpp) +add_executable(measure_built ${ALL_FILES_NM} main-built.cpp) +target_compile_options(measure_built0 PRIVATE -O0 -g3 -W) +target_compile_options(measure_built3 PRIVATE -O3 -g3) +target_compile_options(measure_built PRIVATE -Ofast -DNDEBUG) + +################################################################################ + +# Measure fpp +add_executable(measure_fpp0 ${ALL_FILES_NM} main-fpp.cpp) +add_executable(measure_fpp3 ${ALL_FILES_NM} main-fpp.cpp) +add_executable(measure_fpp ${ALL_FILES_NM} main-fpp.cpp) +target_compile_options(measure_fpp0 PRIVATE -O0 -g3 -W) +target_compile_options(measure_fpp3 PRIVATE -O3 -g3) +target_compile_options(measure_fpp PRIVATE -Ofast -DNDEBUG ) + +################################################################################ + +# Measure perf +add_executable(measure_perf0 ${ALL_FILES_NM} main-perf.cpp) +add_executable(measure_perf3 ${ALL_FILES_NM} main-perf.cpp) +add_executable(measure_perf ${ALL_FILES_NM} main-perf.cpp) +target_compile_options(measure_perf0 PRIVATE -O0 -g3 -W) +target_compile_options(measure_perf3 PRIVATE -O3 -g3) +target_compile_options(measure_perf PRIVATE -Ofast -DNDEBUG) + +################################################################################ + +# Measure example +add_executable(example0 ${ALL_FILES_NM} example.cpp) +add_executable(example ${ALL_FILES_NM} example.cpp) +target_compile_options(example0 PRIVATE -O0 -g3 -W) +target_compile_options(example PRIVATE -Ofast -DNDEBUG) + + +################################################################################ diff --git a/LICENSE.md b/LICENSE.md new file mode 100644 index 0000000..dca9501 --- /dev/null +++ b/LICENSE.md @@ -0,0 +1,13 @@ + Copyright (c) 2021, All rights reserved. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/Prefix-Filter/Shift_op.cpp b/Prefix-Filter/Shift_op.cpp new file mode 100644 index 0000000..c71073f --- /dev/null +++ b/Prefix-Filter/Shift_op.cpp @@ -0,0 +1,2539 @@ +// +// Created by tomer on 15/06/2021. +// + + +#include "Shift_op.hpp" + +namespace Shift_op { + /** + * @brief + * index = begin * shift / slot_size; + * r_begin = (begin * shift) % slot_size + * r_end = (begin * shift) % slot_size + * set a[index] = a[index][:r_begin - shift] + (a[index][r_begin:r_end - shift] + a[index][r_end - shift:r_end]) + a[index][r_end:]; + * + * 1, 2, 3, b, 5, 6, 7, 8, e, 9, 0 + * + * 1, 2, b, 5, 6, 7, 8, e, e, 9, 0 + * + * + * @b {word Overwrite a[index][r_begin - shift :r_begin] (I think).} + * @param a + * @param begin shift max_cap index - If each slot in the array @param a is of max_cap @param shift, then begin is + * an index of an item in the array. + * Stated differently, move bits between [begin * shift, end * shift) left. + * @param end + * @param a_size + */ + void shift_arr_4bits_left_inside_single_word_robuster(uint64_t *a, size_t begin, size_t end, size_t a_size) { + if (begin >= end) return; + assert(begin % 16); + constexpr unsigned slot_size = sizeof(a[0]) * CHAR_BIT; + constexpr unsigned shift = 4u; + constexpr unsigned slot_sh_capacity = slot_size / shift; + + assert((end % 16 == 0) or (begin & _bzhi_u64(-1, shift)) <= (end & _bzhi_u64(-1, shift))); + size_t index = begin / slot_sh_capacity; + assert(index == ((end - 1) / slot_sh_capacity)); + + size_t rel_begin = (begin * shift) & (slot_size - 1); + size_t rel_end = (end * shift) & (slot_size - 1); + uint64_t lo_mask = _bzhi_u64(-1, rel_begin - shift); + uint64_t lo = a[index] & lo_mask; + + if (rel_end == 0) { + uint64_t mid = (a[index] >> shift) & (~lo_mask); + assert(!(lo & mid)); + a[index] = lo | mid; + return; + } + assert(rel_begin < rel_end); + + uint64_t hi_mask = _bzhi_u64(-1, rel_end - shift); + uint64_t mid = (a[index] >> shift) & ((~lo_mask) & hi_mask); + uint64_t hi = a[index] & ~hi_mask; + assert(!(lo & mid) and !(lo & hi) and !(mid & hi)); + a[index] = lo | mid | hi; + } + + void shift_arr_4bits_left_att_helper(uint64_t *a, size_t begin, size_t end, size_t a_size) { + if (begin == end) return; + constexpr unsigned slot_size = sizeof(a[0]) * CHAR_BIT; + constexpr unsigned shift = 4u; + constexpr unsigned slot_sh_capacity = slot_size / shift; + assert(slot_sh_capacity * shift == slot_size); + + size_t begin_word_index = begin >> shift; + assert(begin_word_index == (begin / slot_sh_capacity)); + size_t rel_begin = begin & (slot_sh_capacity - 1u); + assert(rel_begin); + size_t end_m1_word_index = (end - 1u) >> shift; + + + if (begin_word_index == end_m1_word_index) { + // std::cout << "hh0" << std::endl; + return shift_arr_4bits_left_inside_single_word_robuster(a, begin, end, a_size); + } + + size_t temp_i = begin_word_index; + size_t last_i = end_m1_word_index; + uint64_t first_word_mask = _bzhi_u64(-1, (rel_begin - 1) * shift); + uint64_t first_word_lo = a[temp_i] & first_word_mask; + + for (; temp_i < last_i; temp_i++) { + auto lo = a[temp_i] >> shift; + assert(temp_i + 1 < a_size); + auto hi = (a[temp_i + 1] << (slot_size - shift)); + assert((lo & hi) == 0); + a[temp_i] = lo | hi; + } + + // Dealing with the last word. + size_t new_begin = end_m1_word_index * slot_sh_capacity + 1; + shift_arr_4bits_left_inside_single_word_robuster(a, new_begin, end, a_size); + + /**Dealing with the first word. */ + uint64_t first_word_hi = a[begin_word_index] & ~first_word_mask; + assert((first_word_lo & first_word_hi) == 0); + a[begin_word_index] = first_word_lo | first_word_hi; + } + + /** + * @brief + * I think I have the following inconsistently: + * sometimes the last item is doubled, and sometimes the second appearance is masked out (to zeros). + * It might be related to the fact that that end is """equal""" to a_size (end * 4 == a_size * 64); + * + * @param a + * @param begin + * @param end + * @param a_size + */ + void shift_arr_4bits_left_att_wrapper(uint64_t *a, size_t begin, size_t end, size_t a_size) { + // ZoneScopedN("Shift-4Left"); + assert(end * 4 <= a_size * 64); + assert(begin <= end); + if (begin == end) return; + constexpr unsigned slot_size = sizeof(a[0]) * CHAR_BIT; + constexpr unsigned shift = 4u; + constexpr unsigned slot_sh_capacity = slot_size / shift; + assert(slot_sh_capacity * shift == slot_size); + + //todo: begin += !begin; + + size_t rel_begin = begin & (slot_sh_capacity - 1); + if (rel_begin) { + // std::cout << "h0" << std::endl; + return shift_arr_4bits_left_att_helper(a, begin, end, a_size); + } + + if (begin == 0) { + // std::cout << "h1" << std::endl; + return shift_arr_4bits_left_att_helper(a, begin + 1, end, a_size); + } + + // std::cout << "h2" << std::endl; + size_t begin_word_index = begin / slot_sh_capacity; + uint64_t last_bits = a[begin_word_index]; + shift_arr_4bits_left_att_helper(a, begin + 1, end, a_size); + uint64_t lo = a[begin_word_index - 1] & _bzhi_u64(-1, slot_size - shift); + uint64_t hi = last_bits << (slot_size - shift); + assert(!(lo & hi)); + a[begin_word_index - 1] = lo | hi; + } + + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + + void shift_arr_1bit_left_inside_single_word_robuster(uint64_t *a, size_t begin, size_t end) { + if (begin >= end) return; + assert(begin % 64); + constexpr unsigned slot_size = 64; + constexpr unsigned slot_mask = 63; + constexpr unsigned shift = 1u; + constexpr unsigned items_in_slots = slot_size / shift; + + /** Assert on one of the following: + * 1) rel_begin <= rel_end + * 2) end points to the next word. + */ + assert((!(end & slot_mask)) or ((begin & slot_mask) <= (end & slot_mask))); + size_t index = begin / items_in_slots; + assert(index == ((end - 1) / items_in_slots)); + + size_t rel_begin = (begin * shift) & slot_mask; + size_t rel_end = (end * shift) & slot_mask; + uint64_t lo_mask = _bzhi_u64(-1, rel_begin - shift); + uint64_t lo = a[index] & lo_mask; + + if (rel_end == 0) { + uint64_t mid = (a[index] >> shift) & (~lo_mask); + assert(!(lo & mid)); + a[index] = lo | mid; + return; + } + assert(rel_begin < rel_end); + + uint64_t hi_mask = _bzhi_u64(-1, rel_end); + // uint64_t mid = (a[index] >> shift) & ((~lo_mask) & hi_mask); + uint64_t mid = (a[index] & ((~lo_mask) & hi_mask)) >> shift; + uint64_t hi = a[index] & ~hi_mask; + assert(!(lo & mid) and !(lo & hi) and !(mid & hi)); + a[index] = lo | mid | hi; + } + + void shift_arr_1bit_left_att_helper(uint64_t *a, size_t begin, size_t end, size_t a_size) { + if (begin == end) return; + constexpr unsigned slot_size = sizeof(a[0]) * CHAR_BIT; + constexpr unsigned shift = 1u; + constexpr unsigned slot_mask = slot_size - 1u; + constexpr unsigned items_in_slots = slot_size; + // assert(items_in_slots * shift == slot_size); + + size_t begin_word_index = begin / slot_size; + size_t rel_begin = begin & slot_mask; + assert(rel_begin); + size_t end_m1_word_index = (end - 1u) / slot_size; + + + if (begin_word_index == end_m1_word_index) { + // std::cout << "hh0" << std::endl; + return shift_arr_1bit_left_inside_single_word_robuster(a, begin, end); + } + + size_t temp_i = begin_word_index; + size_t last_i = end_m1_word_index; + uint64_t first_word_mask = _bzhi_u64(-1, (rel_begin - 1) * shift); + uint64_t first_word_lo = a[temp_i] & first_word_mask; + + for (; temp_i < last_i; temp_i++) { + //FIXME: + auto lo = a[temp_i] >> shift; + assert(temp_i + 1 < a_size); + auto hi = (a[temp_i + 1] << (slot_size - shift)); + assert((lo & hi) == 0); + a[temp_i] = lo | hi; + } + + // Dealing with the last word. + size_t new_begin = end_m1_word_index * items_in_slots + 1; + shift_arr_1bit_left_inside_single_word_robuster(a, new_begin, end); + + /**Dealing with the first word. */ + uint64_t first_word_hi = a[begin_word_index] & ~first_word_mask; + assert((first_word_lo & first_word_hi) == 0); + a[begin_word_index] = first_word_lo | first_word_hi; + } + + void shift_arr_1bit_left_att_wrapper(uint64_t *a, size_t begin, size_t end, size_t a_size) { + assert(end <= a_size * 64); + assert(begin <= end); + if (begin == end) return; + constexpr unsigned slot_size = sizeof(a[0]) * CHAR_BIT; + constexpr unsigned shift = 1u; + constexpr unsigned slot_mask = slot_size - 1u; + constexpr unsigned items_in_slots = slot_size; + // assert(items_in_slots * shift == slot_size); + + size_t rel_begin = begin & slot_mask; + if (rel_begin) { + // std::cout << "h0" << std::endl; + return shift_arr_1bit_left_att_helper(a, begin, end, a_size); + } + + if (begin == 0) { + // std::cout << "h1" << std::endl; + // a[0] >>= 1u; + return shift_arr_1bit_left_att_helper(a, begin + 1, end, a_size); + } + + /** The last item in the word before @param begin_word_index needs to be updated to the value of + * @param begin_word_index first item + */ + // std::cout << "h2" << std::endl; + size_t begin_word_index = begin / items_in_slots; + uint64_t last_bits = a[begin_word_index]; + shift_arr_1bit_left_att_helper(a, begin + 1, end, a_size); + uint64_t lo = a[begin_word_index - 1] & _bzhi_u64(-1, slot_size - shift); + // uint64_t lo = (a[begin_word_index - 1] << 1u) >> 1u; + uint64_t hi = last_bits << (slot_size - shift); + assert(!(lo & hi)); + a[begin_word_index - 1] = lo | hi; + } + + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + + void shift_arr_1bit_right_inside_single_word_robuster(uint64_t *a, size_t begin, size_t end, size_t a_size) { + // end -= (end * 16 == a_size); + if (begin >= end) return; + // assert(end % 16); + constexpr unsigned slot_size = sizeof(a[0]) * CHAR_BIT; + constexpr unsigned shift = 1u; + constexpr unsigned slot_mask = 63; + constexpr unsigned items_in_slots = slot_size / shift; + + assert(end % items_in_slots); + size_t index = begin / items_in_slots; + assert(index == (end / items_in_slots)); + + + size_t rel_begin = (begin * shift) & slot_mask; + size_t rel_end = (end * shift) & slot_mask; + uint64_t hi_mask = _bzhi_u64(-1, rel_end + shift); + uint64_t hi = a[index] & ~hi_mask; + + if (rel_begin == 0) { + // std::cout << "r0: " << std::endl; + uint64_t old_lo = a[index] & _bzhi_u64(-1, shift); + uint64_t lo = (a[index] << shift) & hi_mask; + // uint64_t hi = a[index] & ~hi_mask; + assert(!(lo & hi)); + assert(!(old_lo & hi)); + a[index] = old_lo | lo | hi; + return; + } + // std::cout << "r1: " << std::endl; + assert(rel_begin < rel_end); + uint64_t lo_mask = _bzhi_u64(-1, rel_begin); + uint64_t lo2 = a[index] & _bzhi_u64(-1, rel_begin + shift); + uint64_t mi3 = ((a[index] & ~lo_mask) << shift) & hi_mask; + + assert(!(lo2 & mi3) and !(lo2 & hi) and !(mi3 & hi)); + a[index] = lo2 | mi3 | hi; + + // uint64_t lo = a[index] & lo_mask; + // uint64_t mid = (a[index] << shift) & ((~lo_mask) & hi_mask); + // uint64_t mi2 = (a[index] & ((~lo_mask) & hi_mask)) << shift; + // std::cout << std::string(92, '=') << std::endl; + // std::cout << "lo: \t\t" << format_word_to_string(lo, 64); + // std::cout << "lo2: \t\t" << format_word_to_string(lo2, 64); + // std::cout << "mid: \t\t" << format_word_to_string(mid, 64); + // std::cout << "mi2: \t\t" << format_word_to_string(mi2, 64); + // std::cout << "mi3: \t\t" << format_word_to_string(mi3, 64); + // std::cout << "hi: \t\t" << format_word_to_string(hi, 64); + // assert(!(lo & mid) and !(lo & hi) and !(mid & hi)); + // assert(!(lo & mi2) and !(lo & hi) and !(mi2 & hi)); + // assert(!(lo2 & mi3) and !(lo2 & hi) and !(mi3 & hi)); + // assert(!(lo2 & mi2) and !(lo2 & mid) and !(lo2 & hi)); + // assert(!(lo2 & mi2) and !(lo2 & hi)); + // assert(!(lo2 & mi3) and !(lo2 & hi) and !(mi3 & hi)); + // std::cout << std::string(92, '=') << std::endl; + // a[index] = lo2 | mi2 | hi; + // a[index] = lo | mi2 | hi; + // a[index] = lo | mid | hi; + } + void shift_arr_1bit_right_inside_single_word_robuster8(uint8_t *a, size_t begin, size_t end) { + + if (begin >= end) return; + constexpr unsigned slot_size = sizeof(a[0]) * CHAR_BIT; + constexpr unsigned shift = 1u; + constexpr unsigned slot_mask = slot_size - 1; + constexpr unsigned items_in_slots = slot_size / shift; + + // assert(end % items_in_slots); + size_t index = begin / items_in_slots; + assert(index == (end / items_in_slots)); + + + size_t rel_begin = begin & slot_mask; + size_t rel_end = end & slot_mask; + uint64_t hi_mask = _bzhi_u64(-1, rel_end + shift); + uint64_t hi = a[index] & ~hi_mask; + + if (rel_begin == 0) { + // std::cout << "r0: " << std::endl; + uint64_t old_lo = a[index] & _bzhi_u64(-1, shift); + uint64_t lo = (a[index] << shift) & hi_mask; + // uint64_t hi = a[index] & ~hi_mask; + assert(!(lo & hi)); + assert(!(old_lo & hi)); + a[index] = old_lo | lo | hi; + return; + } + // std::cout << "r1: " << std::endl; + assert(rel_begin < rel_end); + uint64_t lo_mask = _bzhi_u64(-1, rel_begin); + uint64_t lo2 = a[index] & _bzhi_u64(-1, rel_begin + shift); + uint64_t mi3 = ((a[index] & ~lo_mask) << shift) & hi_mask; + + assert(!(lo2 & mi3) and !(lo2 & hi) and !(mi3 & hi)); + a[index] = lo2 | mi3 | hi; + } + + /** + * @brief We assume ((end % 16) != 0). + * + * @param a + * @param begin + * @param end + * @param a_size + */ + void shift_arr_1bit_right_att_helper(uint64_t *a, size_t begin, size_t end, size_t a_size) { + if (begin == end) return; + constexpr unsigned slot_size = sizeof(a[0]) * CHAR_BIT; + constexpr unsigned shift = 1u; + constexpr unsigned slot_mask = 63; + constexpr unsigned items_in_slots = slot_size / shift; + assert(items_in_slots * shift == slot_size); + + size_t begin_word_index = begin / slot_size; + // size_t rel_begin = begin & (items_in_slots - 1u); + size_t rel_end = end & (items_in_slots - 1u); + assert(rel_end); + size_t end_m1_word_index = end / slot_size; + + + if (begin_word_index == end_m1_word_index) { + // std::cout << "rr0" << std::endl; + return shift_arr_1bit_right_inside_single_word_robuster(a, begin, end, a_size); + } + + + size_t i = end_m1_word_index; + size_t lim = begin_word_index; + uint64_t last_word_backup = a[end_m1_word_index]; + + for (; i > lim; i--) { + auto hi = (a[i] << shift); + auto lo = a[i - 1] >> (slot_size - shift); + assert(i >= 1); + assert((lo & hi) == 0); + a[i] = lo | hi; + } + + shift_arr_1bit_right_inside_single_word_robuster(a, begin, begin | slot_mask, a_size); + + if (rel_end + 1 != items_in_slots) { + // std::cout << "rr1" << std::endl; + uint64_t last_mask = _bzhi_u64(-1, (rel_end + 1) * shift); + uint64_t last_lo = a[end_m1_word_index] & last_mask; + uint64_t last_hi = last_word_backup & ~last_mask; + assert(!(last_lo & last_hi)); + a[end_m1_word_index] = last_lo | last_hi; + } + } + + void shift_arr_1bit_right_att_wrapper(uint64_t *a, size_t begin, size_t end, size_t a_size) { + assert(end <= a_size * 64); + assert(begin <= end); + if (begin == end) return; + if (a_size == 1) { + return shift_arr_1bit_right_inside_single_word_robuster(a, begin, end, a_size); + } + constexpr unsigned slot_size = sizeof(a[0]) * CHAR_BIT; + constexpr unsigned shift = 1u; + // constexpr unsigned slot_mask = 63; + constexpr unsigned items_in_slots = slot_size / shift; + assert(items_in_slots * shift == slot_size); + + // size_t rel_begin = begin & (items_in_slots - 1); + size_t rel_end = end & (items_in_slots - 1); + if (rel_end) { + // std::cout << "h0" << std::endl; + return shift_arr_1bit_right_att_helper(a, begin, end, a_size); + } + size_t end_m1_word_index = (end - 1) / items_in_slots; + + if (end_m1_word_index + 1 == a_size) { + // std::cout << "h1" << std::endl; + assert(end / items_in_slots == a_size); + return shift_arr_1bit_right_att_helper(a, begin, end - 1, a_size); + } + assert(end / items_in_slots != a_size); + // std::cout << "h2" << std::endl; + uint64_t last_bits = a[end_m1_word_index]; + shift_arr_1bit_right_att_helper(a, begin, end - 1, a_size); + uint64_t lo = last_bits >> (slot_size - shift); + uint64_t hi = a[end_m1_word_index + 1] & ~(15ULL); + assert(!(lo & hi)); + a[end_m1_word_index + 1] = lo | hi; + } + + void shift_arr_1bit_right_att_wrapper8(uint8_t *a, size_t begin, size_t end, size_t a8_size) { + assert(end <= a8_size * 8); + assert(begin <= end); + if (begin == end) + return; + + size_t s64 = (end - begin + 63) / 64 + 2; + assert(s64 < 64); + u64 temper[s64]; + std::fill(temper, temper + s64, 0); + size_t bytes_to_copy = ((end - 1) / 8) - (begin / 8) + 1; + const size_t first_byte = (begin / 8); + memcpy(temper, a + first_byte, bytes_to_copy); + size_t new_start = begin & 7; + size_t new_end = end - (first_byte * 8); + shift_arr_1bit_right_att_wrapper(temper, new_start, new_end, s64); + memcpy(a + first_byte, temper, bytes_to_copy); + return; + } + + + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + void shift_arr_k_bits_left_att_wrapper(uint64_t *a, size_t begin, size_t end, size_t a_size, size_t k) { + assert(end * k <= a_size * 64); + assert(begin <= end); + if (begin == end) return; + constexpr unsigned slot_size = sizeof(a[0]) * CHAR_BIT; + const unsigned shift = k; + const unsigned slot_sh_capacity = slot_size / shift; + assert(slot_sh_capacity * shift == slot_size); + + size_t rel_begin = begin & (slot_sh_capacity - 1u); + if (rel_begin) { + // std::cout << "h0" << std::endl; + return shift_arr_4bits_left_att_helper(a, begin, end, a_size); + } + + if (begin == 0) { + // std::cout << "h1" << std::endl; + return shift_arr_4bits_left_att_helper(a, begin + 1, end, a_size); + } + + // std::cout << "h2" << std::endl; + size_t begin_word_index = begin / slot_sh_capacity; + uint64_t last_bits = a[begin_word_index]; + shift_arr_4bits_left_att_helper(a, begin + 1, end, a_size); + uint64_t lo = a[begin_word_index - 1] & _bzhi_u64(-1, slot_size - shift); + uint64_t hi = last_bits << (slot_size - shift); + assert(!(lo & hi)); + a[begin_word_index - 1] = lo | hi; + } + + void shift_arr_k_bits_right_att_wrapper(u8 *a, size_t begin, size_t end, size_t a8_size, size_t k) { + // size_t temp_k = k; + for (size_t i = 0; i < k; ++i) { + shift_arr_1bit_right_att_wrapper8(a, begin + i, end + i, a8_size); + } + } + + /** + * @brief We assume ((end % 16) != 0). + * + * @param a + * @param begin + * @param end + * @param a_size + */ + void shift_arr_4bits_right_att_helper(uint64_t *a, size_t begin, size_t end, size_t a_size) { + // assert(begin < end); //optimization. + if (begin == end) return; + constexpr unsigned slot_size = sizeof(a[0]) * CHAR_BIT; + constexpr unsigned shift = 4u; + constexpr unsigned slot_sh_capacity = slot_size / shift; + assert(slot_sh_capacity * shift == slot_size); + + size_t begin_word_index = begin >> shift; + // size_t rel_begin = begin & (slot_sh_capacity - 1u); + size_t rel_end = end & (slot_sh_capacity - 1u); + assert(rel_end); + size_t end_m1_word_index = end >> shift; + + + if (begin_word_index == end_m1_word_index) { + // std::cout << "rr0" << std::endl; + return shift_arr_4bits_right_inside_single_word_robuster(a, begin, end); + } + + size_t i = end_m1_word_index; + size_t lim = begin_word_index; + uint64_t last_word_backup = a[end_m1_word_index]; + + for (; i > lim; i--) { + auto hi = (a[i] << shift); + auto lo = a[i - 1] >> (slot_size - shift); + assert(i >= 1); + assert((lo & hi) == 0); + a[i] = lo | hi; + } + + shift_arr_4bits_right_inside_single_word_robuster(a, begin, begin | 15); + + if (rel_end + 1 != slot_sh_capacity) { + // std::cout << "rr1" << std::endl; + uint64_t last_mask = _bzhi_u64(-1, (rel_end + 1) * shift); + uint64_t last_lo = a[end_m1_word_index] & last_mask; + uint64_t last_hi = last_word_backup & ~last_mask; + assert(!(last_lo & last_hi)); + a[end_m1_word_index] = last_lo | last_hi; + } + } + + void shift_arr_4bits_right_att_wrapper(uint64_t *a, size_t begin, size_t end, size_t a_size) { + // ZoneScopedN("Shift-4Right"); + assert(end * 4 <= a_size * 64); + assert(begin <= end); + assert(begin < end);//optimization. + // if (begin == end) { + // return; + // } + constexpr unsigned slot_size = sizeof(a[0]) * CHAR_BIT; + constexpr unsigned shift = 4u; + constexpr unsigned slot_sh_capacity = slot_size / shift; + assert(slot_sh_capacity * shift == slot_size); + + // size_t rel_begin = begin & (slot_sh_capacity - 1); + size_t rel_end = end & (slot_sh_capacity - 1); + if (rel_end) { + // std::cout << "h0" << std::endl; + return shift_arr_4bits_right_att_helper(a, begin, end, a_size); + } + size_t end_m1_word_index = (end - 1) / slot_sh_capacity; + + if (end_m1_word_index + 1 == a_size) { + // std::cout << "h1" << std::endl; + assert(end / slot_sh_capacity == a_size); + return shift_arr_4bits_right_att_helper(a, begin, end - 1, a_size); + } + assert(end / slot_sh_capacity != a_size); + // std::cout << "h2" << std::endl; + uint64_t last_bits = a[end_m1_word_index]; + shift_arr_4bits_right_att_helper(a, begin, end - 1, a_size); + uint64_t lo = last_bits >> (slot_size - shift); + uint64_t hi = a[end_m1_word_index + 1] & ~(15ULL); + assert(!(lo & hi)); + a[end_m1_word_index + 1] = lo | hi; + } + + + void shift_arr_4bits_right_att_wrapper8_un(uint8_t *a, size_t begin4, size_t end4, size_t a_size8) { + assert(end4 <= a_size8 * 2); + assert(begin4 <= end4); + assert(begin4 < end4); + + constexpr unsigned slot_size = sizeof(a[0]) * CHAR_BIT; + constexpr unsigned shift = 4u; + constexpr unsigned slot_sh_capacity = slot_size / shift; + static_assert(slot_sh_capacity == 2); + assert(slot_sh_capacity * shift == slot_size); + + // size_t rel_begin = begin4 & (slot_sh_capacity - 1); + // size_t rel_end = end4 & (slot_sh_capacity - 1); + // size_t w_begin_index = begin4 / slot_sh_capacity; + // size_t w_end_index = end4 / slot_sh_capacity; + + size_t counter = end4 - begin4; + while (counter) { + size_t write_index = end4 / slot_sh_capacity; + size_t read_index = (end4 - 1) / slot_sh_capacity; + // u8 temp = (end4 & 1) ? a[read_index] & 0xf : (a[read_index] >> 4u); + if (end4 & 1) { + u8 tag = a[read_index] & 0xf; + a[write_index] = tag | (tag << 4u); + } else { + u8 tag = a[read_index] >> 4u; + a[write_index] = (a[write_index] & 0xf0) | tag; + } + counter--; + end4--; + } + } + + void shift_arr_4bits_left_att_wrapper8_sun(uint8_t *a, size_t begin4, size_t end4, size_t a_size8) { + assert(end4 <= a_size8 * 2); + assert(begin4 <= end4); + assert(begin4 < end4); + + constexpr unsigned slot_size = sizeof(a[0]) * CHAR_BIT; + constexpr unsigned shift = 4u; + constexpr unsigned slot_sh_capacity = slot_size / shift; + static_assert(slot_sh_capacity == 2); + assert(slot_sh_capacity * shift == slot_size); + + begin4 += !begin4; + // size_t rel_begin = begin4 & (slot_sh_capacity - 1); + // size_t rel_end = end4 & (slot_sh_capacity - 1); + // size_t w_begin_index = begin4 / slot_sh_capacity; + // size_t w_end_index = end4 / slot_sh_capacity; + + + size_t counter = end4 - begin4; + while (counter) { + size_t write_index = (begin4 - 1) / slot_sh_capacity; + size_t read_index = begin4 / slot_sh_capacity; + // u8 temp = (end4 & 1) ? a[read_index] & 0xf : (a[read_index] >> 4u); + if (begin4 & 1) { + u8 tag = a[read_index] >> 4u; + // a[write_index] = tag | (tag << 4u); + a[write_index] = (a[write_index] & 0xf0) | tag; + } else { + u8 tag = a[read_index] << 4u; + a[write_index] = (a[write_index] & 0xf) | tag; + } + counter--; + begin4++; + } + } + void shift_arr_4bits_left_att_wrapper8_un(uint8_t *a, size_t begin4, size_t end4, size_t a_size8) { + assert(end4 <= a_size8 * 2); + assert(begin4 <= end4); + assert(begin4 < end4); + if (begin4 == end4) return; + + constexpr unsigned slot_size = sizeof(a[0]) * CHAR_BIT; + constexpr unsigned shift = 4u; + constexpr unsigned slot_sh_capacity = slot_size / shift; + static_assert(slot_sh_capacity == 2); + assert(slot_sh_capacity * shift == slot_size); + + // size_t rel_begin = begin4 & (slot_sh_capacity - 1); + // size_t rel_end = end4 & (slot_sh_capacity - 1); + // size_t w_begin_index = begin4 / slot_sh_capacity; + // size_t w_end_index = end4 / slot_sh_capacity; + + size_t counter = end4 - begin4; + size_t byte_index = begin4 / 2; + if (begin4 & 1) { + u8 temp = a[byte_index]; + u8 new_tag = (temp & 0xf0) | (temp >> 4u); + a[byte_index] = new_tag; + + // a[byte_index] = ((a[byte_index]) & 0xf) | (a[byte_index + 1] << 4u); + byte_index++; + counter--; + } + size_t lim = counter / 2; + for (size_t i = 0; i < lim; ++i) { + u8 prev_data = a[byte_index + i]; + u8 new_data = (prev_data >> 4u) | (a[byte_index + i + 1] << 4u); + a[byte_index] = new_data; + } + if (counter & 1) { + assert(end4 & 1); + u8 temp = a[byte_index + lim]; + u8 new_tag = (temp & 0xf0) | (temp >> 4u); + a[byte_index + lim] = new_tag; + } + } + + void shift_4bits_right(uint8_t *array, uint16_t size) { + // https://stackoverflow.com/a/29514/5381404 + // I call left shift a right shift. + int i; + uint8_t shifted = 0x00; + uint8_t overflow = (0xF0 & array[0]) >> 4; + + for (i = (size - 1); i >= 0; i--) { + shifted = (array[i] << 4) | overflow; + overflow = (0xF0 & array[i]) >> 4; + array[i] = shifted; + } + } + + + void shift_arr_4bits_right_att_wrapper8_un2(uint8_t *a, size_t begin4, size_t end4, size_t a_size8) { + assert(end4 <= a_size8 * 2); + assert(begin4 <= end4); + assert(begin4 < end4); + + begin4 += !begin4; + size_t fixed_begin = (begin4 & 1) ? begin4 + 1 : begin4; + size_t fixed_end = (end4 & 1) ? end4 - 1 : end4; + size_t fixed_size = (fixed_end - fixed_begin) / 2; + shift_4bits_right(a + (fixed_begin / 2), fixed_size); + + assert(0); + } + + bool half_byte_read(const uint64_t *a, size_t half_byte_index) { + size_t byte_index = half_byte_index / 2; + if (half_byte_index & 1u) + return (((uint8_t const *) a)[byte_index]) >> 4u; + else { + return (((uint8_t const *) a)[byte_index]) & 0xf; + } + } + + /** + * @brief reads @a length items, each of max_cap 4 bits, starting from the @a half_byte_index, and compares them to @a rem4; + * + * @param a + * @param half_byte_index + * @param length + * @param rem4 + * @return true + * @return false + */ + bool half_byte_cmp(const uint64_t *a, size_t half_byte_index, size_t length, uint8_t rem4) { + //FIXME: to validate. + assert(rem4 <= 0xF); + size_t byte_index = half_byte_index / 2; + if (half_byte_index & 1u) { + uint8_t first = (((uint8_t const *) a)[byte_index]) >> 4u; + if (first == rem4) return true; + byte_index++; + length--; + } + uint8_t const *pointer = (uint8_t const *) a + byte_index; + size_t lim = length / 2; + for (size_t i = 0; i < lim; i++) { + uint8_t hi = (pointer[i] >> 4u) & 0xf; + uint8_t lo = pointer[i] & 0xf; + if (rem4 == hi) return true; + if (rem4 == lo) return true; + } + if (length & 1) { + uint8_t last_val = (pointer[lim] & 0xf); + return last_val == rem4; + } + + return false; + } + + int half_byte_cmp_get_index_for_db(const uint64_t *a, size_t half_byte_index, size_t length, uint8_t rem4) { + size_t counter = 0; + assert(rem4 <= 0xF); + size_t byte_index = half_byte_index / 2; + if (half_byte_index & 1u) { + uint8_t first = (((uint8_t const *) a)[byte_index]) >> 4u; + if (first == rem4) return 0; + counter++; + byte_index++; + length--; + } + uint8_t const *pointer = (uint8_t const *) a + byte_index; + size_t lim = length / 2; + for (size_t i = 0; i < lim; i++) { + uint8_t hi = (pointer[i] >> 4u) & 0xf; + uint8_t lo = pointer[i] & 0xf; + if (rem4 == lo) return counter; + counter++; + if (rem4 == hi) return counter; + counter++; + } + if (length & 1) { + uint8_t last_val = (pointer[lim] & 0xf); + if (last_val == rem4) return counter; + } + + return -1; + } + + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + + void update_byte(uint8_t *pointer, uint8_t rem4, bool should_update_hi) { + assert(rem4 < 16); + uint8_t new_byte = pointer[0]; + if (should_update_hi) { + uint8_t lo = new_byte & 0xf; + uint8_t hi = (rem4 << 4u); + pointer[0] = lo | hi; + } else { + uint8_t hi = new_byte & 0xf0; + uint8_t lo = rem4; + pointer[0] = lo | hi; + } + } + + + uint8_t read_4bits(const uint64_t *a, size_t index4, size_t a_size) { + assert(index4 < a_size * 16); + if (a_size == 1) { + uint8_t res = (a[0] << (4u * index4)) & 0xf; + return res; + } + const size_t w_index = (index4 + 15) / 16; + const size_t rel_index = index4 & 15u; + uint8_t res = (a[w_index] << (4u * rel_index)) & 0xf; + return res; + } + + uint8_t read_4bits(const uint8_t *a, size_t index4, size_t a_size) { + assert(index4 < a_size * 2); + if (a_size == 1) { + uint8_t res = (a[0] << (2 * index4)) & 0xf; + return res; + } + const size_t w_index = (index4 + 1) / 2; + const size_t rel_index = index4 & 1u; + uint8_t res = (a[w_index] << (2u * rel_index)) & 0xf; + return res; + } + + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + + void unpack_array(uint8_t *unpack_array, const uint8_t *packed_array, size_t packed_size) { + for (size_t i = 0; i < packed_size; ++i) { + uint8_t lo = packed_array[i] & 0xf; + uint8_t hi = (packed_array[i] & 0xf0) >> 4u; + unpack_array[i * 2] = lo; + unpack_array[i * 2 + 1] = hi; + } + } + + void pack_array(uint8_t *pack_array, const uint8_t *unpacked_array, size_t unpacked_size) { + for (size_t i = 0; i < unpacked_size; i += 2) { + size_t index = i / 2; + uint8_t lo = unpacked_array[i]; + uint8_t hi = unpacked_array[i + 1]; + assert(lo < 16); + assert(hi < 16); + uint8_t val = (hi << 4u) | lo; + pack_array[index] = val; + } + } + + void unpack_array8x2(uint8_t *unpacked_array, const uint8_t *pack_array, size_t packed_size) { + for (size_t i = 0; i < packed_size; ++i) { + size_t index = i * 4; + for (size_t j = 0; j < 4; ++j) { + unpacked_array[index + j] = ((pack_array[i] >> (2 * j)) & 3); + } + } + } + + void pack_array8x2(uint8_t *pack_array, const uint8_t *unpacked_array, size_t unpacked_size) { + for (size_t i = 0; i < unpacked_size; i += 4) { + size_t index = i / 4; + const u8 *mp = unpacked_array + i; + u8 val = mp[0] | (mp[1] << 2) | (mp[2] << 4) | (mp[3] << 6); + pack_array[index] = val; + } + } + + void memcpy_for_vec(uint8_t *pack_array, const std::vector *b_vec) { + size_t i = 0; + const size_t V1_size = b_vec->size(); + const size_t V8_size = (b_vec->size()) / 8; + + for (; i < V8_size; i++) { + size_t index = i * 8; + u8 temp_word = 0; + for (int j = 7; j >= 0; j--) { + temp_word <<= 1; + temp_word |= b_vec->at(index + j); + } + pack_array[i] = temp_word; + } + + if (!(V1_size & 7)) + return; + + size_t index = V8_size * 8; + size_t offset = V1_size & 7; + u8 temp_word = 0; + for (int j = offset; j >= 0; j--) { + temp_word <<= 1; + temp_word |= b_vec->at(index + j); + } + pack_array[i] = temp_word; + } + + void pack_array_gen_k(u8 *pack_array, const u32 *unpacked_array, size_t items, size_t k) { + const size_t V8_size = (k * items + 7) / 8; + std::vector b_vec(V8_size * 8, false); + for (size_t i = 0; i < items; i++) { + size_t index = i * k; + u32 temp_word = unpacked_array[i]; + for (size_t j = 0; j < k; j++) { + b_vec.at(index + j) = temp_word & 1; + temp_word >>= 1; + } + } + // auto mp = &b_vec[0]; + memcpy_for_vec(pack_array, &b_vec); + } + void pack_array_gen_k_with_offset(u8 *pack_array, const u32 *unpacked_array, size_t items, size_t k, size_t offset) { + u8 backup = pack_array[0]; + pack_array_gen_k(pack_array, unpacked_array, items, k); + std::cout << "Here!1551: " << std::endl; + // shift_arr_k_bits_left_att_wrapper(pack_array, 0, items * k, k); + } + + + + void unpack_array_gen_k_with_offset(u32 *unpack_array, const u8 *packed_array, size_t items, size_t k, size_t offset) { + assert(k <= 32); + + size_t start = offset; + for (size_t i = 0; i < items; i++) { + u32 temp_item = bitsMani::extract_bits(packed_array, start, start + k); + unpack_array[i] = temp_item; + start += k; + } + } + + void unpack_array_gen_k(u32 *unpack_array, const u32 *packed_array, size_t items, size_t k) { + const size_t V1_size_exact = k * items; + const size_t V8_size_round = (k * items + 7) / 8; + std::vector b_vec(V8_size_round * 8, false); + for (size_t i = 0; i < V1_size_exact; ++i) { + bool bit = packed_array[i / 32] & (1 << (i & 31)); + bool bit2 = _bextr_u64(packed_array[i / 32], i & 31, 1); + assert(bit == bit2); + b_vec.at(i) = bit; + } + /*for (size_t i = 0; i < V1_size_exact; ++i) { + std::cout << b_vec.at(i); + } + std::cout << std::endl;*/ + /*for (size_t i = 0; i < items; i++) { + size_t index = i * k; + u32 temp_word = 0; + for (int j = k - 1; j >= 0; j--) { + temp_word <<= 1; + temp_word |= b_vec.at(index + j); + } + unpack_array[i] = temp_word; + }*/ + for (size_t i = 0; i < items; i++) { + size_t index = i * k; + u32 temp_word = 0; + u64 b = 1ULL; + for (size_t h = 0; h < k; h++) { + bool temp_val = b_vec.at(index + h); + if (temp_val) temp_word |= b; + b <<= 1u; + } + unpack_array[i] = temp_word; + } + } + + bool test_pack_unpack(const uint8_t *pack_a, size_t pack_size) { + size_t unpack_size = pack_size * 2; + uint8_t unpack_of_a[unpack_size]; + init_array(unpack_of_a, unpack_size); + unpack_array(unpack_of_a, pack_a, pack_size); + uint8_t pack_res[pack_size]; + init_array(pack_res, pack_size); + pack_array(pack_res, unpack_of_a, unpack_size); + + int cmp_res = memcmp(pack_a, pack_res, pack_size); + return cmp_res == 0; + } + + + /* u32 pack4x8_as_4x6(const u8 *unpackArray) { + assert(*std::max_element(unpackArray, unpackArray + 4) <= 63); + + u32 r1 = unpackArray[0] | ((u32) unpackArray[1] << 6u); + u32 r2 = unpackArray[2] | ((u32) unpackArray[3] << 6u); + u32 res = r1 | (r2 << 12u); + + assert(res <= _bzhi_u64(-1, 6 * 4)); + return res; + } + u32 pack7x6_as_5x8(const u8 *unpackArray) { + assert(*std::max_element(unpackArray, unpackArray + 4) <= 63); + + u64 r1 = unpackArray[0] | ((u32) unpackArray[1] << 6u); + u64 r2 = unpackArray[2] | ((u32) unpackArray[3] << 6u); + u64 r3 = unpackArray[2] | ((u32) unpackArray[3] << 6u); + u64 r4 = unpackArray[2] | ((u32) unpackArray[3] << 6u); + u64 r5 = unpackArray[2] | ((u32) unpackArray[3] << 6u); + u32 res = r1 | (r2 << 12u); + + assert(res <= _bzhi_u64(-1, 6 * 4)); + return res; + } + */ + + u32 unpack4x6_as_4x8(u32 packed) { + // assert(*std::max_element(a, a + 4) <= 63); + + u32 x1 = packed & 63; + u32 x2 = ((packed >> 6) & 63) << 8; + u32 x3 = ((packed >> 12) & 63) << 16; + u32 x4 = ((packed >> 18) & 63) << 24; + + return x1 | x2 | x3 | x4; + } + + u64 unpack8x6_as_8x8(u64 packed) { + // assert(*std::max_element(a, a + 4) <= 63); + // constexpr uint64_t mask0 = 0x3f3f'3f3f; + constexpr uint64_t mask = 0x3f3f'3f3f'3f3f'3f3f; + u64 res = _pdep_u64(packed, mask); + // u64 res0 = _pdep_u64(packed, mask); + return res; + // return _pext_u64(packed, mask); + } + + u64 pack8x8_as_8x6(u64 unpacked) { + constexpr uint64_t mask = 0x3f3f'3f3f'3f3f'3f3f; + static_assert(__builtin_popcountll(mask) == 48); + return _pdep_u64(unpacked, mask); + // return _pext_u64(packed, mask); + } + + u32 pack4x8_as_4x6(const u8 unpackArray[4]) { + + u32 r1 = (unpackArray[0] & 63) | (((u32) unpackArray[1] & 63) << 6u); + u32 r2 = (unpackArray[2] & 63) | (((u32) unpackArray[3] & 63) << 6u); + u32 res = r1 | (r2 << 12u); + + assert(res <= _bzhi_u64(-1, 6 * 4)); + return res; + } + + void pack6x8(u8 *packedArray, const u8 *unpackArray, size_t packed_size) { + // const size_t items = packed_size + packed_size / 2; + const size_t items = packed_size * 4 / 3; + const size_t reps = (items + 3) / 4; + size_t p_index = 0; + size_t up_index = 0; + for (size_t i = 0; i < reps; i++) { + u32 packed_value = pack4x8_as_4x6(unpackArray + up_index); + memcpy(packedArray + p_index, &packed_value, 3); + + p_index += 3; + up_index += 4; + } + + size_t items_left = packed_size & 3; + u8 temp_arr[4] = {0}; + memcpy(temp_arr, unpackArray + up_index, items_left); + u32 packed_value = pack4x8_as_4x6(temp_arr); + memcpy(packedArray + p_index, &packed_value, (items_left * 6 + 7) / 8); + } + + void unpack6x8(u8 *unpackArray, const u8 *packedArray, size_t packed_size) { + // const size_t items = packed_size + packed_size / 2; + const size_t items = packed_size * 4 / 3; + const size_t reps = (items + 3) / 4; + size_t p_index = 0; + size_t up_index = 0; + for (size_t i = 0; i < reps; i++) { + u32 packed_value = 0; + memcpy(&packed_value, packedArray + p_index, 3); + u32 unpacked_value = unpack4x6_as_4x8(packed_value); + memcpy(unpackArray + up_index, &unpacked_value, 4); + + p_index += 3; + up_index += 4; + } + size_t items_left = packed_size & 3; + u32 packed_value = 0; + memcpy(&packed_value, packedArray + p_index, (items_left * 6 + 7) / 8); + u32 unpacked_value = unpack4x6_as_4x8(packed_value); + memcpy(unpackArray + up_index, &unpacked_value, items_left); + } + + + bool memcmp_1bit(const uint64_t *a, const uint64_t *b, size_t size1) { + return memcmp_1bit((const uint8_t *) a, (const uint8_t *) b, size1); + } + + bool memcmp_1bit(const uint8_t *a, const uint8_t *b, size_t size1) { + assert(size1 > 0); + size_t size8 = (size1 + 7) / 8; + if ((size1 & 7) == 0) { + return memcmp(a, b, size8) == 0; + } + + bool temp = (memcmp(a, b, size8 - 1u) == 0); + if (!temp) return false; + + + size_t rel_index = size1 & 7; + uint8_t mask = (1u << rel_index) - 1u; + + uint8_t h1 = a[size8 - 1]; + uint8_t h2 = b[size8 - 1]; + + return (h1 & mask) == (h2 & mask); + } + + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + + + void insert_push_4bit_ultra_naive(u8 *packedArray, size_t packedSize, size_t index4, u8 item) { + return insert_push_4bit_by_shift(packedArray, packedSize, index4, item); + assert(item < 16u); + assert(index4 < packedSize * 2); + assert(2 <= packedSize); + + u8 backup_a[packedSize]; + memcpy(backup_a, packedArray, packedSize); + + const size_t unpack_size = packedSize * 2; + u8 unpack_arr[unpack_size]; + init_array(unpack_arr, unpack_size); + unpack_array(unpack_arr, packedArray, packedSize); + + // const u8 index_byte = packedArray[packedSize - 1]; + // u8 prev_last = index_byte >> 4u; + + u8 *mp = unpack_arr + index4; + size_t btc = unpack_size - (index4 + 1); + memmove(mp + 1, mp, btc); + mp[0] = item; + // assert(unpack_arr[unpack_size - 1] == prev_last); // this was commented, because I tried to use a trick in swap-split-insert easy case. + pack_array(packedArray, unpack_arr, unpack_size); + assert(check::validate_insert_push_4bit(backup_a, packedArray, packedSize, index4, item)); + } + + void insert_push_4bit_by_shift(u8 *packedArray, size_t packedSize, size_t index4, u8 item) { + // static int A[4] = {0}; + // A[0]++; + assert(item < 16u); + assert(index4 < packedSize * 2); + assert(2 <= packedSize); + +#ifndef NDEBUG + u8 backup_a[packedSize]; + memcpy(backup_a, packedArray, packedSize); +#endif + size_t start4 = index4; + size_t end4 = packedSize * 2 - 1; + size_t size64 = (packedSize + 7) / 8; + shift_arr_4bits_right_att_wrapper((u64 *) packedArray, start4, end4, size64); + size_t byte_index = index4 / 2; + if (!(index4 & 1)) { + // A[1]++; + packedArray[byte_index] = (packedArray[byte_index] & 0xf0) | item; + } else { + // A[2]++; + packedArray[byte_index] = (packedArray[byte_index] & 0xf) | (item << 4u); + } + + assert(check::validate_insert_push_4bit(backup_a, packedArray, packedSize, index4, item)); + return; + } + + + void insert_push_4bit_disjoint_pair(u8 *packedArray, size_t packedSize, size_t index4, u8 rem1, u8 rem2) { + // static int A[4] = {0}; + // A[0]++; + assert((rem1 < 16u) and (rem2 < 16)); + assert(index4 < packedSize * 2); + assert(index4 != 0);//it might work, but that was not the intention, and this case should be treated differently, (more efficient). + assert(2 <= packedSize); + + +#ifndef NDEBUG + u8 backup_a[packedSize]; + memcpy(backup_a, packedArray, packedSize); +#endif + size_t byte_index = index4 / 2; + u8 *mp = packedArray + byte_index; + size_t bytes_to_move = packedSize - (byte_index + 1); + memmove(mp + 1, mp, bytes_to_move); +#ifndef NDEBUG + u8 dont_change = mp[1]; +#endif + fix_byte2(packedArray + byte_index, index4 & 1, rem2); + + size_t size64 = (packedSize + 7) / 8; + shift_arr_4bits_right_att_wrapper((u64 *) packedArray, 0, index4 + 1, size64); + packedArray[0] = (packedArray[0] & 0xf0) | rem1; + assert((mp[1] & 0xf0) == (dont_change & 0xf0)); + + assert(check::validate_insert_push_4bit_disjoint_pair(backup_a, packedArray, packedSize, index4, rem1, rem2)); + // assert(test::validate_insert_push_4bit_disjoint_pair(backup_a, packedArray, packedSize, index4 + 1, rem1, rem2)); + } + + void insert_push_4bit_disjoint_pair_reversed_array(u8 *packedArray, size_t packedSize, size_t index4, u8 rem1, u8 rem2) { + // static int A[4] = {0}; + // A[0]++; + assert((rem1 < 16u) and (rem2 < 16)); + assert(index4 < packedSize * 2); + assert(index4 != 0);//it might work, but that was not the intention, and this case should be treated differently, (more efficient). + assert(2 <= packedSize); + auto s0 = str_bitsMani::str_array_half_byte_aligned(packedArray, packedSize); + const size_t size_m1 = packedSize - 1; + const size_t byte_index = index4 / 2; + const size_t rev_byte_index = size_m1 - byte_index; +#ifndef NDEBUG + u8 backup_a[packedSize]; + memcpy(backup_a, packedArray, packedSize); +#endif + + size_t end4 = packedSize * 2 - 2; + size_t begin4 = (packedSize - 1) * 2 - index4; + shift_arr_4bits_right_att_wrapper8_un(packedArray, begin4, end4, packedSize); + auto s1 = str_bitsMani::str_array_half_byte_aligned(packedArray, packedSize); + fix_byte2(packedArray + rev_byte_index, (index4 & 1), rem2); + auto s2 = str_bitsMani::str_array_half_byte_aligned(packedArray, packedSize); + + std::cout << std::string(80, 'x') << std::endl; + std::cout << "s0: \n" + << s0 << std::endl; + std::cout << "s1: \n" + << s1 << std::endl; + std::cout << "s2: \n" + << s2 << std::endl; + + std::cout << "arguments:" << std::endl; + std::cout << "begin4: \t" << begin4 << std::endl; + std::cout << "end4: \t" << end4 << std::endl; + std::cout << "rem1: \t" << (u16) rem1 << std::endl; + std::cout << "rem2: \t" << (u16) rem2 << std::endl; + std::cout << "index4: \t" << index4 << std::endl; + std::cout << "size: \t" << packedSize << std::endl; + std::cout << "" << std::endl; + std::cout << std::string(80, 'x') << std::endl; + + // packedArray[size_m1] = (packedArray[size_m1] & 0xf0) | rem1; + assert((packedArray[size_m1] & 0xf0) == (rem1 << 4u)); + } + + void insert_push_4bit_disjoint_pair_reversed_array_by_push(u8 *packedArray, size_t packedSize, size_t index4, u8 rem1, u8 rem2) { + assert((rem1 < 16u) and (rem1 < 16u)); + assert(index4 < packedSize * 2); + assert(2 <= packedSize); + assert(packedSize <= 1024); + u8 backup_a[packedSize]; + memcpy(backup_a, packedArray, packedSize); + + const size_t unpack_size = packedSize * 2; + // const size_t unpack_last = unpack_size - 1; + u8 unpack_arr[unpack_size]; + init_array(unpack_arr, unpack_size); + unpack_array(unpack_arr, packedArray, packedSize); + + u8 *mp = unpack_arr + (unpack_size - 2) - index4; + size_t btc = index4; + int res_m1 = (unpack_arr + unpack_size) - (mp + 1 + btc); + assert(res_m1 == 1); + memmove(mp + 1, mp, btc); + mp[0] = rem2; + unpack_arr[(unpack_size - 1)] = rem1; + pack_array(packedArray, unpack_arr, unpack_size); + // assert(test::validate_insert_push_4bit(backup_a, packedArray, packedSize, index4, item)); + } + + void insert_push_4bit_disjoint_pair_reversed_array_naive(u8 *packedArray, size_t packedSize, size_t index4, u8 rem1, u8 rem2) { + //FIXME::this is a naive implementation only. + assert((rem1 < 16u) and (rem2 < 16)); + assert(index4 < packedSize * 2); + assert(index4 != 0);//it might work, but that was not the intention, and this case should be treated differently, (more + assert(2 <= packedSize); + const size_t rev_index4 = (packedSize - 1) * 2 - index4; +#ifndef NDEBUG + u8 backup_a[packedSize]; + memcpy(backup_a, packedArray, packedSize); +#endif + + std::cout << "input:" << std::endl; + std::cout << str_bitsMani::str_array_half_byte_aligned(packedArray, packedSize); + + reverse_4_bits_array_in_place(packedArray, packedSize); + std::cout << "reversed:" << std::endl; + std::cout << str_bitsMani::str_array_half_byte_aligned(packedArray, packedSize); + + std::cout << "arguments:" << std::endl; + std::cout << "rem1: \t" << (u16) rem1 << std::endl; + std::cout << "rem2: \t" << (u16) rem2 << std::endl; + std::cout << "index4: \t" << index4 << std::endl; + std::cout << "Rindex4:\t" << rev_index4 << std::endl; + std::cout << "size: \t" << packedSize << std::endl; + std::cout << "" << std::endl; + + + insert_push_4bit_disjoint_pair(packedArray, packedSize, rev_index4, rem1, rem2); + + std::cout << "after:" << std::endl; + std::cout << str_bitsMani::str_array_half_byte_aligned(packedArray, packedSize); + + + reverse_4_bits_array_in_place(packedArray, packedSize); + std::cout << "re-reversed:" << std::endl; + std::cout << str_bitsMani::str_array_half_byte_aligned(packedArray, packedSize); + // assert(test::validate_insert_push_4bit_disjoint_pair(backup_a, packedArray, packedSize, index4, rem1, rem2)); + // assert(test::validate_insert_push_4bit_disjoint_pair(backup_a, packedArray, packedSize, index4 + 1, rem1, rem2)); + } + + + void delete_pull_4bit_ultra_naive_small_size_array(u8 *a, size_t index4, u8 item) { + assert(item < 16u); + if (index4 == 0) { + u8 masked_val = (a[0] >> 4u) << 4u; + a[0] = (masked_val | item); + return; + } + u8 masked_val = a[0] & 0xf; + a[0] = (masked_val | (item << 4u)); + return; + } + + void delete_pull_4bit_ultra_naive(u8 *packedArray, size_t packedSize, size_t index4, u8 item) { + assert(item < 16u); + assert(index4 < packedSize * 2); + // if (packedSize == 1) + // return delete_pull_4bit_ultra_naive_small_size_array(packedArray, index4, item); + + if (index4 < 2) { + return delete_pull_4bit_ultra_naive_small_size_array(packedArray, index4, item); + } + + u8 backup_a[packedSize]; + memcpy(backup_a, packedArray, packedSize); + + const size_t unpack_size = packedSize * 2; + u8 unpack_arr[unpack_size]; + init_array(unpack_arr, unpack_size); + unpack_array(unpack_arr, packedArray, packedSize); + + // const u8 index_byte = packedArray[packedSize - 1]; + // u8 prev_last = index_byte >> 4u; + + u8 *mp = unpack_arr + index4; + size_t btc = unpack_size - (index4 + 1); + memmove(unpack_arr, unpack_arr + 1, btc); + mp[0] = item; + // assert(unpack_arr[unpack_size - 1] == prev_last); // this was commented, because I tried to use a trick in swap-split-insert easy case. + pack_array(packedArray, unpack_arr, unpack_size); + assert(check::validate_insert_push_4bit(backup_a, packedArray, packedSize, index4, item)); + } + + void insert_push_4bit_ultra_naive_by_unpackSize(u8 *packedArray, size_t packedSize, size_t index4, u8 item, + size_t unpackSize) { + assert(item < 16u); + assert(index4 < packedSize * 2); + assert(packedSize < 2); + u8 backup_a[packedSize]; + memcpy(backup_a, packedArray, packedSize); + + const size_t unpack_size = unpackSize; + u8 unpack_arr[unpack_size]; + init_array(unpack_arr, unpack_size); + unpack_array(unpack_arr, packedArray, packedSize); + + // const u8 index_byte = packedArray[packedSize - 1]; // Keep this -> + // u8 prev_last = index_byte >> 4u; + u8 *mp = unpack_arr + index4; + size_t btc = unpack_size - (index4 + 1); + memmove(mp + 1, mp, btc); + mp[0] = item; + // assert(unpack_arr[unpack_size - 1] == prev_last); // this was commented, because I tried to use a trick in swap-split-insert easy case. + pack_array(packedArray, unpack_arr, unpack_size); + assert(check::validate_insert_push_4bit(backup_a, packedArray, packedSize, index4, item)); + } + + + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + __uint128_t get_4bits_cmp_vector(const uint64_t *a, size_t start4, size_t length, uint8_t rem4) { + assert(length < UINT64_MAX); + __uint128_t res = 0; + __uint128_t b = 1; + + // size_t counter = 0; + assert(rem4 <= 0xF); + size_t byte_index = start4 / 2; + if (start4 & 1u) { + uint8_t first = (((uint8_t const *) a)[byte_index]) >> 4u; + if (first == rem4) res |= b; + // counter++; + byte_index++; + length--; + b <<= 1; + } + uint8_t const *pointer = (uint8_t const *) a + byte_index; + size_t lim = length / 2; + for (size_t i = 0; i < lim; i++) { + uint8_t hi = (pointer[i] >> 4u) & 0xf; + uint8_t lo = pointer[i] & 0xf; + + if (rem4 == lo) res |= b; + b <<= 1; + + if (rem4 == hi) res |= b; + b <<= 1; + } + if (length & 1) { + uint8_t last_val = (pointer[lim] & 0xf); + if (last_val == rem4) res |= b; + } + + return res; + } + + + u16 get_4bits_cmp_on_word(const u8 word[8], uint8_t rem4) { + u16 res = 0; + u64 b = 1ULL; + u8 lo_rem = rem4; + u8 hi_rem = rem4 << 4u; + + /* bool f; // conditional flag + unsigned int m;// the bit mask + unsigned int w;// the word to modify: if (f) w |= m; else w &= ~m; + + w ^= (-f ^ w) & m;*/ + + for (size_t i = 0; i < 8; i++) { + if ((word[i] & 0xf) == lo_rem) res |= b; + b <<= 1; + if ((word[i] & 0xf0) == hi_rem) res |= b; + b <<= 1; + } + return res; + } + + u16 get_4bits_cmp_on_word3(const u8 word[8], uint8_t rem4, size_t length) { + u16 res = 0; + u64 b = 1ULL; + u8 lo_rem = rem4; + u8 hi_rem = rem4 << 4u; + + /* bool f; // conditional flag + unsigned int m;// the bit mask + unsigned int w;// the word to modify: if (f) w |= m; else w &= ~m; + + w ^= (-f ^ w) & m;*/ + + for (size_t i = 0; i < length; i++) { + if ((word[i] & 0xf) == lo_rem) res |= b; + b <<= 1; + if ((word[i] & 0xf0) == hi_rem) res |= b; + b <<= 1; + } + return res; + } + + + u16 get_4bits_cmp16(const uint64_t *a, size_t start4, uint8_t rem4) { + u64 h1 = extract_word(a, start4); + return get_4bits_cmp_on_word((const u8 *) (&h1), rem4); + } + + + u16 get_4bits_cmp16_ranged1(const uint64_t *a, size_t start4, uint8_t rem4, size_t length) { + assert(length < 16); + assert(length < 15); + size_t byte_index = start4 / 2; + auto mp = (const u8 *) a + byte_index; + u64 h1; + memcpy(&h1, mp, 8); + if (start4 & 1) h1 >>= 4u; + + auto temp_arr = (const u8 *) (&h1); + // u16 res_mask = get_4bits_cmp_on_word3(temp_arr, rem4, length / 2); + assert(0); + return -1; + + } + + u16 get_4bits_cmp16_ranged2(const uint64_t *a, size_t start4, uint8_t rem4, size_t length) { + assert(length < 16); + size_t byte_index = start4 / 2; + // auto mp = (const u8 *) a + byte_index; + u16 cmp_mask = get_4bits_cmp_on_word((const u8 *) a + byte_index, rem4); + u8 shift = 4 * (start4 & 1); + return (cmp_mask >> shift) & _bzhi_u64(-1, length); + } + + u16 get_4bits_cmp16_ranged3(const uint64_t *a, size_t start4, uint8_t rem4, size_t length) { + assert(length < 16); + size_t byte_index = start4 / 2; + // auto mp = (const u8 *) a + byte_index; + u16 cmp_mask = get_4bits_cmp_on_word((const u8 *) a + byte_index, rem4); + return cmp_mask >> (start4 & 1); + } + + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + void reverse_4_bits_array_naive(const u8 *a, u8 *rev_a, size_t packed_size) { + const size_t unpack_size = packed_size * 2; + assert(unpack_size < (1ULL << 16));// sanity check + u8 *unpack_a = new u8[unpack_size]; + + unpack_array(unpack_a, a, packed_size); + std::reverse(unpack_a, unpack_a + unpack_size); + + pack_array(unpack_a, rev_a, unpack_size); + delete[] unpack_a; + } + + void reverse_4_bits_array(const u8 *a, u8 *rev_a, size_t packed_size) { + assert(a != rev_a); + const size_t last_i = packed_size - 1; + for (size_t i = 0; i < packed_size; i++) { + rev_a[i] = flip2x4(a[last_i - i]); + } + } + + void reverse_4_bits_array_in_place(u8 *a, size_t packed_size) { + if (packed_size == 0) { + std::cout << "rev4 in place with size zero." << std::endl; + return; + } + if (packed_size == 1) { + a[0] = flip2x4(a[0]); + return; + } + + const size_t last_i = packed_size - 1; + size_t i = 0; + for (; i + i < last_i; i++) { + u8 x = a[i]; + u8 y = a[last_i - i]; + a[i] = flip2x4(y); + a[last_i - i] = flip2x4(x); + } + if (i + i == last_i) + a[i] = flip2x4(a[i]); + } + +}// namespace Shift_op + + +namespace Shift_op::check { + + bool test_rev4_bits_arr(const u8 *a, size_t packed_size) { + u8 *rev_a1 = new u8[packed_size]; + u8 *rev_a2 = new u8[packed_size]; + + reverse_4_bits_array(a, rev_a1, packed_size); + reverse_4_bits_array(rev_a1, rev_a2, packed_size); + + int res = memcmp(rev_a2, a, packed_size); + if (res == 0) { + delete[] rev_a1; + delete[] rev_a2; + return true; + } + + auto s0 = str_bitsMani::str_array_half_byte_aligned(a, packed_size); + auto s1 = str_bitsMani::str_array_half_byte_aligned(rev_a1, packed_size); + auto s2 = str_bitsMani::str_array_half_byte_aligned(rev_a2, packed_size); + delete[] rev_a1; + delete[] rev_a2; + assert(0); + return false; + } + + bool test_rev4_bits_in_place(const u8 *a, size_t packed_size) { + u8 *rev_a1 = new u8[packed_size]; + u8 *rev_a2 = new u8[packed_size]; + u8 *rev_a3 = new u8[packed_size]; + + + memcpy(rev_a3, a, packed_size); + reverse_4_bits_array_in_place(rev_a3, packed_size); + + auto s_a = str_bitsMani::str_array_half_byte_aligned(a, packed_size); + auto s3 = str_bitsMani::str_array_half_byte_aligned(rev_a3, packed_size); + + reverse_4_bits_array(a, rev_a1, packed_size); + bool cmp1 = (memcmp(rev_a3, rev_a1, packed_size) == 0); + if (!cmp1) { + auto s1 = str_bitsMani::str_array_half_byte_aligned(rev_a1, packed_size); + std::cout << "sa: \n" + << s_a << std::endl; + + std::cout << "s1: \n" + << s1 << std::endl; + + std::cout << "s3: \n" + << s3 << std::endl; + } + assert(cmp1); + reverse_4_bits_array(rev_a1, rev_a2, packed_size); + + reverse_4_bits_array_in_place(rev_a3, packed_size); + bool cmp2 = (memcmp(rev_a3, rev_a2, packed_size) == 0); + assert(cmp2); + + bool cmp3 = (memcmp(rev_a3, a, packed_size) == 0); + assert(cmp3); + + delete[] rev_a1; + delete[] rev_a2; + delete[] rev_a3; + return true; + } + + bool test_shift4_right_r() { + constexpr size_t a_size = 64; + u64 a[a_size] = {0}; + for (size_t i = 0; i < a_size; i++) { + a[i] = random() ^ random(); + } + + u64 val[a_size] = {0}; + u8 att[a_size * 8] = {0}; + + constexpr size_t reps = 1ULL << 12u; + size_t range = a_size / 4; + for (size_t i = 0; i < reps; i++) { + memcpy(val, a, a_size * 8); + memcpy(att, a, a_size * 8); + assert(memcmp(att, val, a_size * 8) == 0); + size_t begin4 = 0; + size_t end4 = 0; + while (end4 <= begin4) { + begin4 = random() % range; + end4 = random() % range; + } + + + shift_arr_4bits_right_att_wrapper(val, begin4, end4, a_size); + shift_arr_4bits_right_att_wrapper8_un(att, begin4, end4, a_size * 8); + assert(memcmp(att, val, a_size * 8) == 0); + } + return true; + } + + bool test_shift4_left_r() { + constexpr size_t a_size = 64; + u64 a[a_size] = {0}; + for (size_t i = 0; i < a_size; i++) { + a[i] = random() ^ random(); + } + + u64 val[a_size] = {0}; + u8 att[a_size * 8] = {0}; + + constexpr size_t reps = 1ULL << 12u; + size_t range = a_size; + for (size_t i = 0; i < reps; i++) { + memcpy(val, a, a_size * 8); + memcpy(att, a, a_size * 8); + assert(memcmp(att, val, a_size * 8) == 0); + size_t begin4 = 0; + size_t end4 = 0; + // while ((end4 <= begin4) or (begin4 == 0)) { + while (end4 <= begin4) { + begin4 = random() % range; + end4 = random() % range; + } + + + shift_arr_4bits_left_att_wrapper(val, begin4, end4, a_size); + shift_arr_4bits_left_att_wrapper8_sun(att, begin4, end4, a_size * 8); + bool ok = memcmp(att, val, a_size * 8) == 0; + + if (ok) + continue; + + + size_t offset = begin4 / 2; + if ((offset & 1) and (offset > 1)) offset--; + size_t interval = (end4 - begin4 + 1) / 2; + auto s0 = str_bitsMani::str_array_half_byte_aligned((const u8 *) a + offset, interval); + auto s1 = str_bitsMani::str_array_half_byte_aligned(att + offset, interval); + auto s2 = str_bitsMani::str_array_half_byte_aligned((const u8 *) val + offset, interval); + auto s0_full = str_bitsMani::str_array_half_byte_aligned((const u8 *) a, a_size); + auto s1_full = str_bitsMani::str_array_half_byte_aligned(att, a_size); + auto s2_full = str_bitsMani::str_array_half_byte_aligned((const u8 *) val, a_size); + + std::cout << std::string(80, '=') << std::endl; + std::cout << "i: \t" << i << std::endl; + std::cout << "begin4: \t" << begin4 << std::endl; + std::cout << "end4: \t" << end4 << std::endl; + std::cout << "offset: \t" << offset << std::endl; + std::cout << "interval:\t" << interval << std::endl; + std::cout << std::string(80, '~') << std::endl; + std::cout << s0 << std::endl; + std::cout << s1 << std::endl; + std::cout << s2 << std::endl; + std::cout << std::string(80, '~') << std::endl; + std::cout << s0_full << std::endl; + std::cout << s1_full << std::endl; + std::cout << s2_full << std::endl; + std::cout << std::string(80, '=') << std::endl; + + // std::cout << std::string(80, '=') << std::endl; + // std::cout << std::string(80, '=') << std::endl; + + // auto s3 = str_bitsMani::str_array_half_byte_aligned((const u8 *) a, a_size * 8); + // auto s4 = str_bitsMani::str_array_half_byte_aligned(att, a_size * 8); + // auto s5 = str_bitsMani::str_array_half_byte_aligned((const u8 *) val, a_size * 8); + + + assert(memcmp(att, val, a_size * 8) == 0); + } + return true; + } + + /* void insert_push_4bit_disjoint_pair_reversed_array(u8 *pre_a, u8 *post_a, size_t packed_size, size_t index4, u8 first_in_queue, u8 other_rem) { + size_t unpack_size = packed_size * 2; + + u8 pre_unpack[unpack_size]; + init_array(pre_unpack, unpack_size); + unpack_array(pre_unpack, pre_a, packed_size); + + u8 post_unpack[unpack_size]; + init_array(post_unpack, unpack_size); + unpack_array(post_unpack, post_a, packed_size); + + post_unpack[0] == + + size_t ri = packed_size - 1; + for (size_t i = 0; i < index4; i++) { + } + + + for (size_t i = 0; i < index4; i++) { + if (pre_unpack[i] != post_unpack[i]) { + return false; + } + } + + if (post_unpack[index4] != item) + return false; + + for (size_t i = index4; i < unpack_size - 1; i++) { + if (pre_unpack[i] != post_unpack[i + 1]) { + return false; + } + } + return true; + } + */ + /** + * Validates the functionality of an insert_push function, based on the original input, and the result. + * @param pre_a The original input + * @param post_a The output + * @param packed_size number of 4 items in pre_a. + * @param index4 the index in which we wanted to insert new item. + * @param item the new item value. (4 bits). + * @return + */ + bool validate_insert_push_4bit(u8 *pre_a, u8 *post_a, size_t packed_size, size_t index4, u8 item) { + size_t unpack_size = packed_size * 2; + + u8 pre_unpack[unpack_size]; + init_array(pre_unpack, unpack_size); + unpack_array(pre_unpack, pre_a, packed_size); + + u8 post_unpack[unpack_size]; + init_array(post_unpack, unpack_size); + unpack_array(post_unpack, post_a, packed_size); + + for (size_t i = 0; i < index4; i++) { + if (pre_unpack[i] != post_unpack[i]) { + return false; + } + } + + if (post_unpack[index4] != item) + return false; + + for (size_t i = index4; i < unpack_size - 1; i++) { + if (pre_unpack[i] != post_unpack[i + 1]) { + return false; + } + } + return true; + } + + bool validate_insert_push_4bit_disjoint_pair(u8 *pre_a, u8 *post_a, size_t packed_size, size_t index4, u8 lo_rem1, u8 lo_rem2) { + size_t unpack_size = packed_size * 2; + + u8 pre_unpack[unpack_size]; + init_array(pre_unpack, unpack_size); + unpack_array(pre_unpack, pre_a, packed_size); + + u8 post_unpack[unpack_size]; + init_array(post_unpack, unpack_size); + unpack_array(post_unpack, post_a, packed_size); + + assert(post_unpack[0] == lo_rem1); + for (size_t i = 0; i < index4; i++) { + if (pre_unpack[i] != post_unpack[i + 1]) { + std::cout << "index4: \t" << index4 << std::endl; + std::cout << "unpack_size: \t" << unpack_size << std::endl; + auto s0 = str_bitsMani::str_array_with_line_numbers(pre_unpack, index4 + 3); + auto s1 = str_bitsMani::str_array_with_line_numbers(post_unpack, index4 + 3); + std::cout << std::endl; + std::cout << s0 << std::endl; + std::cout << std::string(80, '=') << std::endl; + std::cout << s1 << std::endl; + return false; + } + } + + if (post_unpack[index4 + 1] != lo_rem2) { + std::cout << "index4: \t" << index4 << std::endl; + std::cout << "unpack_size: \t" << unpack_size << std::endl; + auto s0 = str_bitsMani::str_array_with_line_numbers(pre_unpack, index4 + 3); + auto s1 = str_bitsMani::str_array_with_line_numbers(post_unpack, index4 + 3); + std::cout << std::endl; + std::cout << s0 << std::endl; + std::cout << std::string(80, '=') << std::endl; + std::cout << s1 << std::endl; + return false; + } + + for (size_t i = index4; i < unpack_size - 2; i++) { + if (pre_unpack[i] != post_unpack[i + 2]) { + std::cout << "index4: \t" << index4 << std::endl; + std::cout << "unpack_size: \t" << unpack_size << std::endl; + auto s0 = str_bitsMani::str_array_with_line_numbers(pre_unpack, unpack_size); + auto s1 = str_bitsMani::str_array_with_line_numbers(post_unpack, unpack_size); + std::cout << std::endl; + std::cout << s0 << std::endl; + std::cout << std::string(80, '=') << std::endl; + std::cout << s1 << std::endl; + return false; + } + } + return true; + } + + + bool test_pack_unpack_6x8(const uint8_t *pack_a, size_t pack_size) { + auto s0 = str_bitsMani::str_array_as_memory(pack_a, pack_size); + size_t items = pack_size + pack_size / 2; + size_t unpack_size = items; + uint8_t unpack_of_a[unpack_size]; + init_array(unpack_of_a, unpack_size); + unpack6x8(unpack_of_a, pack_a, pack_size); + auto us = str_bitsMani::str_array_as_memory(unpack_of_a, unpack_size); + + uint8_t pack_res[pack_size]; + init_array(pack_res, pack_size); + pack6x8(pack_res, unpack_of_a, pack_size); + + bool res = memcmp(pack_a, pack_res, pack_size) == 0; + if (res) return true; + + size_t index = 0; + while (pack_a[index] == pack_res[index]) { index++; } + + + std::cout << s0 << std::endl; + std::cout << us << std::endl; + auto s1 = str_bitsMani::str_array_as_memory(pack_res, pack_size); + // std::cout << s0 << std::endl; + std::cout << s1 << std::endl; + + std::cout << "first wrong index:" << index << std::endl; + std::cout << "pack_size: " << pack_size << std::endl; + + assert(0); + return false; + } + + bool test_pack_unpack_pdep0() { + constexpr u64 bz_mask = (1ull << 48u) - 1u; + // constexpr size_t p_size = 8; + u64 packed = 0x207185'103081;// {1,2,3,4,5,6,7,8} (each 6 bits) + u64 true_unpacked = 0x0807'0605'0403'0201; + + u64 lo_up = unpack4x6_as_4x8(packed); + u64 hi_up = unpack4x6_as_4x8(packed >> 24); + u64 hi_up2 = unpack4x6_as_4x8(0x207185); + if (hi_up != hi_up2) { + std::cout << "hi_hp differ. " << std::endl; + auto s_diff = str_bitsMani::format_2words_and_xor(hi_up, hi_up2); + std::cout << s_diff << std::endl; + std::cout << std::string(80, '=') << std::endl; + } + u64 val_up = lo_up | (hi_up << 32u); + + bool cmp0 = ((val_up & bz_mask) == (true_unpacked & bz_mask)); + if (!cmp0) { + std::cout << str_bitsMani::format_word_to_string(val_up) << std::endl; + std::cout << str_bitsMani::format_word_to_string(true_unpacked) << std::endl; + std::cout << str_bitsMani::format_word_to_string(val_up ^ true_unpacked) << std::endl; + assert(0); + } + return true; + } + + + bool test_pack_unpack_pdep() { + constexpr size_t p_size = 8; + u8 packed[p_size] = {0}; + + for (size_t i = 0; i < p_size; i++) { + packed[i] = random() ^ random() ^ random() ^ random() ^ 0x20739156; + } + + // constexpr size_t temp_size = 6; + + // u8 unpack_temp[p_size] = {0}; + u32 lo_p, hi_p; + memcpy(&lo_p, packed, 3); + memcpy(&hi_p, packed + 3, 3); + u64 packed64 = lo_p | (((u64) hi_p) << 24); + u64 lo_up = unpack4x6_as_4x8(lo_p); + u64 hi_up = unpack4x6_as_4x8(hi_p); + u64 val_up = lo_up | (hi_up << 32u); + + u64 att_up = unpack8x6_as_8x8(packed64); + // constexpr u64 bz_mask = (1ull << 48u) - 1u; + constexpr u64 bz_mask = -1; + bool res = ((att_up & bz_mask) == (val_up & bz_mask)); + + if (res) return 1; + + constexpr uint64_t mask = 0x3f3f'3f3f'3f3f'3f3f; + + auto s0 = str_bitsMani::str_array_as_memory(packed, 8); + auto s1 = str_bitsMani::format_word_to_string(val_up); + auto s2 = str_bitsMani::format_word_to_string(val_up & bz_mask); + auto s3 = str_bitsMani::format_word_to_string(att_up); + auto s4 = str_bitsMani::format_word_to_string(att_up & bz_mask); + auto s5 = str_bitsMani::format_word_to_string(att_up ^ val_up); + auto s6 = str_bitsMani::format_word_to_string((att_up ^ val_up) & bz_mask); + + + std::cout << "mem: \t" << s0; + std::cout << "val: \t" << s1 << std::endl; + std::cout << "valm: \t" << s2 << std::endl; + std::cout << "att: \t" << s3 << std::endl; + std::cout << "attm: \t" << s4 << std::endl; + std::cout << "xor: \t" << s5 << std::endl; + std::cout << "xorm: \t" << s6 << std::endl; + std::cout << "mask: \t" << str_bitsMani::format_word_to_string(mask) << std::endl; + std::cout << "val_up: \t" << val_up << std::endl; + std::cout << "att_up: \t" << att_up << std::endl; + + + assert(0); + return false; + } + + bool test_pack_unpack_array_gen_k(const uint32_t *pack_a, size_t items, size_t k) { + const size_t pack_size = (k * items + 7) / 8; + auto s0 = str_bitsMani::str_array_as_memory((const u8 *) pack_a, pack_size); + const size_t unpack_size = items; + uint32_t unpack_of_a[unpack_size]; + init_array(unpack_of_a, unpack_size); + unpack_array_gen_k(unpack_of_a, pack_a, items, k); + auto us = str_bitsMani::get_first_k_bits_of_each_item(unpack_of_a, items, k); + + uint8_t pack_res[pack_size]; + init_array(pack_res, pack_size); + pack_array_gen_k(pack_res, unpack_of_a, items, k); + + size_t dec = ((k * items & 7) != 0); + size_t pack_size_m1 = pack_size - dec; + bool res0 = memcmp(pack_a, pack_res, pack_size_m1) == 0; + bool res = memcmp(pack_a, pack_res, pack_size) == 0; + if (res) return true; + + if (res0) { + size_t offset = (k * items) & 7; + const size_t index = pack_size - 1; + const u64 mask = _bzhi_u64(-1, offset); + assert(index < pack_size); + bool fix_res = (((const u8 *) pack_a)[index] & mask) == (pack_res[index] & mask); + if (fix_res) + return true; + } + size_t index = 0; + while (((const u8 *) pack_a)[index] == pack_res[index]) { index++; } + + + std::cout << s0 << std::endl; + std::cout << us << std::endl; + auto s1 = str_bitsMani::str_array_as_memory(pack_res, pack_size); + // std::cout << s0 << std::endl; + std::cout << s1 << std::endl; + + std::cout << "k: \t" << k << std::endl; + std::cout << "items: \t" << items << std::endl; + std::cout << "first wrong index: \t" << index << std::endl; + std::cout << "pack_size: \t" << pack_size << std::endl; + + // assert(0); + return false; + } + + void comp_test0_shift_arr_k_bits_right_att_wrapper() { + constexpr size_t a_size = 2; + constexpr size_t range = 56; + u64 a[64]; + for (size_t i = 0; i < a_size; ++i) { + a[0] = random() ^ random() ^ random() ^ random() ^ 0xf982a35b; + } + // for (size_t reps = 0; reps < 64; reps++) { + // for (size_t i = 0; i < a_size; i++) { + u64 b[a_size]; + memcpy(b, a, a_size * 8); + // u64 c[a_size]; + // memcpy(c, a, a_size * 8); + size_t begin = 0; + size_t end = 0; + while ((end <= begin) or (end + 7 > a_size * 8)) { + begin = random() % range; + end = random() % range; + } + + std::cout << "begin: \t" << begin << std::endl; + std::cout << "end: \t" << end << std::endl; + std::cout << std::string(80, '=') << std::endl; + std::cout << str_bitsMani::str_array_as_memory_no_delim((u8 *) b, 8); + std::cout << std::endl + << std::string(80, '~') << std::endl; + for (size_t j = 0; j < 7; j++) { + shift_arr_k_bits_right_att_wrapper((u8 *) b, begin + j, end + j, a_size * 8, 1); + // size_t min_end = std::min(end + j, a_size * 8); + // shift_arr_k_bits_right_att_wrapper((u8 *) b, begin + j, end + j, a_size * 8, 2); + // auto s = str_bitsMani::str_array_as_memory((u8 *) b, a_size); + auto s = str_bitsMani::str_array_as_memory_no_delim((u8 *) b, 8); + std::cout << s << std::endl; + // std::cout << std::string(80, '-') << std::endl; + } + + + // } + // } + } + bool comp_test_shift_arr_k_bits_right_att_wrapper() { + constexpr size_t a_size = 64; + constexpr size_t range = a_size * 64; + u64 a[64]; + for (size_t i = 0; i < a_size; ++i) { + a[0] = random() ^ random() ^ random(); + } + for (size_t reps = 0; reps < 64; reps++) { + for (size_t i = 0; i < a_size; i++) { + u64 b[64]; + u64 c[64]; + memcpy(b, a, a_size * 8); + memcpy(c, a, a_size * 8); + size_t begin = 0; + size_t end = 0; + while (end <= begin) { + begin = random() % range; + end = random() % range; + } + shift_arr_k_bits_right_att_wrapper((u8 *) b, begin, end, a_size * 8, 8); + //CONTINUE-FROM-HERE! + //FIXME! + //TODO! + /* shift_arr_4bits_right_att_wrapper(c, begin, end, ) + assert(memcmp(att, val, a_size * 8) == 0); + + size_t k = (random() % 30) + 2; + size_t max_items = (a_size * sizeof(a[0]) * 8 + k - 1) / k; + size_t items = (random() % max_items) + 1; + bool res = Shift_op::check::test_pack_unpack_array_gen_k(a, items, k); + if (!res) { + std::cout << "reps: \t" << reps << std::endl; + std::cout << "i: \t" << i << std::endl; + } + assert(res); */ + } + std::cout << "reps: " << reps << std::endl; + } + return true; + } +}// namespace Shift_op::check + +namespace bitsMani { + + bool zero0s_between_k_ones_word(size_t k, size_t range, u64 word) { + const u64 mask = (1ULL << range) - 1; + const uint64_t y = _pdep_u64(mask << k, word); + if (!y) return false; + + auto tz = _tzcnt_u64(y); + u64 z = y >> tz; + bool att = (z == mask); + assert(att == bitsMani::test::zero0s_between_k_ones_word_naive(k, range, word)); + return att; + } + + bool f2(size_t k, size_t range, u64 word) { + const u64 mask = (1ULL << range) - 1; + const uint64_t y = _pdep_u64(mask << k, word); + return y && ((y >> _tzcnt_u64(y)) == mask); + } + + bool f3(size_t k, size_t range, u64 word) { + const u64 mask = (1ULL << range) - 1; + const uint64_t y = _pdep_u64(mask << k, word); + const uint64_t y_or = y | _blsmsk_u64(y); + bool nec_consec_cond = (_blsr_u64(y_or + 1) == 0); + return (y && nec_consec_cond) && (pop64(y) == range); + } + + bool f4(size_t k, size_t range, u64 word) { + static int c = 0; + c++; + const u64 mask = (1ULL << range) - 1; + const uint64_t y = _pdep_u64(mask << k, word); + const uint64_t bit = _blsi_u64(y); + bool res = y && ((y + bit) == (bit << range)); + bool val = f3(k, range, word); + if (res == val) + return res; + + std::cout << "c: " << c << std::endl; + std::cout << "word: \t" << str_bitsMani::format_word_to_string(word) << std::endl; + std::cout << "y: \t" << str_bitsMani::format_word_to_string(y) << std::endl; + std::cout << "bit: \t" << str_bitsMani::format_word_to_string(bit) << std::endl; + std::cout << "range: \t" << range << std::endl; + std::cout << "k: \t" << k << std::endl; + std::cout << "val: \t" << val << std::endl; + std::cout << "res: \t" << res << std::endl; + std::cout << std::string(80, '?') << std::endl; + std::cout << std::string(80, '!') << std::endl; + return res; + } + + bool f5_weaker(size_t k, size_t range, u64 word) { + const u64 mask = (1ULL << range) - 1; + const uint64_t y = _pdep_u64(mask << k, word); + const uint64_t bit = _blsi_u64(y); + bool res = ((y + bit) == (bit << range)); + return res; + } + + bool f6(size_t k, size_t range, u64 word) { + const u64 mask = (1ULL << range) - 1; + const uint64_t y = _pdep_u64(mask << k, word); + const uint64_t bit = _blsi_u64(y); + bool res = ((y + bit) == (bit << range)); + return (res) ? y : 0; + } + + bool f7(size_t k, size_t range, u64 word) { + const u64 mask = (1ULL << range) - 1; + const uint64_t y = _pdep_u64(mask << k, word); + return _bextr_u64(word, _tzcnt_u64(y), range) == mask; + } + + /* bool f8(size_t k, size_t range, u64 word) { + const u64 mask = (1ULL << range) - 1; + const uint64_t y = _pdep_u64(mask << k, word); + return _pext_u64(y, word) == mask; + } */ + + bool compare_bits_ranged_naive(const u64 *a, u8 rem, size_t rem_length, size_t start_index1, size_t end_index1) { + for (size_t i = start_index1; i < end_index1; i += rem_length) { + if (compare_bits(a, rem, rem_length, i)) return true; + } + return false; + } + + + + u64 bitmask_compare_k_packed_items(u64 word, u32 rem, size_t rem_length, size_t items) { + // assert(rem_length <= 8); + assert(rem_length); + assert(rem_length * items <= 64); + assert(items <= 64); + const u64 mask = (1ULL << rem_length) - 1; + assert(rem <= mask); + u64 res = 0; + u64 b = 1ULL; + for (size_t i = 0; i < items; i++) { + + if ((word & mask) == rem) res |= b; + word >>= rem_length; + b <<= 1ull; + /* if (((word ^ rem) & rem) == 0) + return true; */ + } + return res; + } + + + + u64 bitmask_cmp_bits_inside_un_aligned_single_word(const u8 *a, u32 rem, size_t rem_length, size_t start_index1, size_t end_index1) { + assert(((end_index1 - start_index1) % rem_length) == 0); + const size_t items = (end_index1 - start_index1) / rem_length; + // auto mp = (const u8 *) a; + const size_t total_bits_to_compare = end_index1 - start_index1; + const size_t offset = start_index1 & 7; + assert(total_bits_to_compare + offset <= 64); + + u64 word = 0; + memcpy(&word, a + (start_index1 / 8), 8); + word >>= offset; + return bitmask_compare_k_packed_items(word, rem, rem_length, items); + } + + bool compare_bits_ranged(const u64 *a, u8 rem, size_t rem_length, size_t start_index1, size_t end_index1) { + assert(((end_index1 - start_index1) % rem_length) == 0); + const size_t items = (end_index1 - start_index1) / rem_length; + auto mp = (const u8 *) a; + const size_t total_bits_to_compare = end_index1 - start_index1; + const size_t offset = start_index1 & 7; + if (total_bits_to_compare + offset <= 64) { + u64 word = 0; + memcpy(&word, mp + (start_index1 / 8), 8); + word >>= offset; + return compare_k_packed_items(word, rem, rem_length, items); + } + size_t first_part_bits = (64 - offset) / rem_length * rem_length; + assert(first_part_bits); + auto temp = cmp_bits_inside_un_aligned_single_word(a, rem, rem_length, start_index1, start_index1 + first_part_bits); + auto rest = (start_index1 + first_part_bits < end_index1) && compare_bits_ranged(a, rem, rem_length, start_index1 + first_part_bits, end_index1); + return temp or rest; + } + + u64 get_compare_mask(const u8 *a, u32 rem, size_t rem_length, size_t start_index1, size_t end_index1) { + assert(((end_index1 - start_index1) % rem_length) == 0); + const size_t items = (end_index1 - start_index1) / rem_length; + assert(items <= 64); + const size_t total_bits_to_compare = end_index1 - start_index1; + const size_t offset = start_index1 & 7; + if (total_bits_to_compare + offset <= 64) { + auto mp = (const u8 *) a; + u64 word = 0; + memcpy(&word, mp + (start_index1 / 8), 8); + word >>= offset; + return bitmask_compare_k_packed_items(word, rem, rem_length, items); + } + const size_t part_one_items = (64 - offset) / rem_length; + size_t first_part_bits = part_one_items * rem_length; + assert(first_part_bits); + u64 temp = bitmask_cmp_bits_inside_un_aligned_single_word(a, rem, rem_length, start_index1, start_index1 + first_part_bits); + u64 rest = (start_index1 + first_part_bits < end_index1) ? get_compare_mask(a, rem, rem_length, start_index1 + first_part_bits, end_index1) : 0; + assert(!(temp & (rest << part_one_items))); + return temp | (rest << part_one_items); + } + + bool compare_bits(const u64 *a, u8 rem, size_t rem_length, size_t index1) { + assert(rem_length <= 8); + const u8 mask = (1 << rem_length) - 1; + assert(rem <= mask); + return ((a[index1 / 64] >> (index1 & 63)) & mask) == rem; + } + + bool compare_bits2(const u64 *a, u8 rem, size_t rem_length, size_t index1) { + assert(rem_length <= 8); + assert(rem <= ((1 << rem_length) - 1)); + return _bextr_u64(a[index1 / 64], index1 & 63, rem_length); + } + + + u64 extract_bits(const u8 *a, size_t start1, size_t end1) { +// static int b = 0; + assert(end1 - start1 <= 64); + const size_t length = end1 - start1; + const u64 mask = _bzhi_u64(-1, length); + const size_t offset = start1 & 7; + u64 word; +// std::cout << "b: \t" << b++ << std::endl; + memcpy(&word, &a[start1 / 8], 8); + word >>= offset; + if (offset + length <= 64) { + return word & mask; + } else { + u64 hi = (a[(start1 / 8) + 8]) << (64 - offset); + return mask | hi; + } + } + void update_bits_inside_8bytes_boundaries(u8 *a, size_t start1, size_t end1, u64 value) { + //This might contain a problem, of writing to a place i'm not supposed to, although i do not change it. + assert(end1 - start1 <= 64); + const size_t length = end1 - start1; + assert(value <= _bzhi_u64(-1, length)); + const u64 mask = _bzhi_u64(-1, length); + const size_t offset = start1 & 7; + u64 word; +// assert() + memcpy(&word, &a[start1 / 8], 8); + u64 shifted_mask = mask << offset; + u64 mid = value << offset; + u64 new_word = (word & ~shifted_mask) | mid; + memcpy(&a[start1 / 8], &new_word, 8); + } + + void update_bits_inside_8bytes_boundaries_safer(u8 *a, size_t start1, size_t k, u64 value) { + //This might contain a problem, of writing to a place I'm not supposed to, although I do not change it. +// static int A[4] = {0}; +// A[0]++; + assert(k <= 32); + size_t first_byte = start1 / 8; + size_t last_byte = (start1 + k - 1) / 8; + if (first_byte == last_byte){ +// constexpr u64 ind = (1ULL << 20) - 1; +// if (((A[1]++) & ind) == 0){ +// std::cout << "A[1]: \t" << A[1] << std::endl; +// } + u8 prev = a[first_byte]; + size_t shift = start1 & 7; + u8 mid_mask = ((1 << k) - 1) << shift; + u8 outer = prev & ~mid_mask; + u8 inner = value << shift; + assert(!(inner & outer)); + a[first_byte] = inner | outer; + return; + } +// std::cout << "A[2]: \t" << A[1]++ << std::endl; +// A[0]++; +// return; + size_t bytes_to_write = last_byte - first_byte + 1; + assert(bytes_to_write <= 8); + const size_t length = k; + assert(value <= _bzhi_u64(-1, length)); + const u64 mask = _bzhi_u64(-1, length); + assert(mask); + const size_t offset = start1 & 7; + u64 word = 0; + // 8 instead of bytes to write would be better, but this might give some warnings. +// std::cout << "a[0]: \t" << (u16)a[0];// << std::endl; +// std::cout << "\t bytes: \t" << bytes_to_write << std::endl; +// std::cout << "A: \t" << A++ << std::endl; + memcpy(&word, a + first_byte, bytes_to_write); + u64 shifted_mask = mask << offset; + u64 mid = value << offset; + u64 inner = mid; + u64 outer = (word & ~shifted_mask); + assert(!(inner & outer)); + u64 new_word = (word & ~shifted_mask) | mid; + memcpy(a + first_byte, &new_word, bytes_to_write); + } + + void update_bits(u8 *a, size_t start1, size_t end1, u64 value) { + assert(end1 - start1 <= 64); + assert(value <= _bzhi_u64(-1, end1 - start1)); + if (end1 - start1 + (start1 & 7) <= 64) + return update_bits_inside_8bytes_boundaries(a, start1, end1, value); + + const u64 val1 = value & _bzhi_u64(-1, end1 - (start1 + 8)); + const u64 val2 = value >> (end1 - (start1 + 8)); + update_bits_inside_8bytes_boundaries(a, start1, end1 - 8, val1); + update_bits_inside_8bytes_boundaries(a, end1 - 8, end1, val2); + } +}// namespace bitsMani +namespace bitsMani::test { + bool zero0s_between_k_ones_word_naive(size_t k, size_t range, u64 word) { + size_t begin = select64(word, k); + // size_t temp = begin + range; + size_t wanted_end = begin + range - 1; + return (wanted_end < 64) && (select64(word, k + range - 1) == wanted_end); + } + + bool val_zero0s_single(size_t k, size_t range, u64 word) { + static int c = 0; + c++; + bool att = zero0s_between_k_ones_word(k, range, word); + bool att2 = f3(k, range, word); + bool att3 = f4(k, range, word); + bool val = zero0s_between_k_ones_word_naive(k, range, word); + bool all = (att == val) and (att2 == att3) and (att2 == att); + assert(all); + /* bool att8 = f8(k, range, word); + if (att8 != val) { + std::cout << "att8: " << att8 << std::endl; + const u64 mask = (1ULL << range) - 1; + const uint64_t y = _pdep_u64(mask << k, word); + u64 z = _pext_u64(y, word); + u64 z2 = _pext_u64(word, y); + std::cout << "c: \t" << c << std::endl; + std::cout << "range: \t" << range << std::endl; + std::cout << "k: \t" << k << std::endl; + std::cout << std::string(80, '=') << std::endl; + std::cout << "word: \t" << str_bitsMani::format_word_to_string(word) << std::endl; + std::cout << "mask: \t" << str_bitsMani::format_word_to_string(mask) << std::endl; + std::cout << "y: \t" << str_bitsMani::format_word_to_string(y) << std::endl; + std::cout << "z: \t" << str_bitsMani::format_word_to_string(z) << std::endl; + std::cout << "z2: \t" << str_bitsMani::format_word_to_string(z2) << std::endl; + assert(0); + } */ + if (all) + return true; + + std::cout << "att: " << att << std::endl; + std::cout << "att2: " << att2 << std::endl; + std::cout << "val: " << val << std::endl; + prt_zeros_failed(k, range, word); + return false; + } + + void prt_zeros_failed(size_t k, size_t range, u64 word) { + + bool val = zero0s_between_k_ones_word_naive(k, range, word); + + auto pop0 = pop64(word); + size_t begin = select64(word, k); + size_t end = select64(word, k + range); + + std::cout << std::endl; + std::cout << std::string(80, '=') << std::endl; + std::cout << std::endl; + std::cout << "k: \t" << k << std::endl; + std::cout << "range: \t" << range << std::endl; + std::cout << "pop0: \t" << pop0 << std::endl; + std::cout << "begin: \t" << begin << std::endl; + std::cout << "end: \t" << end << std::endl; + std::cout << "word: \t" << str_bitsMani::format_word_to_string(word) << std::endl; + std::cout << std::string(80, '~') << std::endl; + std::cout << "att: " << !val << std::endl; + std::cout << "val: " << val << std::endl; + std::cout << std::string(80, '~') << std::endl; + const u64 mask = (1ULL << range) - 1; + const uint64_t y = _pdep_u64(mask << k, word); + // const uint64_t z = _blsmsk_u64(y); + const uint64_t z2 = _blsmsk_u64(y); + // const uint64_t u = _blsr_u64(_blsmsk_u64(_pdep_u64(mask << k, word)) + 1); + bool b1 = (!_blsr_u64(z2 + 1)); + auto pop_y = pop64(y); + std::cout << "mask: \t" << str_bitsMani::format_word_to_string(mask) << std::endl; + std::cout << "y: \t" << str_bitsMani::format_word_to_string(y) << std::endl; + std::cout << "pop_y: \t" << pop_y << std::endl; + std::cout << "b1: \t" << b1 << std::endl; + std::cout << std::endl; + std::cout << std::string(80, '=') << std::endl; + std::cout << std::endl; + } + + bool val_zero0s_between_k_ones_word_rand(size_t reps) { + u64 word = 0; + for (size_t i = 0; i < reps; i++) { + while (!word) { + for (size_t j = 0; j < 4; j++) { + word ^= random(); + } + } + assert(word); + size_t k = random() % 64; + size_t range = (random() % 16) + 1; + bool temp = val_zero0s_single(k, range, word); + if (!temp) { + std::cout << "i: " << i << std::endl; + assert(0); + } + } + return true; + } + + bool update_plus_extract(u8 *a, size_t start, size_t end, u64 value) { + update_bits(a, start, end, value); + u64 ext_val = extract_bits(a, start, end); + return ext_val == value; + } + + bool wrap_extract_update_bits() { + constexpr size_t a_size = 8; + constexpr size_t range = a_size * 64; + u64 a[a_size]; + + for (size_t reps = 0; reps < 64; reps++) { + for (size_t j = 0; j < a_size; ++j) { + a[j] = random() ^ random(); + } + u64 b[64]; + memcpy(b, a, a_size * 8); + for (size_t i = 0; i < a_size; i++) { + size_t begin = 0; + size_t end = 0; + while (1) { + begin = random() % range; + end = random() % range; + bool c1 = (end <= begin); + bool c2 = end - begin <= 64; + if (c1 and c2) + break; + } + u64 mask = _bzhi_u64(-1, end - begin); + u64 ext0 = extract_bits((const u8 *) b, begin, end); + u64 val0 = random() & mask; + bool r0 = update_plus_extract((u8 *) b, begin, end, val0); + assert(r0); + bool r1 = update_plus_extract((u8 *) b, begin, end, ext0); + assert(r1); + + bool cmp = !memcmp(a, b, a_size * 8); + assert(cmp); + /* shift_arr_4bits_right_att_wrapper(c, begin, end, ) + assert(memcmp(att, val, a_size * 8) == 0); + + size_t k = (random() % 30) + 2; + size_t max_items = (a_size * sizeof(a[0]) * 8 + k - 1) / k; + size_t items = (random() % max_items) + 1; + bool res = Shift_op::check::test_pack_unpack_array_gen_k(a, items, k); + if (!res) { + std::cout << "reps: \t" << reps << std::endl; + std::cout << "i: \t" << i << std::endl; + } + assert(res); */ + } + // std::cout << "reps: " << reps << std::endl; + } + return true; + } +}// namespace bitsMani::test diff --git a/Prefix-Filter/Shift_op.hpp b/Prefix-Filter/Shift_op.hpp new file mode 100644 index 0000000..b255b3d --- /dev/null +++ b/Prefix-Filter/Shift_op.hpp @@ -0,0 +1,2148 @@ +// +// Created by tomer on 15/06/2021. +// + +#ifndef MULTI_LEVEL_HASH_SHIFT_OP_HPP +#define MULTI_LEVEL_HASH_SHIFT_OP_HPP + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// #ifdef TRACY_ENABLE +//#include "../../tracy/Tracy.hpp" +//#include "randomness.hpp" +// #endif + + +typedef __uint128_t u128; +typedef uint64_t u64; +typedef uint32_t u32; +typedef uint16_t u16; +typedef uint8_t u8; + + +#define PRINT_STATE (0) + +namespace Shift_op { + inline u64 extract_word(const uint64_t *a, size_t start4) { + size_t byte_index = start4 / 2; + auto mp = (const u8 *) a + byte_index; + if (!(start4 & 1)) { + u64 h1; + memcpy(&h1, mp, 8); + return h1; + } + + u64 h0 = mp[0]; + u64 h1; + memcpy(&h1, mp + 1, 8); + h1 = (h1 << 4u) | (h0 >> 4u); + return h1; + } + + + void shift_arr_4bits_left_att_wrapper(uint64_t *a, size_t begin, size_t end, size_t a_size); + + void shift_arr_4bits_right_att_wrapper(uint64_t *a, size_t begin, size_t end, size_t a_size); + + inline void shift_arr_4bits_right_inside_single_word_robuster(uint64_t *a, size_t begin, size_t end) { + // end -= (end * 16 == a_size); + if (begin >= end) return; + // assert(begin < end); + // assert(end % 16); + constexpr unsigned slot_size = sizeof(a[0]) * CHAR_BIT; + constexpr unsigned slot_mask = slot_size - 1u; + constexpr unsigned shift = 4u; + constexpr unsigned slot_sh_capacity = slot_size / shift; + + assert(end % slot_sh_capacity); + size_t index = begin / slot_sh_capacity; + assert(index == (end / slot_sh_capacity)); + + + size_t rel_begin = (begin * shift) & slot_mask; + size_t rel_end = (end * shift) & slot_mask; + uint64_t hi_mask = _bzhi_u64(-1, rel_end + shift); + uint64_t hi = a[index] & ~hi_mask; + + if (rel_begin == 0) { + // std::cout << "r0: " << std::endl; + uint64_t old_lo = a[index] & _bzhi_u64(-1, shift); + uint64_t lo = (a[index] << shift) & hi_mask; + // uint64_t hi = a[index] & ~hi_mask; + assert(!(lo & hi)); + assert(!(old_lo & hi)); + a[index] = old_lo | lo | hi; + return; + } + // std::cout << "r1: " << std::endl; + assert(rel_begin < rel_end); + uint64_t lo_mask = _bzhi_u64(-1, rel_begin); + uint64_t lo2 = a[index] & _bzhi_u64(-1, rel_begin + shift); + uint64_t mi3 = ((a[index] & ~lo_mask) << shift) & hi_mask; + + assert(!(lo2 & mi3) and !(lo2 & hi) and !(mi3 & hi)); + a[index] = lo2 | mi3 | hi; + // uint64_t lo = a[index] & lo_mask; + // uint64_t mid = (a[index] << shift) & ((~lo_mask) & hi_mask); + // uint64_t mi2 = (a[index] & ((~lo_mask) & hi_mask)) << shift; + // std::cout << std::string(92, '=') << std::endl; + // std::cout << "lo: \t\t" << format_word_to_string(lo, 64); + // std::cout << "lo2: \t\t" << format_word_to_string(lo2, 64); + // std::cout << "mid: \t\t" << format_word_to_string(mid, 64); + // std::cout << "mi2: \t\t" << format_word_to_string(mi2, 64); + // std::cout << "mi3: \t\t" << format_word_to_string(mi3, 64); + // std::cout << "hi: \t\t" << format_word_to_string(hi, 64); + // assert(!(lo & mid) and !(lo & hi) and !(mid & hi)); + // assert(!(lo & mi2) and !(lo & hi) and !(mi2 & hi)); + // assert(!(lo2 & mi3) and !(lo2 & hi) and !(mi3 & hi)); + // assert(!(lo2 & mi2) and !(lo2 & mid) and !(lo2 & hi)); + // assert(!(lo2 & mi2) and !(lo2 & hi)); + // assert(!(lo2 & mi3) and !(lo2 & hi) and !(mi3 & hi)); + // std::cout << std::string(92, '=') << std::endl; + // a[index] = lo2 | mi2 | hi; + // a[index] = lo | mi2 | hi; + // a[index] = lo | mid | hi; + } + + void shift_arr_1bit_left_att_wrapper(uint64_t *a, size_t begin, size_t end, size_t a_size); + + void shift_arr_1bit_right_att_wrapper(uint64_t *a, size_t begin, size_t end, size_t a_size); + + void update_byte(uint8_t *pointer, uint8_t rem4, bool should_update_hi); + + uint8_t read_4bits(const uint8_t *a, size_t index4, size_t a_size); + + uint8_t read_4bits(const uint64_t *a, size_t index4, size_t a_size); + + bool half_byte_cmp(const uint64_t *a, size_t half_byte_index, size_t length, uint8_t rem4); + + int half_byte_cmp_get_index_for_db(const uint64_t *a, size_t half_byte_index, size_t length, uint8_t rem4); + + void unpack_array(uint8_t *unpack_array, const uint8_t *packed_array, size_t packed_size); + + void pack_array(uint8_t *pack_array, const uint8_t *unpacked_array, size_t unpacked_size); + + void unpack_array8x2(uint8_t *unpacked_array, const uint8_t *pack_array, size_t packed_size); + + void pack_array8x2(uint8_t *pack_array, const uint8_t *unpacked_array, size_t unpacked_size); + + void unpack6x8(u8 *unpackArray, const u8 *packedArray, size_t packed_size); + + void pack6x8(u8 *packedArray, const u8 *unpackArray, size_t packed_size); + + bool test_pack_unpack(const uint8_t *pack_a, size_t pack_size); + + bool memcmp_1bit(const uint8_t *a, const uint8_t *b, size_t size1); + + bool memcmp_1bit(const uint64_t *a, const uint64_t *b, size_t size1); + + // bool + + void pack_array_gen_k(u8 *pack_array, const u32 *unpacked_array, size_t items, size_t k); + + void unpack_array_gen_k(u32 *unpack_array, const u32 *packed_array, size_t items, size_t k); + + void pack_array_gen_k_with_offset(u8 *pack_array, const u32 *unpacked_array, size_t items, size_t k, size_t offset); + + void unpack_array_gen_k_with_offset(u32 *unpack_array, const u8 *packed_array, size_t items, size_t k, size_t offset); + // void unpack_array_gen_k_with_offset(u32 *unpack_array, const u32 *packed_array, size_t items, size_t k, size_t offset); + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + + /** + * like link list insertion. + * @param packedArray + * @param packedSize + * @param index + * @param item + * Using pack unpack. + */ + void insert_push_4bit_ultra_naive(u8 *packedArray, size_t packedSize, size_t index, u8 item); + + void insert_push_4bit_by_shift(u8 *packedArray, size_t packedSize, size_t index4, u8 item); + + inline void fix_byte(u8 *mp, bool parity, u8 rem2) { + if (parity) { + mp[0] = (mp[0] & 0xf) | (rem2 << 4u); + } else { + mp[0] = (mp[0] & 0xf0) | rem2; + } + } + + inline void fix_byte2(u8 *mp, bool parity, u8 rem2) { + u8 rem_twice = rem2 | (rem2 << 4u); + u8 mask = 0xf << (parity * 4); + mp[0] = (mp[0] & ~mask) | (rem_twice & mask); + } + + void insert_push_4bit_disjoint_pair(u8 *packedArray, size_t packedSize, size_t index4, u8 rem1, u8 rem2); + /** + * Very similar to the previous function. + * The only difference is that unpacked_size is now given, instead of being determined as 2 * packed_size. + * + * @param packedArray + * @param packedSize + * @param index4 + * @param item + * @param unpackSize + */ + void insert_push_4bit_ultra_naive_by_unpackSize(u8 *packedArray, size_t packedSize, size_t index4, u8 item, + size_t unpackSize); + + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + template + void init_array(T *a, size_t a_size) { + std::fill(a, a + a_size, 0); + } + + + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + __uint128_t get_4bits_cmp_vector(const uint64_t *a, size_t start4, size_t length, uint8_t rem4); + + u16 get_4bits_cmp_on_word3(const u8 word[8], size_t start4, uint8_t rem4, size_t length); + + u16 get_4bits_cmp16(const uint64_t *a, size_t start4, uint8_t rem4); + + u16 get_4bits_cmp_on_word(const u8 word[8], uint8_t rem4); + /** + * @brief if start4 is odd, compares only 15 items, where if it start4 is even, we compare 16 4 bits items. + * + * @param a + * @param start4 + * @param rem4 + * @return u16 + */ + inline u16 get_4bits_cmp16_ver2(const uint64_t *a, size_t start4, uint8_t rem4) { + size_t byte_index = start4 / 2; + auto mp = (const u8 *) a + byte_index; + u16 cmp_mask = get_4bits_cmp_on_word(mp, rem4); + return cmp_mask >> (start4 & 1); + } + + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + + inline u8 flip2x4(u8 x) { + return (x >> 4) | (x << 4); + } + + void reverse_4_bits_array_naive(const u8 *a, u8 *rev_a, size_t packed_size); + + void reverse_4_bits_array(const u8 *a, u8 *rev_a, size_t packed_size); + + void reverse_4_bits_array_in_place(u8 *a, size_t packed_size); + + void insert_push_4bit_disjoint_pair_reversed_array_naive(u8 *packedArray, size_t packedSize, size_t index4, u8 rem1, u8 rem2); + + void insert_push_4bit_disjoint_pair_reversed_array_by_push(u8 *packedArray, size_t packedSize, size_t index4, u8 rem1, u8 rem2); + + void insert_push_4bit_disjoint_pair_reversed_array(u8 *packedArray, size_t packedSize, size_t index4, u8 rem1, u8 rem2); + + void shift_arr_4bits_right_att_wrapper8_un(uint8_t *a, size_t begin4, size_t end4, size_t a_size8); + + void shift_arr_4bits_left_att_wrapper8_un(uint8_t *a, size_t begin4, size_t end4, size_t a_size8); + + void shift_arr_4bits_left_att_wrapper8_sun(uint8_t *a, size_t begin4, size_t end4, size_t a_size8); + + void shift_arr_k_bits_right_att_wrapper(u8 *a, size_t begin, size_t end, size_t a8_size, size_t k); + + void shift_arr_1bit_right_att_wrapper8(uint8_t *a, size_t begin, size_t end, size_t a8_size); +}// namespace Shift_op + + +namespace bitsMani { + constexpr u64 slot_size = 64u; + + inline bool is_single_bit_set(const uint64_t *a, size_t index1, size_t a_size) { + assert(index1 < a_size * 64); + if (a_size == 1) { + bool att = a[0] & (1ULL << index1); + bool val = _bextr_u64(a[0], index1, 1); + assert(att == val); + return att; + } + const size_t w_index = index1 / 64; + const size_t j = index1 & 63u; + bool att = a[w_index] & (1ULL << j); + bool val = _bextr_u64(a[w_index], j, 1); + assert(att == val); + return att; + } + + __attribute__((always_inline)) inline size_t pop64(u64 x) { + return _mm_popcnt_u64(x); + } + + inline size_t pop_array(const u64 *a, size_t size1) { + constexpr u64 slot_mask = (slot_size - 1u); + size_t size = 1 + (size1 - 1) / slot_size; + size_t sum = 0; + if (size1 & slot_mask) { + const size_t rel_index = size1 & slot_mask; + u64 temp_w = a[size - 1u] & _bzhi_u64(-1, rel_index); + sum += _mm_popcnt_u64(temp_w); + size -= 1u; + } + for (size_t i = 0; i < size; ++i) { + sum += _mm_popcnt_u64(a[i]); + } + return sum; + } + + inline size_t pop_array_with_limits(const u64 *a, size_t start_index1, size_t end_index1) { + assert(start_index1 <= end_index1); + constexpr u64 slot_mask = (slot_size - 1u); + size_t const useful_end = end_index1 - 1; + size_t shifted_first_word = a[start_index1 / slot_size] >> (start_index1 & slot_mask); + size_t shifted_last_word = a[useful_end / slot_size] << (63 - (useful_end & slot_mask)); + + size_t first_pop = _mm_popcnt_u64(shifted_first_word); + size_t last_pop = _mm_popcnt_u64(shifted_last_word); + size_t fixed_start = start_index1 / 64 * 64 + 64; + size_t fixed_end = useful_end / 64 * 64; + assert(!((fixed_start | fixed_end) & 63)); + size_t mid_s1 = fixed_end - fixed_start; + size_t mid_pop = 0; + for (size_t i = 1; i * 64 <= mid_s1; ++i) { + mid_pop += _mm_popcnt_u64(a[i]); + } + + return mid_pop + first_pop + last_pop; + } + + /** + * returns + * @param x word + * @param j index + * + * @return the position (starting from 0) of the jth set bit of x. Or 64 if pop64(x) <= j + */ + __attribute__((always_inline)) inline size_t select64(u64 x, u64 j) { + assert(j < 64); + const uint64_t y = _pdep_u64(UINT64_C(1) << j, x); + return _tzcnt_u64(y); + } + + /** + * Like select, just on arrays. + * @param k + * @param a + * @param size1 + * @return + */ + inline size_t select_arr(u64 k, const u64 *a, size_t size1) { + size_t temp_k = k; + assert(temp_k < 64 * size1); + assert(size1); + const size_t size64 = 1 + ((size1 - 1) / 64); + for (size_t i = 0; i < size64 - 1; ++i) { + uint64_t temp_word = a[i]; + auto temp_pop = pop64(temp_word); + if (temp_k < temp_pop) { + auto res = select64(temp_word, temp_k); + return i * sizeof(a) * CHAR_BIT + res; + } + temp_k -= temp_pop; + } + uint64_t last_word = a[size64 - 1]; + assert(temp_k < pop64(last_word)); + auto res = select64(last_word, temp_k); + return (size64 - 1) * sizeof(a) * CHAR_BIT + res; + } + + inline size_t select_zero_arr(u64 k, const u64 *a, size_t size1) { + size_t temp_k = k; + assert(temp_k < 64 * size1); + assert(size1); + const size_t size64 = 1 + ((size1 - 1) / 64); + for (size_t i = 0; i < size64 - 1; ++i) { + uint64_t temp_word = ~a[i]; + auto temp_pop = pop64(temp_word); + if (temp_k < temp_pop) { + auto res = select64(temp_word, temp_k); + return i * sizeof(a) * CHAR_BIT + res; + } + temp_k -= temp_pop; + } + uint64_t last_word = ~a[size64 - 1]; + assert(temp_k < pop64(last_word)); + auto res = select64(last_word, temp_k); + return (size64 - 1) * sizeof(a) * CHAR_BIT + res; + } + + inline void select_both_on_word(u64 x, size_t j, size_t *begin, size_t *end) { + assert(j < 64); + const uint64_t y = _pdep_u64(UINT64_C(3) << j, x); + assert(_mm_popcnt_u64(y) == 2); + /* + if (y & (y >> 1u)) { + assert(!Find_Ultra_Naive(quot, rem, pd)); + return false; + } + */ + // *begin = _tzcnt_u64(y) + 1; + *begin = _tzcnt_u64(y); + *end = _tzcnt_u64(_blsr_u64(y)); + } + + inline void select_both_arr(size_t k, const u64 *a, size_t size1, size_t *begin, size_t *end) { + // constexpr u64 slot_size = sizeof(a) * CHAR_BIT; + assert(size1); + const size_t size64 = 1 + ((size1 - 1) / 64); + // const size_t size64 = (size1 + 63) / 64; + const size_t rel_index = size1 & 63; + const u64 last_word_mask = (rel_index) ? (1ULL << rel_index) - 1u : UINT64_MAX; + bool was_begin_set = false; + // const size_t original_k = k; + size_t temp_k = k; + size_t i = 0; + for (; i < size64 - 1; ++i) { + uint64_t temp_word = a[i]; + auto temp_pop = pop64(temp_word); + if (temp_k < temp_pop) { + size_t offset = i * slot_size; + if (temp_k + 1 < temp_pop) { + select_both_on_word(temp_word, temp_k, begin, end); + *begin += offset; + *end += offset; + assert(*begin <= *end); + return; + } + auto res = 63u - _lzcnt_u64(temp_word); + assert(res == select64(temp_word, temp_k)); + + // *begin = offset + res + 1; + *begin = offset + res; + was_begin_set = true; + temp_k = (temp_k - temp_pop) + 1; /* temp_k++;*/ + i++; + break; + } + temp_k -= temp_pop; + } + if (was_begin_set) { + for (; i < size64 - 1; ++i) { + uint64_t temp_word = a[i]; + auto temp_pop = pop64(temp_word); + if (temp_k < temp_pop) { + auto res = select64(temp_word, temp_k); + *end = i * slot_size + res; + assert(*begin <= *end); + return; + } + temp_k -= temp_pop; + } + uint64_t last_word = a[i] & last_word_mask; + assert(temp_k < pop64(last_word)); + auto res = select64(last_word, temp_k); + *end = (size64 - 1) * slot_size + res; + assert(*begin <= *end); + return; + } + + uint64_t temp_word = a[i] & last_word_mask; + assert(temp_k + 1 < pop64(temp_word)); + const size_t offset = i * slot_size; + select_both_on_word(temp_word, temp_k, begin, end); + *begin += offset; + *end += offset; + assert(*begin <= *end); + } + + /** + * + * @param k + * @param a + * @param size + * @return the number of zeros between the k'th one, and the next one. + */ + inline size_t count_zeros_between_consecutive_ones(u64 k, const u64 *a, size_t size1) { + assert(k + 1 < pop_array(a, size1)); + return select_arr(k + 1, a, size1) - (select_arr(k, a, size1) + 1); + } + + /** + * Leading zero count on array, from given index. + * @param pos_index + * @param a + * @param size + * @return + */ + inline size_t lzcnt_arr(size_t pos_index, const u64 *a, size_t size) { + // constexpr u64 slot_size = 64u; + size_t index = (pos_index - 1) / slot_size; + assert(index < size); + if (pos_index & (slot_size - 1)) { + size_t rel_index = pos_index & (slot_size - 1); + assert(rel_index != 0); + assert(rel_index < slot_size); + u64 temp_word = a[index] & _bzhi_u64(-1, (u64) rel_index); + if (temp_word) { + auto abs_res = _lzcnt_u64(temp_word); + auto res = abs_res - (64 - rel_index); + return res; + } + + size_t new_index = pos_index ^ rel_index; + assert((new_index & (slot_size - 1u)) == 0); + return rel_index + lzcnt_arr(new_index, a, size); + } + for (size_t i = 0; i <= index; ++i) { + u64 temp_word = a[index - i]; + if (temp_word) { + return i * 64 + _lzcnt_u64(temp_word); + } + } + assert(0); + return -1; + } + + inline size_t leading_ones_count_arr(size_t pos_index, const u64 *a, size_t size) { + // constexpr u64 slot_size = 64u; + size_t index = (pos_index - 1) / slot_size; + assert(index < size); + if (pos_index & (slot_size - 1)) { + size_t rel_index = pos_index & (slot_size - 1); + assert(rel_index != 0); + assert(rel_index < slot_size); + u64 temp_word = ~(a[index] & _bzhi_u64(-1, (u64) rel_index)); + if (temp_word != UINT64_MAX) { + auto abs_res = _lzcnt_u64(temp_word); + auto res = abs_res - (64 - rel_index); + return res; + } + + size_t new_index = pos_index ^ rel_index; + assert((new_index & (slot_size - 1u)) == 0); + return rel_index + lzcnt_arr(new_index, a, size); + } + for (size_t i = 0; i <= index; ++i) { + u64 temp_word = ~a[index - i]; + if (temp_word != UINT64_MAX) { + return i * 64 + _lzcnt_u64(temp_word); + } + } + assert(0); + return -1; + } + + inline size_t tzcnt_arr(const u64 *a, size_t size64) { + if (a[0]) + return _tzcnt_u64(a[0]); + + for (size_t i = 1; i < size64; ++i) { + if (a[i]) + return i * 64 + _tzcnt_u64(a[i]); + } + assert(0); + return -1; + } + + + inline size_t first_to_last_one_distance(u64 x) { + assert(x); + size_t last_one_index = 63 - _lzcnt_u64(x); + size_t first_one_index = _tzcnt_u64(x); + return last_one_index - first_one_index; + } + + + inline bool only_consecutive_ones_naive(u64 word) { + auto pop = pop64(word); + auto tz = _tzcnt_u64(word); + auto lz = _lzcnt_u64(word); + auto start = tz; + auto end = 63 - lz; + assert((start != end) or (pop == 1)); + bool res = (pop == (end - start + 1)); + return res; + } + + bool zero0s_between_k_ones_word(size_t k, size_t range, u64 word); + + /*inline size_t zero0s_between_k_ones(size_t k, size_t range, const u64 *a, size_t size1) { + size_t temp_k = k; + assert(temp_k < 64 * size1); + assert(size1); + if (size1 <= 64) { + } + const size_t size64 = 1 + ((size1 - 1) / 64); + for (size_t i = 0; i < size64 - 1; ++i) { + uint64_t temp_word = a[i]; + auto temp_pop = pop64(temp_word); + if (temp_k < temp_pop) { + auto res = select64(temp_word, temp_k); + return i * sizeof(a) * CHAR_BIT + res; + } + temp_k -= temp_pop; + } + uint64_t last_word = a[size64 - 1]; + assert(temp_k < pop64(last_word)); + auto res = select64(last_word, temp_k); + return (size64 - 1) * sizeof(a) * CHAR_BIT + res; + } +*/ + + /** + * @brief + * + * @param k + * @param range + * @return true If starting with the k`th 1, there are range consecutive 1, without any 0 between them. + * @return false Otherwise. + */ + // inline bool zero0s_between_k_ones(size_t k, size_t range, const u64 *a, size_t size) { + // } + + template + void fill_array_with_ones(T *a, size_t ones_count, size_t a_size) { + const T x = 0; + const T y = x - 1; + assert(y > x);// validating T is unsigned. + + if (ones_count == 0) + return; + constexpr uint64_t slotSize = sizeof(T) * CHAR_BIT; + assert(slotSize > 1); + size_t full_ones_words = ones_count / slotSize; + assert(full_ones_words <= a_size); + size_t i = 0; + for (; i < full_ones_words; i++) { + a[i] = y; + } + size_t ones_remainder = ones_count & (slotSize - 1u); + if (ones_remainder) { + T mask = (((T) 1) << ones_remainder) - 1u; + assert(i < a_size); + a[i] = mask; + } + // size_t full_ones_words = (ones_count + slotSize - 1u) + } + + inline bool compare_k_packed_items(u64 word, u8 rem, size_t rem_length, size_t items) { + assert(rem_length <= 8); + const u64 mask = (1ULL << rem_length) - 1; + assert(rem <= mask); + for (size_t i = 0; i < items; i++) { + if ((word & mask) == rem) + return true; + word >>= rem_length; + } + return false; + } + inline bool cmp_bits_inside_un_aligned_single_word(const u64 *a, u8 rem, size_t rem_length, size_t start_index1, size_t end_index1) { + assert(((end_index1 - start_index1) % rem_length) == 0); + const size_t items = (end_index1 - start_index1) / rem_length; + auto mp = (const u8 *) a; + const size_t total_bits_to_compare = end_index1 - start_index1; + const size_t offset = start_index1 & 7; + assert(total_bits_to_compare + offset <= 64); + + u64 word = 0; + memcpy(&word, mp + (start_index1 / 8), 8); + word >>= offset; + return compare_k_packed_items(word, rem, rem_length, items); + } + + bool compare_bits_ranged(const u64 *a, u8 rem, size_t rem_length, size_t start_index1, size_t end_index1); + + bool compare_bits(const u64 *a, u8 rem, size_t rem_length, size_t index1); + + u64 get_compare_mask(const u8 *a, u32 rem, size_t rem_length, size_t start_index1, size_t end_index1); + + __attribute__((always_inline)) inline uint32_t reduce32(uint32_t hash, uint32_t n) { + // http://lemire.me/blog/2016/06/27/a-fast-alternative-to-the-modulo-reduction/ + return (uint32_t) (((uint64_t) hash * n) >> 32); + } + + u64 extract_bits(const u8 *a, size_t start1, size_t end1); + + void update_bits(u8 *a, size_t start1, size_t end1, u64 value); + + void update_bits_inside_8bytes_boundaries_safer(u8 *a, size_t start1, size_t k, u64 value); +}// namespace bitsMani + + +namespace Shift_op::check { + bool test_rev4_bits_arr(const u8 *a, size_t packed_size); + bool test_rev4_bits_in_place(const u8 *a, size_t packed_size); + + bool test_shift4_right_r(); + + bool test_shift4_left_r(); + + /** + * Validates the functionality of an insert_push function, based on the original input, and the result. + * @param pre_a The original input + * @param post_a The output + * @param packed_size number of 4 items in pre_a. + * @param index4 the index in which we wanted to insert new item. + * @param item the new item value. (4 bits). + * @return + */ + bool validate_insert_push_4bit(u8 *pre_a, u8 *post_a, size_t packed_size, size_t index4, u8 item); + + bool validate_insert_push_4bit_disjoint_pair(u8 *pre_a, u8 *post_a, size_t packed_size, size_t index4, u8 lo_rem1, u8 lo_rem2); + + void insert_push_4bit_disjoint_pair_reversed_array(u8 *packedArray, size_t packedSize, size_t index4, u8 rem1, u8 rem2); + + bool test_pack_unpack_6x8(const uint8_t *pack_a, size_t pack_size); + + bool test_pack_unpack_pdep0(); + + bool test_pack_unpack_pdep(); + + bool test_pack_unpack_array_gen_k(const uint32_t *pack_a, size_t items, size_t k); + + void comp_test0_shift_arr_k_bits_right_att_wrapper(); + + bool comp_test_shift_arr_k_bits_right_att_wrapper(); +}// namespace Shift_op::check + +namespace bitsMani::test { + bool zero0s_between_k_ones_word_naive(size_t k, size_t range, u64 word); + bool val_zero0s_between_k_ones_word(size_t k, size_t range, u64 word); + bool val_zero0s_between_k_ones_word_rand(size_t reps); + void prt_zeros_failed(size_t k, size_t range, u64 word); + + bool wrap_extract_update_bits(); +}// namespace bitsMani::test +namespace str_bitsMani { + inline auto to_bin(uint64_t x, size_t length) -> std::string { + assert(length <= 64); + uint64_t b = 1ULL; + std::string res; + for (size_t i = 0; i < length; i++) { + res += (b & x) ? "1" : "0"; + b <<= 1ul; + } + return res; + } + + inline auto space_string(const std::string &s) -> std::string { + std::string new_s; + for (size_t i = 0; i < s.size(); i += 4) { + if (i) { + if (i % 16 == 0) { + new_s += "|"; + } else if (i % 4 == 0) { + new_s += "."; + } + } + new_s += s.substr(i, 4); + } + return new_s; + } + + inline auto format_word_to_string(uint64_t x, size_t length = 64) -> std::string { + std::string res = to_bin(x, length); + return space_string(res); + // std::cout << space_string(res) << std::endl; + } + inline auto format_128word_to_string(__uint128_t x, size_t length = 128) -> std::string { + assert(length >= 64); + u64 hi = x >> 64; + std::string lo_s = to_bin(x, 64); + std::string hi_s = to_bin(hi, length - 64); + std::string res = lo_s + hi_s; + return space_string(res); + // std::cout << space_string(res) << std::endl; + } + + inline auto format_2words_and_xor(uint64_t x, uint64_t y, size_t length = 64) -> std::string { + std::stringstream ss; + ss << format_word_to_string(x, length) << std::endl; + ss << format_word_to_string(y, length) << std::endl; + ss << format_word_to_string(x ^ y, length) << std::endl; + return ss.str(); + } + + inline std::string str_array_as_memory_no_delim(const uint8_t *a, size_t size8) { + std::string res; + size_t temp_size = size8; + size_t byte_index = 0; + while (temp_size >= 8) { + uint64_t h = 0; + memcpy(&h, a + byte_index, 8); + std::string temp_s = to_bin(h, 64); + res += temp_s; + byte_index += 8; + temp_size -= 8; + } + if (temp_size) { + uint64_t h = 0; + memcpy(&h, a + byte_index, temp_size); + std::string temp_s = to_bin(h, temp_size * 8); + res += temp_s; + } + return res; + } + + inline std::string str_array_as_memory(const uint8_t *a, size_t size8) { + std::stringstream s_res; + if (size8 <= 8) { + uint64_t h = 0; + memcpy(&h, a, size8); + auto s = format_word_to_string(h, size8 * 8); + // s_res << std::string(80, '*') << std::endl; + s_res << s << std::endl; + // s_res << std::string(80, '*') << std::endl; + return s_res.str(); + } + size_t size64 = (size8 + 7) / 8; + uint64_t a64[size64]; + Shift_op::init_array(a64, size64); + memcpy(a64, a, size8); + s_res << std::string(80, '*') << std::endl; + for (size_t i = 0; i < size64; i++) { + s_res << i << ":\t" << format_word_to_string(a64[i], 64); + s_res << "\t|\t" << _mm_popcnt_u64(a64[i]) << std::endl; + } + s_res << std::string(80, '*') << std::endl; + return s_res.str(); + } + + inline std::string str_array_half_byte_aligned(const uint8_t *a, size_t packed_size) { + if (packed_size == 0) { + return "Empty!"; + } + std::stringstream ss; + assert(packed_size); + // std::cout << std::endl; + ss << std::string(86, '-') << std::endl; + + ss << "0:\t"; + auto temp = (uint16_t) a[0]; + u16 lo0 = temp & 0xf; + u16 hi0 = temp >> 4u; + ss << std::left << std::setw(4) << (lo0); + ss << ", " << std::left << std::setw(4) << (hi0); + for (size_t i = 1; i < packed_size; i++) { + bool cond = ((i % 4) == 0); + if (!cond) { + ss << ", "; + } + + temp = ((uint16_t) a[i]); + u16 lo = temp & 0xf; + u16 hi = temp >> 4u; + ss << std::left << std::setw(4) << (lo); + ss << ", " << std::left << std::setw(4) << (hi); + + if (i % 4 == 3) { + ss << std::endl; + ss << ((i + 1) * 2) << ":\t"; + } + } + ss << std::endl; + ss << std::string(86, '-') << std::endl; + return ss.str(); + } + + template + inline std::string str_array_with_line_numbers(const T *a, size_t items, bool to_hex = false) { + auto base = std::dec; + if (to_hex) { + base = std::hex; + } + if (items == 0) { + std::stringstream s_res; + s_res << std::endl; + s_res << std::string(86, '-') << std::endl; + s_res << "Empty!"; + s_res << std::string(86, '-') << std::endl; + return s_res.str(); + } + + std::stringstream s_res; + s_res << std::endl; + s_res << std::string(86, '-') << std::endl; + + u64 s0 = a[0]; + + s_res << "0:\t" << std::left << std::setw(3) << base << s0; + for (size_t i = 1; i < items; i++) { + bool cond = ((i % 8) == 0); + if (!cond) { + s_res << ", "; + } + u64 temp_s = a[i]; + s_res << std::left << std::setw(3) << base << temp_s; + if (i % 8 == 7) { + s_res << std::endl; + s_res << (i + 1) << ":\t"; + } + } + s_res << std::endl; + s_res << std::string(86, '-') << std::endl; + return s_res.str(); + } + + inline std::string str_array_with_line_numbers(const uint8_t *a, size_t size) { + if (size == 0) { + std::stringstream s_res; + s_res << std::endl; + s_res << std::string(86, '-') << std::endl; + s_res << "Empty!"; + s_res << std::string(86, '-') << std::endl; + return s_res.str(); + } + + assert(size); + std::stringstream s_res; + s_res << std::endl; + s_res << std::string(86, '-') << std::endl; + + auto s0 = (uint16_t) a[0]; + s_res << "0:\t" << std::left << std::setw(3) << s0; + for (size_t i = 1; i < size; i++) { + bool cond = ((i % 8) == 0); + if (!cond) { + s_res << ", "; + } + auto temp_s = (uint16_t) a[i]; + s_res << std::left << std::setw(3) << temp_s; + if (i % 8 == 7) { + s_res << std::endl; + s_res << (i + 1) << ":\t"; + } + } + s_res << std::endl; + s_res << std::string(86, '-') << std::endl; + return s_res.str(); + } + + template + std::string get_first_k_bits_of_each_item(const T *a, size_t items, size_t k) { + std::stringstream s_res; + // s_res << format_word_to_string(a[0], k); + for (size_t i = 0; i < items; ++i) { + s_res << i << ":\t" << format_word_to_string(a[i], k) << std::endl; + } + return s_res.str(); + } + template + std::string format_qr(T qr) { + assert(sizeof(T) == 2); + std::string a = std::to_string(qr >> 8u); + if (a.length() < 2) { + a += " "; + } + std::string b = std::to_string(qr & 0xff); + if (b.length() < 3) { + b = b + std::string(3 - b.length(), ' '); + } + std::string tp = "(" + a + ", " + b + ")"; + return tp; + } + + inline std::string format_qr_by_width(u64 qr, size_t long_length, bool to_hex = false) { + std::string a = std::to_string(qr >> long_length); + size_t digits = std::ceil(log10((double) (1ULL << long_length))); + while (a.length() < 2) { + a += " "; + } + + auto rem = qr & _bzhi_u64(-1, long_length); + std::string b; + if (to_hex) { + std::stringstream ss; + ss << std::hex << rem; + b = ss.str(); + } else { + b = std::to_string(rem); + } + if (b.length() < digits) { + b += std::string(digits - b.length(), ' '); + } + std::string tp = "(" + a + ", " + b + ")"; + return tp; + } + + inline void print_array_as_tuples_with_line_numbers(const uint16_t *a, size_t size) { + assert(size); + std::cout << std::endl; + std::cout << std::string(86, '-') << std::endl; + auto s0 = format_qr(a[0]); + std::cout << "0:\t" << s0; + for (size_t i = 1; i < size; i++) { + bool cond = ((i % 8) == 0); + if (!cond) { + std::cout << ", "; + } + auto temp_s = format_qr(a[i]); + std::cout << temp_s; + if (i % 8 == 7) { + std::cout << std::endl; + std::cout << (i + 1) << ":\t"; + } + } + std::cout << std::endl; + std::cout << std::string(86, '-') << std::endl; + } + + inline std::string str_array_as_tuples_with_line_numbers(const uint16_t *a, size_t size) { + assert(size); + std::stringstream ss; + ss << std::endl; + ss << std::string(86, '-') << std::endl; + auto s0 = format_qr(a[0]); + ss << "0:\t" << s0; + for (size_t i = 1; i < size; i++) { + bool cond = ((i % 8) == 0); + if (!cond) { + ss << ", "; + } + auto temp_s = format_qr(a[i]); + ss << temp_s; + if (i % 8 == 7) { + ss << std::endl; + ss << (i + 1) << ":\t"; + } + } + ss << std::endl; + ss << std::string(86, '-') << std::endl; + auto res = ss.str(); + return res; + } + + inline std::string str_array_as_tuples_for_long_rems(const u64 *a, size_t size, size_t l_len, bool to_hex = false) { + assert(size); + std::stringstream ss; + ss << std::endl; + ss << std::string(86, '-') << std::endl; + auto s0 = format_qr_by_width(a[0], l_len, to_hex); + ss << "0:\t" << s0; + for (size_t i = 1; i < size; i++) { + bool cond = ((i % 8) == 0); + if (!cond) { + ss << ", "; + } + auto temp_s = format_qr_by_width(a[i], l_len, to_hex); + ss << temp_s; + if (i % 8 == 7) { + ss << std::endl; + ss << (i + 1) << ":\t"; + } + } + ss << std::endl; + ss << std::string(86, '-') << std::endl; + auto res = ss.str(); + return res; + } + // struct qr32 { + // u32 quot; + // u32 rem; + // + // qr32() : quot(0), rem(0) {} + // qr32(u32 q, u32 r) : quot(q), rem(r) {} + // + // qr32(u64 qr_pair) : quot(qr_pair >> 32), rem(qr_pair & 0xffff) {} + // }; + + inline std::string str_unpack_print_array(const u8 *a, size_t start_index1, size_t items, size_t items_len, bool to_hex = false) { + assert(items <= 256); + u64 temp_array[items]; + Shift_op::init_array(temp_array, items); + size_t temp_start = start_index1; + for (size_t i = 0; i < items; ++i) { + auto value = bitsMani::extract_bits(a, temp_start, temp_start + items_len); + temp_array[i] = value; + temp_start += items_len; + } + auto s = str_array_with_line_numbers(temp_array, items, to_hex); + return s; + } + +}// namespace str_bitsMani + +namespace Shift_pd { + + /** + * @brief right is move bits to higher address. << ( which is actually left) + * + * @tparam k2 + * @param pd + * @param start1 + * @param end1 bits after this index don't change. + * @return size_t + */ + template + inline void shift_by_k_right(__m512i *pd, size_t start1, size_t end1) { + assert(end1 <= 512); + assert(start1 <= end1);// this is not a must + if (start1 >= 512 - 64) { + //FIXME:: the case of end = 512 needs to be handled differently. + if (start1 + k == 512) { + // std::cout << "start1 + k == 512" << std::endl; + return; + } + assert(start1 + k < 512); + u64 word = 0; + memcpy(&word, (u8 *) pd + 64 - 8, 8); + size_t new_start = start1 - (512 - 64); + size_t new_end = end1 - (512 - 64); + const u64 lo_mask = (1ULL << (new_start + k)) - 1u; + const u64 hi_mask = _bzhi_u64(-1, new_end); + assert(hi_mask); + u64 lo = word & lo_mask; + u64 hi = word & ~hi_mask; + u64 mid_to_shift = word & ~_bzhi_u64(-1, new_start); + // u64 mid = (word << k) & (hi_mask & ~lo_mask); + u64 mid = (mid_to_shift << k) & hi_mask; + assert(!(lo & mid)); + assert(!(lo & hi)); + assert(!(hi & mid)); + u64 new_word = lo | mid | hi; + memcpy((u8 *) pd + 64 - 8, &new_word, 8); + // std::cout << "case_m1: " << std::endl; + return; + } + // const size_t items = (end1 - start1) / k; + auto mp = (u8 *) pd; + const size_t total_bits_to_compare = end1 - start1; + const size_t offset = start1 & 7; + if (total_bits_to_compare + offset <= 64) { + u64 word = 0; + const size_t bytes_to_copy = (offset + total_bits_to_compare + 7) / 8; + assert((start1 / 8) + bytes_to_copy <= 64); + memcpy(&word, mp + (start1 / 8), bytes_to_copy); + const u64 lo_mask = (1ULL << (offset + k)) - 1u; + assert(lo_mask);// this can't be 0; + // const u64 lo_mask = (1ULL << (offset + 1)) - 1u; + // const u64 hi_mask = (1ULL << (offset + total_bits_to_compare)) - 1u; + const u64 hi_mask = _bzhi_u64(-1, offset + total_bits_to_compare); + assert(hi_mask); + u64 lo = word & lo_mask; + u64 hi = word & ~hi_mask; + u64 mid_to_shift = word & ~_bzhi_u64(-1, offset); + u64 mid = (mid_to_shift << k) & hi_mask; + // u64 mid = (word << k) & (hi_mask & ~_bzhi_u64(-1, offset + k)); + // u64 mid = (word << k) & (hi_mask & ~lo_mask); + assert(!(lo & mid)); + assert(!(lo & hi)); + assert(!(hi & mid)); + u64 new_word = lo | mid | hi; + /* if (k == 2) { + std::cout << std::string(80, '=') << std::endl; + std::cout << "start1: \t" << start1 << std::endl; + std::cout << "end1: \t" << end1 << std::endl; + std::cout << "offset: \t" << offset << std::endl; + std::cout << std::string(80, '~') << std::endl; + std::cout << "lo: \t" << str_bitsMani::format_word_to_string(lo) << std::endl; + std::cout << "mid: \t" << str_bitsMani::format_word_to_string(mid) << std::endl; + std::cout << "hi: \t" << str_bitsMani::format_word_to_string(hi) << std::endl; + std::cout << "word: \t" << str_bitsMani::format_word_to_string(word) << std::endl; + std::cout << "new_word: \t" << str_bitsMani::format_word_to_string(new_word) << std::endl; + std::cout << std::string(80, '=') << std::endl; + } + */ + memcpy(mp + (start1 / 8), &new_word, bytes_to_copy); + // std::cout << "case0: " << std::endl; + return; + } + u64 *pd64 = (u64 *) pd; + const size_t first_word_index = start1 / 64; + const size_t last_word_index = (end1 - 1) / 64; + // size_t temp_index = last_word_index; + const u64 first_word = pd64[first_word_index]; + // const u64 second_word = pd64[first_word_index + 1]; + const u64 last_word = pd64[last_word_index]; + + for (int i = (int) last_word_index; i > (int) first_word_index; i--) { + assert(i > 0); + pd64[i] = (pd64[i] << k) | (pd64[i - 1] >> (64 - k)); + } + + //fix first word + if ((start1 & 63) + k > 64) { + // std::cout << "rel-start1 + k:\t" << (start1 & 63) + k << std::endl; + size_t rel_start = (start1 & 63); + size_t shift_by = rel_start + k - 64; + // u64 temp_w1 = first_word & ~_bzhi_u64(-1, rel_start - 1); + // u64 temp_w1 = first_word & ~_bzhi_u64(-1, rel_start); //FIXME!!! + u64 temp_w1 = (first_word >> rel_start);//FIXME!!! + // u64 lo_w1 = temp_w1 << (shift_by - 1); + u64 lo_w1 = temp_w1 << shift_by; +#ifndef NDEBUG + u64 bits_to_move = _bextr_u64(first_word, rel_start, 64 - rel_start); + u64 shifted_bits = bits_to_move << shift_by; + if (lo_w1 != shifted_bits) { + std::cout << "lo_w1: \t" << lo_w1 << std::endl; + std::cout << "shifted_bits: \t" << shifted_bits << std::endl; + assert(0); + } +#endif//!NDEBUG + const size_t rel_index = (start1 + k) & 63; + const u64 mask = _bzhi_u64(-1, rel_index); + // u64 new_lo = (first_word & >> (64 - k)) & mask; + + u64 temp_lo = temp_w1 >> (64 - k); +#ifndef NDEBUG + u64 masked_temp_lo = temp_lo & mask; + if (temp_lo != masked_temp_lo) { + std::cout << "temp_lo: \t" << temp_lo << std::endl; + std::cout << "m_temp_lo: \t" << masked_temp_lo << std::endl; + std::cout << std::string(80, '-') << std::endl; + std::cout << "temp_lo: \t" << str_bitsMani::format_word_to_string(temp_lo) << std::endl; + std::cout << "m_temp_lo: \t" << str_bitsMani::format_word_to_string(masked_temp_lo) << std::endl; + assert(0); + } + +#endif//!NDEBUG \ + // u64 lo = temp_w1 >> (64 - k) & mask; \ + // u64 lo = pd64[first_word_index + 1] & mask; + u64 hi = pd64[first_word_index + 1] & ~mask; + assert(!(temp_lo & hi)); + pd64[first_word_index + 1] = temp_lo | hi; + } else { + // std::cout << "start != 63." << std::endl; + u64 lo = first_word & _bzhi_u64(-1, (start1 & 63) + k); + u64 mid = (first_word & ~_bzhi_u64(-1, start1 & 63)) << k; + assert(!(lo & mid)); + pd64[first_word_index] = lo | mid; + /* const u64 mask1 = _bzhi_u64(-1, (start1 + k) & 63); + const u64 w1_shifted = first_word << k; + pd64[first_word_index] = (first_word & mask1) | (w1_shifted & ~mask1); */ + } + //fix last word + const u64 mask2 = _bzhi_u64(-1, end1 & 63); + if ((end1 & 63) == 0) { + // std::cout << "end is aligned." << std::endl; + return; + } + // std::cout << "***end is not aligned.***" << std::endl; + pd64[last_word_index] = (pd64[last_word_index] & mask2) | (last_word & ~mask2); + } + + + template + u64 shift_by_k_left_inside_word(u64 word, size_t start1, size_t end1) { + assert(start1 + k <= end1); + assert(start1 < 64); + assert(end1 <= 64); + assert(end1 > 0); + const u64 lo_mask = (1ULL << start1) - 1u; + assert(end1 > k); + const u64 hi_mask = _bzhi_u64(-1, end1 - k); + assert(hi_mask); + const u64 mid_mask = _bzhi_u64(-1, end1 - start1 - k) << start1; + u64 lo = word & lo_mask; + u64 hi = word & ~hi_mask; + // u64 mid_to_shift = word & (~(lo_mask << k) & ); + // u64 mid = (mid_to_shift >> k) & hi_mask; + // u64 ns_mid = word & mid_mask; + u64 mid = (word >> k) & mid_mask; + assert(!(lo & mid)); + assert(!(lo & hi)); + assert(!(hi & mid)); + u64 new_word = lo | mid | hi; + /*std::cout << std::string(80, '=') << std::endl; + std::cout << "start1: \t" << start1 << std::endl; + std::cout << "end1: \t" << end1 << std::endl; + // std::cout << "offset: \t" << offset << std::endl; + std::cout << std::string(80, '~') << std::endl; + std::cout << "lo: \t" << str_bitsMani::format_word_to_string(lo) << std::endl; + std::cout << "ns_mid: \t" << str_bitsMani::format_word_to_string(ns_mid) << std::endl; + std::cout << "mid: \t" << str_bitsMani::format_word_to_string(mid) << std::endl; + std::cout << "hi: \t" << str_bitsMani::format_word_to_string(hi) << std::endl; + std::cout << "word: \t" << str_bitsMani::format_word_to_string(word) << std::endl; + std::cout << "new_word: \t" << str_bitsMani::format_word_to_string(new_word) << std::endl; + std::cout << std::string(80, '=') << std::endl;*/ + + return new_word; + // memcpy(mp + (start1 / 8), &new_word, bytes_to_copy); + // return; + } + + template + void shift_by_k_left(__m512i *pd, size_t start1, size_t end1) { + // constexpr size_t end1 = 512; + assert(end1 <= 512); + assert(start1 <= end1);// this is not a must + if (start1 + k == end1) + return; + if (start1 >= 512 - 64) { + assert(start1 + k < 512); + u64 word = 0; + memcpy(&word, (u8 *) pd + 64 - 8, 8); + size_t new_start = start1 - (512 - 64); + size_t new_end = end1 - (512 - 64); + u64 new_word = shift_by_k_left_inside_word(word, new_start, new_end); + memcpy((u8 *) pd + 64 - 8, &new_word, 8); + // std::cout << "m0: " << std::endl; + return; + + /* const u64 lo_mask = (1ULL << (new_start + k)) - 1u; + const u64 hi_mask = _bzhi_u64(-1, new_end); + assert(hi_mask); + u64 lo = word & lo_mask; + u64 hi = word & ~hi_mask; + u64 mid_to_shift = word & ~_bzhi_u64(-1, new_start); + // u64 mid = (word << k) & (hi_mask & ~lo_mask); + u64 mid = (mid_to_shift << k) & hi_mask; + assert(!(lo & mid)); + assert(!(lo & hi)); + assert(!(hi & mid)); + u64 new_word = lo | mid | hi; + memcpy((u8 *) pd + 64 - 8, &new_word, 8); + // std::cout << "case_m1: " << std::endl; + return; */ + } + // const size_t items = (end1 - start1) / k; + auto mp = (u8 *) pd; + const size_t total_bits_to_compare = end1 - start1; + const size_t offset = start1 & 7; + if (total_bits_to_compare + offset <= 64) { + u64 word = 0; + const size_t bytes_to_copy = (offset + total_bits_to_compare + 7) / 8; + assert((start1 / 8) + bytes_to_copy <= 64); + memcpy(&word, mp + (start1 / 8), bytes_to_copy); + + u64 new_word = shift_by_k_left_inside_word(word, offset, offset + total_bits_to_compare); + /* const u64 lo_mask = (1ULL << offset) - 1u; + // assert(lo_mask);// this can't be 0; + assert(offset + total_bits_to_compare > k); + const u64 hi_mask = _bzhi_u64(-1, offset + total_bits_to_compare - k); + assert(hi_mask); + u64 lo = word & lo_mask; + u64 hi = word & ~hi_mask; + u64 mid_to_shift = word & _bzhi_u64(-1, offset + total_bits_to_compare); + u64 mid = (mid_to_shift >> k) & hi_mask; + assert(!(lo & mid)); + assert(!(lo & hi)); + assert(!(hi & mid)); + u64 new_word = lo | mid | hi; */ + memcpy(mp + (start1 / 8), &new_word, bytes_to_copy); + // std::cout << "m1: " << std::endl; + + /* std::cout << std::string(80, '=') << std::endl; + std::cout << "start1: \t" << start1 << std::endl; + std::cout << "end1: \t" << end1 << std::endl; + std::cout << "offset: \t" << offset << std::endl; + std::cout << std::string(80, '~') << std::endl; + std::cout << "lo: \t" << str_bitsMani::format_word_to_string(lo) << std::endl; + std::cout << "mid: \t" << str_bitsMani::format_word_to_string(mid) << std::endl; + std::cout << "hi: \t" << str_bitsMani::format_word_to_string(hi) << std::endl; + std::cout << "word: \t" << str_bitsMani::format_word_to_string(word) << std::endl; + std::cout << "new_word: \t" << str_bitsMani::format_word_to_string(new_word) << std::endl; + std::cout << std::string(80, '=') << std::endl; */ + return; + } + // assert(0); + u64 *pd64 = (u64 *) pd; + const size_t first_word_index = start1 / 64; + const size_t last_word_index = (end1 - 1) / 64; + // size_t temp_index = last_word_index; + const u64 first_word = pd64[first_word_index]; + // const u64 second_word = pd64[first_word_index + 1]; + // const u64 last_word = pd64[last_word_index]; + + for (int i = (int) first_word_index; i < (int) last_word_index; i++) { + pd64[i] = (pd64[i] >> k) | (pd64[i + 1] << (64 - k)); + } + + // size_t rel_end = ((end1 - 1) & 63) + 1; + /*std::cout << "m2" << std::endl; + std::cout << "start1: \t" << start1 << std::endl; + std::cout << "end1: \t" << end1 << std::endl; + std::cout << "rel_start1: \t" << (start1 & 63) << std::endl; + std::cout << "rel_end1: \t" << rel_end << std::endl; + std::cout << "i0: \t" << first_word_index << std::endl; + std::cout << "i_end: \t" << last_word_index << std::endl;*/ + //fix first word + const u64 start_mask = _bzhi_u64(-1, start1 & 63); + const u64 hi = (pd64[first_word_index] & ~start_mask); + const u64 lo = (first_word & start_mask); + + /*std::cout << "start_mask: \t" << str_bitsMani::format_word_to_string(start_mask) << std::endl; + std::cout << "old w0: \t" << str_bitsMani::format_word_to_string(first_word) << std::endl; + std::cout << "new w0: \t" << str_bitsMani::format_word_to_string(pd64[first_word_index]) << std::endl; + std::cout << "hi: \t" << str_bitsMani::format_word_to_string(hi) << std::endl; + std::cout << "lo: \t" << str_bitsMani::format_word_to_string(lo) << std::endl; +*/ + pd64[first_word_index] = lo | hi; + + // std::cout << "last_word_index: \t" << last_word_index << std::endl; + //fix last word + const size_t end_mask_index = ((end1 - 1) & 63) + 1; + u64 end_mask = _bzhi_u64(-1, end_mask_index); + assert(end_mask); + u64 e_lo = ((pd64[last_word_index] & end_mask) >> k); + u64 e_hi = (pd64[last_word_index] & ~(end_mask >> k)); + assert(!(e_lo & e_hi)); + u64 new_last_word = e_lo | e_hi; + + // std::cout << "start_mask: \t" << str_bitsMani::format_word_to_string(start_mask) << std::endl; + // std::cout << "old w1: \t" << str_bitsMani::format_word_to_string(pd64[last_word_index]) << std::endl; + // std::cout << "new w1: \t" << str_bitsMani::format_word_to_string(new_last_word) << std::endl; + // std::cout << "e_hi: \t" << str_bitsMani::format_word_to_string(e_hi) << std::endl; + // std::cout << "e_lo: \t" << str_bitsMani::format_word_to_string(e_lo) << std::endl; + pd64[last_word_index] = new_last_word; + } + + + inline void shift_by_k_right_no_template(__m512i *pd, size_t start1, size_t end1, size_t k) { + assert(end1 <= 512); + assert(start1 <= end1);// this is not a must + if (start1 >= 512 - 64) { + assert(0); + u64 word; + memcpy(&word, (u8 *) pd + 64 - 8, 8); + size_t new_start = start1 - (512 - 64); + size_t new_end = end1 - (512 - 64); + const u64 lo_mask = (1ULL << (new_start + k)) - 1u; + const u64 hi_mask = _bzhi_u64(-1, new_end); + assert(hi_mask); + u64 lo = word & lo_mask; + u64 hi = word & ~hi_mask; + u64 mid_to_shift = word & ~_bzhi_u64(-1, new_start); + // u64 mid = (word << k) & (hi_mask & ~lo_mask); + u64 mid = (mid_to_shift << k) & hi_mask; + assert(!(lo & mid)); + assert(!(lo & hi)); + assert(!(hi & mid)); + u64 new_word = lo | mid | hi; + memcpy((u8 *) pd + 64 - 8, &new_word, 8); + // std::cout << "case_m1: " << std::endl; + return; + } + // const size_t items = (end1 - start1) / k; + auto mp = (u8 *) pd; + const size_t total_bits_to_compare = end1 - start1; + const size_t offset = start1 & 7; + if (total_bits_to_compare + offset <= 64) { + u64 word = 0; + const size_t bytes_to_copy = (offset + total_bits_to_compare + 7) / 8; + assert((start1 / 8) + bytes_to_copy <= 64); + memcpy(&word, mp + (start1 / 8), bytes_to_copy); + + const u64 lo_mask = (1ULL << (offset + k)) - 1u; + // const u64 lo_mask = (1ULL << (offset + 1)) - 1u; + // const u64 hi_mask = (1ULL << (offset + total_bits_to_compare)) - 1u; + const u64 hi_mask = _bzhi_u64(-1, offset + total_bits_to_compare); + assert(hi_mask); + u64 lo = word & lo_mask; + u64 hi = word & ~hi_mask; + u64 mid_to_shift = word & ~_bzhi_u64(-1, offset); + u64 mid = (mid_to_shift << k) & hi_mask; + // u64 mid = (word << k) & (hi_mask & ~_bzhi_u64(-1, offset + k)); + // u64 mid = (word << k) & (hi_mask & ~lo_mask); + assert(!(lo & mid)); + assert(!(lo & hi)); + assert(!(hi & mid)); + u64 new_word = lo | mid | hi; + /* if (k == 2) { + std::cout << std::string(80, '=') << std::endl; + std::cout << "start1: \t" << start1 << std::endl; + std::cout << "end1: \t" << end1 << std::endl; + std::cout << "offset: \t" << offset << std::endl; + std::cout << std::string(80, '~') << std::endl; + std::cout << "lo: \t" << str_bitsMani::format_word_to_string(lo) << std::endl; + std::cout << "mid: \t" << str_bitsMani::format_word_to_string(mid) << std::endl; + std::cout << "hi: \t" << str_bitsMani::format_word_to_string(hi) << std::endl; + std::cout << "word: \t" << str_bitsMani::format_word_to_string(word) << std::endl; + std::cout << "new_word: \t" << str_bitsMani::format_word_to_string(new_word) << std::endl; + std::cout << std::string(80, '=') << std::endl; + } + */ + memcpy(mp + (start1 / 8), &new_word, bytes_to_copy); + // std::cout << "case0: " << std::endl; + return; + } + u64 *pd64 = (u64 *) pd; + const size_t first_word_index = start1 / 64; + const size_t last_word_index = (end1 - 1) / 64; + // size_t temp_index = last_word_index; + const u64 first_word = pd64[first_word_index]; + // const u64 second_word = pd64[first_word_index + 1]; + const u64 last_word = pd64[last_word_index]; + + for (int i = (int) last_word_index; i > (int) first_word_index; i--) { + assert(i > 0); + pd64[i] = (pd64[i] << k) | (pd64[i - 1] >> (64 - k)); + } + + //fix first word + if ((start1 & 63) + k > 64) { + // std::cout << "rel-start1 + k:\t" << (start1 & 63) + k << std::endl; + size_t rel_start = (start1 & 63); + size_t shift_by = rel_start + k - 64; + // u64 temp_w1 = first_word & ~_bzhi_u64(-1, rel_start - 1); + // u64 temp_w1 = first_word & ~_bzhi_u64(-1, rel_start); //FIXME!!! + u64 temp_w1 = (first_word >> rel_start);//FIXME!!! + // u64 lo_w1 = temp_w1 << (shift_by - 1); + u64 lo_w1 = temp_w1 << shift_by; +#ifndef NDEBUG + u64 bits_to_move = _bextr_u64(first_word, rel_start, 64 - rel_start); + u64 shifted_bits = bits_to_move << shift_by; + if (lo_w1 != shifted_bits) { + std::cout << "lo_w1: \t" << lo_w1 << std::endl; + std::cout << "shifted_bits: \t" << shifted_bits << std::endl; + assert(0); + } +#endif//!NDEBUG + const size_t rel_index = (start1 + k) & 63; + const u64 mask = _bzhi_u64(-1, rel_index); + // u64 new_lo = (first_word & >> (64 - k)) & mask; + + u64 temp_lo = temp_w1 >> (64 - k); +#ifndef NDEBUG + u64 masked_temp_lo = temp_lo & mask; + if (temp_lo != masked_temp_lo) { + std::cout << "temp_lo: \t" << temp_lo << std::endl; + std::cout << "m_temp_lo: \t" << masked_temp_lo << std::endl; + std::cout << std::string(80, '-') << std::endl; + std::cout << "temp_lo: \t" << str_bitsMani::format_word_to_string(temp_lo) << std::endl; + std::cout << "m_temp_lo: \t" << str_bitsMani::format_word_to_string(masked_temp_lo) << std::endl; + assert(0); + } +#endif//!NDEBUG + + // u64 lo = temp_w1 >> (64 - k) & mask; + // u64 lo = pd64[first_word_index + 1] & mask; + u64 hi = pd64[first_word_index + 1] & ~mask; + assert(!(temp_lo & hi)); + pd64[first_word_index + 1] = temp_lo | hi; + } else { + // std::cout << "start != 63." << std::endl; + u64 lo = first_word & _bzhi_u64(-1, (start1 & 63) + k); + u64 mid = (first_word & ~_bzhi_u64(-1, start1 & 63)) << k; + assert(!(lo & mid)); + pd64[first_word_index] = lo | mid; + /* const u64 mask1 = _bzhi_u64(-1, (start1 + k) & 63); + const u64 w1_shifted = first_word << k; + pd64[first_word_index] = (first_word & mask1) | (w1_shifted & ~mask1); */ + } + //fix last word + const u64 mask2 = _bzhi_u64(-1, end1 & 63); + if ((end1 & 63) == 0) { + // std::cout << "end is aligned." << std::endl; + return; + } + // std::cout << "***end is not aligned.***" << std::endl; + pd64[last_word_index] = (pd64[last_word_index] & mask2) | (last_word & ~mask2); + } + // void insert_push_4bit_by_shift(u8 *packedArray, size_t packedSize, size_t index4, u8 item); + template + void insert_push_k_bits_item_by_shift(__m512i *pd, size_t start1, size_t end1, u32 value) { + assert(value <= _bzhi_u64(-1, k)); + assert(end1 <= 512); + assert(start1 + k <= end1); + + shift_by_k_right(pd, start1, end1); + bitsMani::update_bits_inside_8bytes_boundaries_safer((u8 *) pd, start1, k, value); + } + + template + void insert_pull_k_bits_item_by_shift(__m512i *pd, size_t start1, size_t end1, u32 value) { + assert(value <= _bzhi_u64(-1, k)); + assert(end1 <= 512); + assert(start1 + k <= end1); + + shift_by_k_left(pd, start1, end1); + bitsMani::update_bits_inside_8bytes_boundaries_safer((u8 *) pd, end1 - k, k, value); + } + /* template + void insert_push_2k_bit_by_shift(u8 *packedArray, size_t packedSize, size_t packed_index, u8 item) { + //FIXME. + assert(two_k < 8);// use memmove. + assert((two_k & 1) == 0); + assert(item <= _bzhi_u32(-1, two_k)); + assert(packed_index * two_k < packedSize); + assert(2 <= packedSize); + +#ifndef NDEBUG + u8 backup_a[packedSize]; + memcpy(backup_a, packedArray, packedSize); +#endif + size_t start4 = index4; + size_t end4 = packedSize * 2 - 1; + size_t size64 = (packedSize + 7) / 8; + shift_arr_4bits_right_att_wrapper((u64 *) packedArray, start4, end4, size64); + size_t byte_index = index4 / 2; + if (!(index4 & 1)) { + // A[1]++; + packedArray[byte_index] = (packedArray[byte_index] & 0xf0) | item; + } else { + // A[2]++; + packedArray[byte_index] = (packedArray[byte_index] & 0xf) | (item << 4u); + } + + assert(check::validate_insert_push_4bit(backup_a, packedArray, packedSize, index4, item)); + return; + } */ + + inline void pack_array_gen_k_with_offset(__m512i *pd, const u32 *unpacked_array, size_t start1, size_t items, size_t k) { + auto pd8 = (u8 *) pd; + size_t first_byte_index = start1 / 8; + u8 backup = pd8[first_byte_index]; + Shift_op::pack_array_gen_k(pd8 + first_byte_index, unpacked_array, items, k); + const size_t offset = start1 & 7; + shift_by_k_right_no_template(pd, start1 / 8 * 8, start1 + items * k, k); + u8 mask = (1 << offset) - 1; + pd8[first_byte_index] = (backup & mask) | (pd8[first_byte_index] & ~mask); + // bitsMani::update_bits_inside_8bytes_boundaries_safer(pd8 + first_byte_index, 0, ) + } + template + size_t min_failed_memcmp_index(const T *a, const S *b, size_t bytes_to_compare) { + auto a8 = (const u8 *) a; + auto b8 = (const u8 *) b; + for (size_t i = 0; i < bytes_to_compare; ++i) { + if (a8[i] != b8[i]) + return i; + } + return bytes_to_compare; + } + + inline u64 extract_64bits_safe(const __m512i *pd, size_t start1, size_t k) { + assert(k <= 64); + const size_t length = k; + const u64 mask = _bzhi_u64(-1, length); + const size_t offset = start1 & 7; + u64 word; + const size_t first_byte = start1 / 8; + assert(first_byte < 64); + const size_t bytes_to_copy = (first_byte <= 64 - 8) ? 8 : 64 - first_byte; + assert(bytes_to_copy <= 8); + // std::cout << "bytes_to_copy: \t" << bytes_to_copy << std::endl; + memcpy(&word, (u8 *) pd + first_byte, bytes_to_copy); + word >>= offset; + if (offset + length <= 64) { + return word & mask; + } else { + u64 hi = ((u8 *) pd)[first_byte] << (64 - offset); + return mask | hi; + } + } + + inline void update_bits_inside_u64_boundaries(__m512i *pd, size_t start1, size_t length, u64 value) { + assert(length <= 64); + assert(value <= _bzhi_u64(-1, length)); + const u64 mask = _bzhi_u64(-1, length); + const size_t word_index = start1 / 64; + const size_t offset = start1 & 63; + u64 *mp = (u64 *) pd + word_index; + u64 word = mp[0]; + u64 shifted_mask = mask << offset; + u64 mid = value << offset; + #ifndef NDEBUG + u64 inner = mid; + u64 outer = (word & ~shifted_mask); + assert(!(inner & outer)); + assert((inner & shifted_mask) == inner); + #endif //!NDEBUG + u64 new_word = (word & ~shifted_mask) | mid; + mp[0] = new_word; + } + + inline void update_bits_inside_8bytes_boundaries(__m512i *pd, size_t start1, size_t length, u64 value) { + assert(start1 <= (512 - 64)); + // if (start1 >= (512 - 64)) { + // return update_bits_inside_u64_boundaries(pd, start1, length, value); + // } + assert(length <= 64); + assert(value <= _bzhi_u64(-1, length)); + const u64 mask = _bzhi_u64(-1, length); + const size_t offset = start1 & 7; + const size_t byte_index = start1 / 8; + u64 word; + // assert() + auto mp = (u8 *) pd + byte_index; + memcpy(&word, mp, 8); + u64 shifted_mask = mask << offset; + u64 mid = value << offset; + u64 new_word = (word & ~shifted_mask) | mid; + memcpy(mp, &new_word, 8); + } + + inline void update_64bits_safe(__m512i *pd, size_t start1, size_t length, u64 value) { + assert(length <= 64); + assert(start1 + length <= 512); + assert(value <= _bzhi_u64(-1, length)); + if (start1 >= 512 - 64) { + return update_bits_inside_u64_boundaries(pd, start1, length, value); + } + if (length + (start1 & 7) <= 64) + return update_bits_inside_8bytes_boundaries(pd, start1, length, value); + else { + const size_t sub_len1 = length - 8; + const u64 val1 = value & _bzhi_u64(-1, sub_len1); + const u64 val2 = value >> sub_len1; + update_bits_inside_8bytes_boundaries(pd, start1, sub_len1, val1); + update_bits_inside_8bytes_boundaries(pd, start1 + sub_len1, 8, val2); + } + } + + + inline bool compare_bits_ranged_safe(const __m512i *pd, u8 rem, size_t rem_length, size_t start_index1, size_t end_index1) { + assert(((end_index1 - start_index1) % rem_length) == 0); + const size_t items = (end_index1 - start_index1) / rem_length; + if (start_index1 >= 512 - 64) { + size_t offset = start_index1 - (512 - 64); + u64 word = ((const u64 *) pd)[7]; + word >>= offset; + return bitsMani::compare_k_packed_items(word, rem, rem_length, items); + } + // const size_t items = (end_index1 - start_index1) / rem_length; + auto mp = (const u8 *) pd; + const size_t total_bits_to_compare = end_index1 - start_index1; + const size_t offset = start_index1 & 7; + if (total_bits_to_compare + offset <= 64) { + u64 word = 0; + memcpy(&word, mp + (start_index1 / 8), 8); + word >>= offset; + return bitsMani::compare_k_packed_items(word, rem, rem_length, items); + } + size_t first_part_bits = (64 - offset) / rem_length * rem_length; + assert(first_part_bits); + auto temp = bitsMani::cmp_bits_inside_un_aligned_single_word((const u64 *) pd, rem, rem_length, start_index1, start_index1 + first_part_bits); + auto rest = (start_index1 + first_part_bits < end_index1) && compare_bits_ranged_safe(pd, rem, rem_length, start_index1 + first_part_bits, end_index1); + return temp or rest; + } +}// namespace Shift_pd + +namespace Shift_pd::check { + + inline void random_filler(__m512i *pd) { + for (size_t i = 0; i < (512 / 32); i++) { + ((u32 *) pd)[i] = random(); + } + } + + inline void print_helper(const __m512i *pd0, const __m512i *pd1, size_t beg, size_t end, size_t k, size_t backup_index, size_t s_byte, size_t offset, size_t reps) { + + // size_t s_byte = beg / 8; + size_t bytes0 = std::min(64u - s_byte, 16); + // size_t bytes = ((64 - s_byte) >= 16) ? 16 : (64 - s_byte); + // assert(bytes == bytes0); + size_t word_index = backup_index / 64; + std::string w_m1_after = str_bitsMani::format_word_to_string(((const u64 *) pd1)[word_index - 1]); + std::string w0_after = str_bitsMani::format_word_to_string(((const u64 *) pd1)[word_index]); + std::string w1_after = str_bitsMani::format_word_to_string(((const u64 *) pd1)[word_index + 1]); + + std::string w_m1_before = str_bitsMani::format_word_to_string(((const u64 *) pd0)[word_index - 1]); + std::string w0_before = str_bitsMani::format_word_to_string(((const u64 *) pd0)[word_index]); + std::string w1_before = str_bitsMani::format_word_to_string(((const u64 *) pd0)[word_index + 1]); + + assert(word_index * 64 <= backup_index); + size_t offset_from_first_printed_bit_to_error = backup_index - word_index * 64; + std::cout << std::string(80, '=') << std::endl; + std::cout << "first_p_index: \t" << word_index * 64 << std::endl; + std::cout << "offset_index: \t" << offset_from_first_printed_bit_to_error << std::endl; + std::cout << std::string(80, '-') << std::endl; + std::cout << "w_m1_before: \t" << w_m1_before << std::endl; + std::cout << "w_m1_after: \t" << w_m1_after << std::endl; + std::cout << "" << std::endl; + std::cout << "w0_before: \t" << w0_before << std::endl; + std::cout << "w0_after: \t" << w0_after << std::endl; + std::cout << "" << std::endl; + std::cout << "w1_before: \t" << w1_before << std::endl; + std::cout << "w1_after: \t" << w1_after << std::endl; + std::cout << std::string(80, '-') << std::endl; + std::cout << "beg: \t" << beg << std::endl; + std::cout << "end: \t" << end << std::endl; + std::cout << "reps: \t" << reps << std::endl; + std::cout << std::string(80, '=') << std::endl; + + + auto s_after = str_bitsMani::str_array_as_memory_no_delim((const u8 *) pd1 + s_byte, bytes0); + auto s_backup = str_bitsMani::str_array_as_memory_no_delim((const u8 *) pd0 + s_byte, bytes0); + + auto s_after_del = str_bitsMani::str_array_as_memory((const u8 *) pd1 + s_byte, bytes0); + auto s_backup_del = str_bitsMani::str_array_as_memory((const u8 *) pd0 + s_byte, bytes0); + + std::cout << "first_printed_bit: \t" << s_byte * 8 << std::endl; + std::cout << "s_byte: \t" << s_byte << std::endl; + std::cout << "offset: \t" << offset << std::endl; + std::cout << "beg: \t" << beg << std::endl; + std::cout << "end: \t" << end << std::endl; + std::cout << "backup_index: \t" << backup_index << std::endl; + std::cout << "shift_k:\t" << k << std::endl; + std::cout << "reps: \t" << reps << std::endl; + std::cout << std::string(80, '=') << std::endl; + std::cout << "s_backup: " << s_backup << std::endl; + std::cout << "s_after: " << s_after << std::endl; + std::cout << "s_backup_del: \n" + << s_backup_del << std::endl; + std::cout << "s_after_del: \n" + << s_after_del << std::endl; + assert(0); + } + + template + inline void test_shift_by_2_right() { + __m512i pd = {0}; + for (size_t i = 0; i < (512 / 32); i++) { + ((u32 *) &pd)[i] = random(); + } + + const __m512i pd0 = pd; + for (size_t reps = 0; reps < (1ULL << 16); reps++) { + size_t beg = 0; + size_t end = 0; + while (true) { + beg = random() % (512 + 1); + end = random() % (512 + 1); + // bool cond1 = (beg + shift_k <= end); + // bool cond2 = (end - beg <= 96);// remove this condition; + bool cond3 = (beg + shift_k < end); + // if (cond1 and cond2 and cond3) { + if (cond3) { + break; + } + } + + /* std::cout << std::string(80, '*') << std::endl; + std::cout << "beg: " << beg << std::endl; + std::cout << "end: " << end << std::endl; + std::cout << std::string(80, '*') << std::endl; */ + pd = pd0; + assert(memcmp(&pd, &pd0, 64) == 0); + // constexpr size_t shift_k = 1; + shift_by_k_right(&pd, beg, end); + + for (size_t i = 0; i < beg; i++) { + bool a_bit = bitsMani::is_single_bit_set((const u64 *) &pd, i, 8); + bool val_bit = bitsMani::is_single_bit_set((const u64 *) &pd0, i, 8); + + assert(a_bit == val_bit); + + /*if (a_bit == val_bit) + continue; + size_t s_byte = i / 8; + size_t bytes0 = std::min(64u - s_byte, 16); + assert(bytes0 <= 16); + auto s0 = str_bitsMani::str_array_as_memory_no_delim((const u8 *) &pd + s_byte, bytes0); + auto s1 = str_bitsMani::str_array_as_memory_no_delim((const u8 *) &pd0 + s_byte, bytes0); + + std::cout << "s_byte: \t" << s_byte << std::endl; + std::cout << "offset: \t" << i - s_byte * 8 << std::endl; + std::cout << "i: \t" << i << std::endl; + std::cout << "beg: \t" << beg << std::endl; + std::cout << "end: \t" << end << std::endl; + std::cout << "shift_k:\t" << shift_k << std::endl; + std::cout << "reps: \t" << reps << std::endl; + std::cout << std::string(80, '=') << std::endl; + std::cout << "s1: " << s1 << std::endl; + std::cout << "s0: " << s0 << std::endl; + assert(0);*/ + } + const size_t shift_interval = (end - beg) - shift_k; + assert(shift_interval <= 512); + + /* + * Testing the first shift_k bits after begin. Let's say those bits value is not defined, although making them zeo will be preferred. + * + * those bits value is + * for (size_t j = 0; j < shift_k; j++) { + if (beg + j + shift_k >= end) { + break; + } + bool a_bit = bitsMani::is_single_bit_set((const u64 *) &pd, beg + j + shift_k, 8); + bool val_bit = bitsMani::is_single_bit_set((const u64 *) &pd, beg + j, 8); + //The error is not actually an error. this is a cyclic problem. if x == x+ 2. then this will imply x + 2 == x+ 4, which is not necessarily true. In other words, this specific error is in the test, and not in the implementation. + // assert(a_bit == val_bit); + + if (a_bit == val_bit) + continue; + + + size_t s_byte = beg / 8; + size_t offset = beg - s_byte * 8; + print_helper(&pd0, &pd, beg, end, shift_k, beg + j, s_byte, offset, reps); + */ + /* size_t bytes0 = std::min(64u - s_byte, 16); + size_t bytes = ((64 - s_byte) >= 16) ? 16 : (64 - s_byte); + assert(bytes == bytes0); + auto s_after = str_bitsMani::str_array_as_memory_no_delim((const u8 *) &pd + s_byte, bytes); + auto s_backup = str_bitsMani::str_array_as_memory_no_delim((const u8 *) &pd0 + s_byte, bytes); + + auto s_after_del = str_bitsMani::str_array_as_memory((const u8 *) &pd + s_byte, bytes); + auto s_backup_del = str_bitsMani::str_array_as_memory((const u8 *) &pd0 + s_byte, bytes); + + std::cout << "s_byte: \t" << s_byte << std::endl; + std::cout << "first_printed_bit: \t" << s_byte * 8 << std::endl; + std::cout << "offset: \t" << beg - s_byte * 8 << std::endl; + std::cout << "beg: \t" << beg << std::endl; + std::cout << "end: \t" << end << std::endl; + std::cout << "j: \t" << j << std::endl; + std::cout << "shift_k:\t" << shift_k << std::endl; + std::cout << "reps: \t" << reps << std::endl; + std::cout << std::string(80, '=') << std::endl; + std::cout << "s_backup: " << s_backup << std::endl; + std::cout << "s_after: " << s_after << std::endl; + std::cout << "s_backup_del: \n" + << s_backup_del << std::endl; + std::cout << "s_after_del: \n" + << s_after_del << std::endl; + assert(0); */ + /* + + assert(a_bit == val_bit); + }*/ + for (size_t j = 0; j < shift_interval; j++) { + bool a_bit = bitsMani::is_single_bit_set((const u64 *) &pd, beg + j + shift_k, 8); + bool val_bit = bitsMani::is_single_bit_set((const u64 *) &pd0, beg + j, 8); + assert(a_bit == val_bit); + + /* if (a_bit == val_bit) + continue; + + size_t s_byte; + size_t offset; + if (j < 8) { + s_byte = beg / 8; + offset = beg & 7; + } else { + s_byte = (beg + j) / 8; + offset = (beg + j) - (s_byte * 8); + } + print_helper(&pd0, &pd, beg, end, shift_k, beg + j, s_byte, offset, reps);*/ + /* // size_t first_byte_index + auto s0 = str_bitsMani::str_array_as_memory((const u8 *) &pd + beg / 8 * 8, (shift_interval + 23) / 8); + auto s1 = str_bitsMani::str_array_as_memory((const u8 *) &pd0 + beg / 8 * 8, (shift_interval + 23) / 8); + + std::cout << "beg: \t" << beg << std::endl; + std::cout << "end: \t" << end << std::endl; + std::cout << "j: \t" << j << std::endl; + std::cout << std::string(80, '=') << std::endl; + std::cout << "s0: " << s0 << std::endl; + std::cout << "s1: " << s1 << std::endl; + assert(0); */ + } + for (size_t j = end; j < 512; j++) { + bool a_bit = bitsMani::is_single_bit_set((const u64 *) &pd, j, 8); + bool val_bit = bitsMani::is_single_bit_set((const u64 *) &pd0, j, 8); + + assert(a_bit == val_bit); + + /* if (a_bit == val_bit) + continue; + + size_t s_byte = j / 8 * 8; + auto s0 = str_bitsMani::str_array_as_memory((const u8 *) &pd + s_byte, 12); + auto s1 = str_bitsMani::str_array_as_memory((const u8 *) &pd0 + s_byte, 12); + + std::cout << "beg: \t" << beg << std::endl; + std::cout << "end: \t" << end << std::endl; + std::cout << "j: \t" << j << std::endl; + std::cout << std::string(80, '=') << std::endl; + std::cout << "s0: " << s0 << std::endl; + std::cout << "s1: " << s1 << std::endl; + assert(0); */ + } + // std::cout << "reps: " << reps << std::endl; + } + std::cout << "Done with : \t" << shift_k << std::endl; + } + + template + inline void test_shift_by_k_left() { + __m512i pd = {0}; + for (size_t i = 0; i < (512 / 32); i++) { + ((u32 *) &pd)[i] = random(); + } + + const __m512i pd0 = pd; + for (size_t reps = 0; reps < (1ULL << 16); reps++) { + size_t beg = 0; + size_t end = 0; + while (true) { + beg = random() % (512 + 1); + end = random() % (512 + 1); + // bool cond1 = (beg + shift_k <= end); + // bool cond2 = ((end - beg + (beg & 7)) <= 64); + // bool cond2 = (end - beg <= 96); + // bool cond2 = true; + bool cond3 = (beg + shift_k < end); + // bool cond4 = (beg + shift_k < end); + // if (cond1 and cond2 and cond3) { + if (cond3) { + break; + } + } + + /* std::cout << std::string(80, '*') << std::endl; + std::cout << "beg: " << beg << std::endl; + std::cout << "end: " << end << std::endl; + std::cout << std::string(80, '*') << std::endl; */ + pd = pd0; + assert(memcmp(&pd, &pd0, 64) == 0); + // constexpr size_t shift_k = 1; + shift_by_k_left(&pd, beg, end); + for (size_t i = 0; i < beg; i++) { + bool a_bit = bitsMani::is_single_bit_set((const u64 *) &pd, i, 8); + bool val_bit = bitsMani::is_single_bit_set((const u64 *) &pd0, i, 8); + // assert(a_bit == val_bit); + + if (a_bit == val_bit) + continue; + size_t s_byte = i / 8; + size_t bytes0 = std::min(64u - s_byte, 16); + assert(bytes0 <= 16); + auto s0 = str_bitsMani::str_array_as_memory_no_delim((const u8 *) &pd0 + s_byte, bytes0); + auto s1 = str_bitsMani::str_array_as_memory_no_delim((const u8 *) &pd + s_byte, bytes0); + + std::cout << "s_byte: \t" << s_byte << std::endl; + std::cout << "offset: \t" << i - s_byte * 8 << std::endl; + std::cout << "i: \t" << i << std::endl; + std::cout << "beg: \t" << beg << std::endl; + std::cout << "end: \t" << end << std::endl; + std::cout << "shift_k:\t" << shift_k << std::endl; + std::cout << "reps: \t" << reps << std::endl; + std::cout << std::string(80, '=') << std::endl; + std::cout << "s0: " << s0 << std::endl; + std::cout << "s1: " << s1 << std::endl; + assert(0); + } + const size_t shift_interval = (end - beg) - shift_k; + assert(shift_interval <= 512); + for (size_t j = 0; j < shift_interval; j++) { + + // bool a_bit = bitsMani::is_single_bit_set((const u64 *) &pd0, (end - shift_k) - j, 8); + // bool val_bit = bitsMani::is_single_bit_set((const u64 *) &pd, end - j, 8); + bool a_bit = bitsMani::is_single_bit_set((const u64 *) &pd0, beg + shift_k + j, 8); + bool val_bit = bitsMani::is_single_bit_set((const u64 *) &pd, beg + j, 8); + // assert(a_bit == val_bit); + if (a_bit == val_bit) + continue; + + size_t s_byte = (beg + j) / 8; + size_t offset = (beg + j) & 7; + // u64 w0, w2; + // memcpy(&w2, (const u8 *) &pd + s_byte, 8); + // memcpy(&w0, (const u8 *) &pd0 + s_byte, 8); + // auto s = str_bitsMani::format_2words_and_xor(w0, w2); + auto s0 = str_bitsMani::str_array_as_memory((const u8 *) &pd0 + s_byte, 8); + auto s1 = str_bitsMani::str_array_as_memory((const u8 *) &pd + s_byte, 8); + size_t rel_beg = beg - s_byte * 8; + size_t rel_end = end - s_byte * 8; + + std::cout << "beg: \t" << beg << std::endl; + std::cout << "end: \t" << end << std::endl; + std::cout << std::string(80, '~') << std::endl; + std::cout << "rel_beg:\t" << rel_beg << std::endl; + std::cout << "rel_end:\t" << rel_end << std::endl; + std::cout << std::string(80, '~') << std::endl; + std::cout << "offset: \t" << offset << std::endl; + std::cout << "s_byte: \t" << s_byte << std::endl; + std::cout << "j: \t" << j << std::endl; + std::cout << std::string(80, '=') << std::endl; + // std::cout << s << std::endl; + std::cout << "s0: \t\t" << s0;// << std::endl; + std::cout << "s1: \t\t" << s1 << std::endl; + assert(0); + } + for (size_t j = end; j < 512; j++) { + bool a_bit = bitsMani::is_single_bit_set((const u64 *) &pd, j, 8); + bool val_bit = bitsMani::is_single_bit_set((const u64 *) &pd0, j, 8); + + assert(a_bit == val_bit); + } + } + std::cout << "Done with : \t" << shift_k << std::endl; + } + + + template + bool test_insert_push_k_bits_item_ultra_naive(__m512i *pd, size_t start1, size_t end1, u32 value) { + assert(value <= _bzhi_u32(-1, k)); + assert(end1 <= 512); + assert(start1 + k <= end1); + + + const __m512i pd0 = *pd; + + // u8 backup_a[packedSize]; + // memcpy(backup_a, (const u8*)pd, 64); + + const size_t total_bits = (end1 - start1); + assert(!(total_bits % k)); + const size_t items = total_bits / k; + + u32 val_up_arr[items + 1]; + std::fill(val_up_arr, val_up_arr + items + 1, 0); + assert((start1 + items * k) == end1); + Shift_op::unpack_array_gen_k_with_offset(val_up_arr + 1, (const u8 *) &pd0, items, k, start1); + val_up_arr[0] = value; + + // + insert_push_k_bits_item_by_shift(pd, start1, end1, value); + u32 att_up_arr[items + (items == 1)]; + Shift_op::unpack_array_gen_k_with_offset(att_up_arr, (const u8 *) pd, items, k, start1); + + for (size_t i = 0; i < items; i++) { + u32 a_res = att_up_arr[i]; + u32 v_res = val_up_arr[i]; + if (att_up_arr[i] != val_up_arr[i]) { + std::cout << "start1: \t" << start1 << std::endl; + std::cout << "end1: \t" << end1 << std::endl; + std::cout << std::string(80, '~') << std::endl; + std::cout << "i: " << i << std::endl; + std::cout << "a_res: " << a_res << std::endl; + std::cout << "v_res: " << v_res << std::endl; + if (!i) { + std::cout << "value: " << value << std::endl; + } + assert(0); + } + } + + return true; + /* // size_t first_byte = start1 / 8; + // size_t end_lim = (end + 7) / 8 * 8; + // size_t last_byte_p1 = end_lim / 8; + // size_t bytes_range = last_byte_p1 - first_byte; + // const size_t unpack_size = bytes_range; */ + } + + template + void test_insert_push_k_bit() { + // size_t reps = 512; + __m512i pd = {0}; + random_filler(&pd); + // const __m512i pd0 = pd; + for (size_t i = 0; i < 256; i++) { + for (size_t j = 0; j < 256; j++) { + __m512i att_pd = pd; + + size_t beg = 0; + size_t end = 0; + while (true) { + beg = random() % 512; + end = random() % 512 + 1; + bool cond1 = (beg + k <= end); + bool cond2 = ((end - beg) % k) == 0; + if (cond1 and cond2) { + break; + } + } + + u32 value = random() & _bzhi_u32(-1, k); + bool res = test_insert_push_k_bits_item_ultra_naive(&att_pd, beg, end, value); + assert(res); + } + } + } + + +}// namespace Shift_pd::check + +// template +// void my_stable_sort(T* a, size_t size, f_cmp) + +#endif//MULTI_LEVEL_HASH_SHIFT_OP_HPP \ No newline at end of file diff --git a/Prefix-Filter/min_pd256.cpp b/Prefix-Filter/min_pd256.cpp new file mode 100644 index 0000000..0150274 --- /dev/null +++ b/Prefix-Filter/min_pd256.cpp @@ -0,0 +1,41 @@ + +#include "min_pd256.hpp" + +namespace min_pd::check { + bool validate_decoding(const __m256i *pd) { + constexpr size_t t = MAX_CAP0 - 1; + const u64 dirty_h = ((const u64 *) pd)[0]; + size_t status = dirty_h & 31; + size_t last_quot = select64(~(dirty_h >> 6), t) - t; + if(status != last_quot) { + std::cout << "status: \t" << status << std::endl; + std::cout << "last_quot: \t" << last_quot << std::endl; + assert(0); + } + return true; + } + + bool val_header(const __m256i *pd) { + const uint64_t h0 = reinterpret_cast(pd)[0]; + const u64 h = (h0 >> 6) & H_mask; + auto pop0 = _mm_popcnt_u64(h); + assert(pop0 == QUOTS); + return true; + } + + bool val_last_quot_is_sorted(const __m256i *pd){ + if (!did_pd_overflowed(pd)) + return true; + size_t last_quot = get_last_occupied_quot_only_full_pd(pd); + size_t lq_cap = get_spec_quot_cap(last_quot, pd); + assert(lq_cap); + if (lq_cap == 1) + return true; + + auto mp = (u8*)pd + 32 - lq_cap; + for (size_t i = 1; i < lq_cap; ++i) { + assert(mp[i-1] <= mp[i]); + } + return true; + } +}// namespace min_pd::check diff --git a/Prefix-Filter/min_pd256.hpp b/Prefix-Filter/min_pd256.hpp new file mode 100644 index 0000000..806e409 --- /dev/null +++ b/Prefix-Filter/min_pd256.hpp @@ -0,0 +1,549 @@ +#ifndef FILTERS_MIN_PD256_HPP +#define FILTERS_MIN_PD256_HPP + +#include +#include +#include +#include + +#include + +#include +#include + +#include "Shift_op.hpp" + + +namespace min_pd::check { + bool validate_decoding(const __m256i *pd); + + bool val_header(const __m256i *pd); + + /** + * If pd did overflowed checks that the last quotient is sorted. + * @param pd + * @return + */ + bool val_last_quot_is_sorted(const __m256i *pd); +}// namespace min_pd::check + +namespace min_pd { + constexpr size_t QUOTS = 25; + constexpr size_t MAX_CAP0 = 25; + constexpr u64 H_mask = (1ULL << (QUOTS + MAX_CAP0)) - 1; + struct add_res { + u8 quot; + u8 rem; + bool passed; + }; + + bool find_core(int64_t quot, uint8_t rem, const __m256i *pd); + + /** + * Remark: if `x` has `j` set bits, then: select(x,j) == 64. + * @param x + * @param j + * @return The position (starting from 0) of the jth set bit of x. + */ + inline uint64_t select64(uint64_t x, int64_t j) { + assert(j < 64); + const uint64_t y = _pdep_u64(UINT64_C(1) << j, x); + return _tzcnt_u64(y); + } + + inline unsigned get_status(const __m256i *pd) { + u8 temp; + memcpy(&temp, pd, 1); + return temp & 31; + } + + inline unsigned get_h_first_byte(const __m256i *pd) { + u8 temp; + memcpy(&temp, pd, 1); + return temp; + } + + inline uint8_t get_last_byte(const __m256i *pd) { + uint8_t x; + memcpy(&x, ((uint8_t *) pd) + 31, 1); + return x; + } + + inline uint64_t get_header(const __m256i *pd) { + return ((uint64_t *) pd)[0] & ((1ULL << 56) - 1); + } + + inline uint64_t get_clean_header(const __m256i *pd) { + // uint64_t res = (_mm_cvtsi128_si64(_mm256_castsi256_si128(*pd)) >> 6) & ((1ULL << 50) - 1); + return ((((uint64_t *) pd)[0]) >> 6ul) & ((1ULL << 50ul) - 1); + } + + inline bool did_pd_overflowed(const __m256i *pd) { + return !(((uint64_t *) pd)[0] & 32); + } + + inline void set_overflow_bit(__m256i *pd) { + uint64_t *h_array = ((uint64_t *) pd); + h_array[0] |= 32; + h_array[0] ^= 32; + assert(did_pd_overflowed(pd)); + } + + inline void clear_overflow_bit(__m256i *pd) { + uint64_t *h_array = ((uint64_t *) pd); + h_array[0] |= 32; + // h_array[0] ^= 32; + assert(!did_pd_overflowed(pd)); + } + + inline uint64_t decode_last_quot(const __m256i *pd) { + return ((uint64_t *) pd)[0] & 31; + } + + inline size_t get_cap_naive(const __m256i *pd) { + // constexpr u64 mask = (1ULL << (QUOTS + MAX_CAP0)) - 1; + constexpr size_t t = QUOTS - 1; + const uint64_t header = reinterpret_cast(pd)[0]; + u64 h0 = (header >> 6);// & H_mask; + size_t res = select64(h0, t) - t; + return res; + // auto pop0 = _mm_popcnt_u64(h0); + // assert(pop0 == QUOTS); + // size_t zeros = 64 - pop0; + // size_t cap = zeros - 14; + // return cap; + } + + inline size_t get_capacity(const __m256i *pd) { + const uint64_t header = reinterpret_cast(pd)[0]; + auto temp = _lzcnt_u64(header << 8); + uint64_t res = MAX_CAP0 - temp; + assert(res == get_cap_naive(pd)); + return res; + } + + inline size_t get_cap(const __m256i *pd) { + const uint64_t header = reinterpret_cast(pd)[0]; + auto temp = _lzcnt_u64(header << 8); + uint64_t res = MAX_CAP0 - temp; + assert(res == get_cap_naive(pd)); + return res; + } + + inline bool is_pd_full(const __m256i *pd) { + const uint64_t header = reinterpret_cast(pd)[0]; + bool res = header & (1ULL << 55); + assert(res == (get_cap(pd) == MAX_CAP0)); + return res; + } + + inline bool pd_full(const __m256i *pd) { + return is_pd_full(pd); + } + + inline bool is_header_full(const __m256i *pd) { + u8 temp; + memcpy(&temp, (const u8 *) pd + 6, 1); + return temp & 128; + } + + inline unsigned header_last_two_bits(const __m256i *pd) { + const uint64_t header = reinterpret_cast(pd)[0]; + unsigned res = (header >> 54) & 3; + return res; + } + + inline __m256i shift_right(__m256i a) { + constexpr __m256i idx = {0x605040302010000, 0xe0d0c0b0a090807, 0x161514131211100f, 0x1e1d1c1b1a191817}; + constexpr uint64_t mask = 18446744073709551614ULL; + __m256i res = _mm256_permutexvar_epi8(idx, a); + return res; + } + + + inline size_t get_spec_quot_cap(size_t quot, const __m256i *pd) { + assert(quot < QUOTS); + const u64 clean_h = get_clean_header(pd); + if (quot == 0) { + return _tzcnt_u64(clean_h); + } + const u64 p_mask = 3 << (quot - 1); + u64 pdep_res = _pdep_u64(p_mask, clean_h); + assert(__builtin_popcountll(pdep_res) == 2); + size_t begin = _tzcnt_u64(pdep_res) + 1; + size_t end = _tzcnt_u64(_blsr_u64(pdep_res)); + size_t res = end - begin; + return res; + } + + inline void body_add_case0_avx(size_t body_index, uint8_t rem, __m256i *pd) { + constexpr unsigned kBytes2copy = 7; + const __m256i shifted_pd = shift_right(*pd); + ((uint8_t *) pd)[kBytes2copy + body_index] = rem; + const uint64_t mask = _bzhi_u64(-1, kBytes2copy + body_index + 1); + _mm256_store_si256(pd, _mm256_mask_blend_epi8(mask, shifted_pd, *pd)); + } + inline void body_add_simple(size_t body_index, uint8_t rem, __m256i *pd) { + // const size_t body_index = end - quot; + auto mp = (u8 *) pd + 7 + body_index; + const size_t b2m = (32 - 7) - (body_index + 1); + memmove(mp + 1, mp, b2m); + mp[0] = rem; + } + + inline bool body_add(size_t body_index, u8 rem, __m256i *pd) { + __m256i pd0 = *pd; + __m256i pd1 = *pd; + body_add_case0_avx(body_index, rem, &pd0); + body_add_simple(body_index, rem, &pd1); + bool res = memcmp(&pd0, &pd1, 32) == 0; + if (res) + return true; + + std::cout << "h0:\t" << str_bitsMani::format_word_to_string(((u64 *) &pd0)[0]) << std::endl; + std::cout << "h1:\t" << str_bitsMani::format_word_to_string(((u64 *) &pd1)[0]) << std::endl; + // std::cout << "h1:\t" << str_bitsMani::format_word_to_string(((u64 *) &pd1)[0]) << std::endl; + // std::cout << "h1:\t" << str_bitsMani::format_word_to_string(((u64 *) &pd1)[0]) << std::endl; + assert(0); + return false; + } + + inline void add_case0(int64_t quot, u8 rem, __m256i *pd) { + // static int A[4] = {0}; + // A[0]++; + assert(!is_pd_full(pd)); + const uint64_t dirty_h0 = reinterpret_cast(pd)[0]; + size_t end = select64(dirty_h0 >> 6, quot); + // constexpr u64 h_mask = ((1ULL << 56) - 1); + + assert(check::val_header(pd)); + + const size_t h_index = end + 6; + const u64 mask = _bzhi_u64(-1, h_index); + const u64 lo = dirty_h0 & mask; + const u64 hi = ((dirty_h0 & ~mask) << 1u);// & h_mask; + assert(!(lo & hi)); + const u64 h7 = lo | hi; + memcpy(pd, &h7, 7); + + assert(check::val_header(pd)); + + const size_t body_index = end - quot; + auto mp = (u8 *) pd + 7 + body_index; + const size_t b2m = (32 - 7) - (body_index + 1); + memmove(mp + 1, mp, b2m); + mp[0] = rem; + assert(find_core(quot, rem, pd)); + } + + inline size_t get_last_occupied_quot_only_full_pd(const __m256i *pd) { + assert(is_pd_full(pd)); + const u64 clean_h = get_clean_header(pd); + const size_t last_quot = select64(~clean_h, MAX_CAP0 - 1) - (MAX_CAP0 - 1); + assert(last_quot < QUOTS); +#ifndef NDEBUG + for (size_t i = last_quot + 1; i < QUOTS; i++) { + assert(!get_spec_quot_cap(i, pd)); + } +#endif//!NDEBUG + return last_quot; + } + + + inline void sort_k_last_rem(size_t k, __m256i *pd) { + // taken from https://stackoverflow.com/questions/2786899/fastest-sort-of-fixed-length-6-int-array/2789530#2789530 + int i, j; + u8 *d = (u8 *) pd + 32 - k; + for (i = 1; i < k; i++) { + u8 tmp = d[i]; + for (j = i; j >= 1 && tmp < d[j - 1]; j--) + d[j] = d[j - 1]; + d[j] = tmp; + } + } + + /** + * @brief Sorts the remainders in the last run in non-decsending order, and returns the value of the last quot. + * + * @param pd + * @return size_t + */ + inline size_t sort_last_quot(__m256i *pd) { + assert(is_pd_full(pd)); + const u64 clean_h = get_clean_header(pd); + const size_t last_quot = select64(~clean_h, MAX_CAP0 - 1) - (MAX_CAP0 - 1); + assert(get_last_occupied_quot_only_full_pd(pd) == last_quot); + size_t last_zero_index = last_quot + (MAX_CAP0 - 1); + u64 shifted_h = clean_h << (63 - last_zero_index); + assert(!_bextr_u64(shifted_h, 63, 1)); + const size_t lq_cap = _lzcnt_u64(shifted_h); + assert(lq_cap == get_spec_quot_cap(last_quot, pd)); + sort_k_last_rem(lq_cap, pd); + return last_quot; + } + + + inline size_t get_last_occ_quot_cap(const __m256i *pd) { + assert(is_pd_full(pd)); + const u64 dirty_h = reinterpret_cast(pd)[0] >> 6; + const size_t last_quot = select64(~dirty_h, MAX_CAP0 - 1) - (MAX_CAP0 - 1); + assert(get_last_occupied_quot_only_full_pd(pd) == last_quot); + size_t last_zero_index = last_quot + (MAX_CAP0 - 1); + u64 shifted_h = dirty_h << (63 - last_zero_index); + assert(!_bextr_u64(shifted_h, 63, 1)); + size_t lq_cap = _lzcnt_u64(shifted_h); + assert(lq_cap == get_spec_quot_cap(last_quot, pd)); + return lq_cap; + } + + + inline void update_status_old(int64_t last_quot, __m256i *pd) { + //check this + uint8_t byte_to_write = last_quot | (get_header(pd) & (32 + 64 + 128)); + memcpy(pd, &byte_to_write, 1); + assert(decode_last_quot(pd) == last_quot); + } + + inline void update_status(size_t last_occ_quot, __m256i *pd) { + assert(last_occ_quot < 32); + auto pd64 = reinterpret_cast(pd); + pd64[0] = ((pd64[0] | 31) ^ 31) | last_occ_quot; + } + + + inline void pd_add_50_only_rem(uint8_t rem, size_t quot_capacity, __m256i *pd) { + //FIXME use cmp_leq_as mask for shift avx. + constexpr unsigned kBytes2copy = 7; + + // const __m256i target = _mm256_set1_epi8(rem); + const uint64_t begin_fingerprint = MAX_CAP0 - quot_capacity; + const uint64_t end_fingerprint = MAX_CAP0; + assert(begin_fingerprint < end_fingerprint); + assert(end_fingerprint <= MAX_CAP0); + + uint64_t i = begin_fingerprint; + auto cp0 = (const u8 *) pd + 7; + for (; i < end_fingerprint; ++i) { + if (rem <= cp0[i]) break; + } + assert((i == end_fingerprint) || + (rem <= ((const uint8_t *) pd)[kBytes2copy + i])); + + u8 *mp = (u8 *) pd + 7 + i; + size_t b2m = (32 - 7) - (i + 1); + assert(b2m < 32); + memmove(mp + 1, mp, b2m); + mp[0] = rem; + } + + + inline void add_full_pd(bool did_pd_previously_overflowed, size_t last_occ_quot, int64_t quot, u8 rem, __m256i *pd) { + assert(is_pd_full(pd)); + assert(last_occ_quot < QUOTS); + assert(get_spec_quot_cap(last_occ_quot, pd)); +#ifndef NDEBUG + size_t v_lq_cap = get_spec_quot_cap(last_occ_quot, pd); +#endif//!NDEBUG + const uint64_t dirty_h0 = reinterpret_cast(pd)[0]; + const size_t set_last_zero_index = (MAX_CAP0 + last_occ_quot + 6);// -1? + const u64 set_last_zero = 1ULL << set_last_zero_index; + const bool change_last_quot = (!did_pd_previously_overflowed) | (dirty_h0 & (set_last_zero >> 2)); +#ifndef NDEBUG + if (did_pd_previously_overflowed) + assert(change_last_quot == (get_spec_quot_cap(last_occ_quot, pd) == 1)); +#endif//!NDEBUG + const size_t end = select64(dirty_h0 >> 6, quot); + constexpr u64 h_mask = ((1ULL << 56) - 1); + + assert(check::val_header(pd)); + + const size_t h_index = end + 6; + const u64 mask = _bzhi_u64(-1, h_index); + const u64 lo = dirty_h0 & mask; + const u64 pre_hi = ((dirty_h0 & ~mask) << 1u); // | set_last_zero;// & h_mask; + const u64 hi = ((dirty_h0 & ~mask) << 1u) | set_last_zero;// & h_mask; +#ifndef NDEBUG + size_t cap = get_cap(pd); + // if (cap == MAX_CAP0) { + // std::cout << "h0: \t" << str_bitsMani::format_word_to_string(((u64 *) pd)[0], 56) << std::endl; + // std::cout << "pre_hi: \t" << str_bitsMani::format_word_to_string(pre_hi, 56) << std::endl; + // std::cout << "hi: \t" << str_bitsMani::format_word_to_string(hi, 56) << std::endl; + // std::cout << std::string(80, '-') << std::endl; + // } + auto a64 = &pre_hi; + size_t a_size = 1; + bool must_be0 = !bitsMani::is_single_bit_set(a64, set_last_zero_index, a_size); + size_t i = set_last_zero_index + 1; + for (; i < 56; ++i) { + if (!bitsMani::is_single_bit_set(a64, i, a_size)) { + std::cout << "i: \t" << i << std::endl; + break; + } + } + bool should_assert = (!must_be0) or (i < 56); + if (should_assert) { + std::string S[4]; + S[0] = str_bitsMani::format_word_to_string(((u64 *) pd)[0]); + S[1] = str_bitsMani::format_word_to_string(pre_hi); + + std::cout << "prev: \t" << S[0] << std::endl; + std::cout << "post: \t" << S[1] << std::endl; + assert(0); + } +#endif//!NDEBUG + + assert(!(lo & hi)); + const u64 h7 = lo | hi; + memcpy(pd, &h7, 7); + + assert(check::val_header(pd)); + + const size_t body_index = end - quot; + body_add_case0_avx(body_index, rem, pd); + // auto mp = (u8 *) pd + 7 + body_index; + // const size_t b2m = (32 - 7) - (body_index + 1); + // memmove(mp + 1, mp, b2m); + // mp[0] = rem; + + if (!change_last_quot) + return; + + size_t new_last_occ_quot = sort_last_quot(pd); + update_status(new_last_occ_quot, pd); + } + + + inline add_res new_pd_swap_short(int64_t quot, uint8_t rem, __m256i *pd) { + uint64_t last_quot = decode_last_quot(pd); + const bool did_ovf = did_pd_overflowed(pd); + if (!did_ovf) { + last_quot = sort_last_quot(pd); + auto pd64 = reinterpret_cast(pd); + pd64[0] ^= (last_quot | 32); + } + + if (last_quot < quot) { + assert(check::val_last_quot_is_sorted(pd)); + return {(u8) quot, rem, false}; + } else if (last_quot == quot) { + const uint8_t old_rem = get_last_byte(pd); + if (old_rem < rem) {//todo can be <= instead of <. + return {(u8) quot, rem, false}; + } + + size_t quot_capacity = get_spec_quot_cap(quot, pd); + assert(get_spec_quot_cap(quot, pd)); + pd_add_50_only_rem(rem, quot_capacity, pd); + assert(find_core(quot, rem, pd)); + + return {(u8) last_quot, old_rem, false}; + } else { + const u8 old_rem = get_last_byte(pd); + add_full_pd(did_ovf, last_quot, quot, rem, pd); + + assert(find_core(quot, rem, pd)); + return {(u8) last_quot, old_rem, false}; + } + } + + + inline add_res add_full_wrap(int64_t quot, u8 rem, __m256i *pd) { + auto res = new_pd_swap_short(quot, rem, pd); + assert(check::val_last_quot_is_sorted(pd)); + return res; + } + + inline add_res Add_Wrap(int64_t quot, u8 rem, __m256i *pd) { + constexpr u64 full_mask = (1ULL << 55); + const uint64_t header = reinterpret_cast(pd)[0]; + + if (!(header & full_mask)) { + assert(!is_pd_full(pd)); + size_t end = select64(header >> 6, quot); + assert(check::val_header(pd)); + const size_t h_index = end + 6; + const u64 mask = _bzhi_u64(-1, h_index); + const u64 lo = header & mask; + const u64 hi = ((header & ~mask) << 1u);// & h_mask; + assert(!(lo & hi)); + const u64 h7 = lo | hi; + memcpy(pd, &h7, 7); + + assert(check::val_header(pd)); + + const size_t body_index = end - quot; + assert(body_add(body_index, rem, pd)); + auto mp = (u8 *) pd + 7 + body_index; + const size_t b2m = (32 - 7) - (body_index + 1); + memmove(mp + 1, mp, b2m); + mp[0] = rem; + + assert(find_core(quot, rem, pd)); + constexpr add_res passed = {0, 0, true}; + return passed; + } else { + // std::cout << "I1=" << A[2]++;// << std::endl; + auto res = new_pd_swap_short(quot, rem, pd); + assert(check::val_last_quot_is_sorted(pd)); +#ifndef NDEBUG + auto status = decode_last_quot(pd); + if (status == 0) { + std::cout << "Here!: \t" << std::endl; + } +#endif//!NDEBUG + return res; + } + } + + + inline bool find_core(int64_t quot, uint8_t rem, const __m256i *pd) { + assert(0 == (reinterpret_cast(pd) % 32)); + assert(quot < QUOTS); + + const __m256i target = _mm256_set1_epi8(rem); + const uint64_t v = _mm256_cmpeq_epu8_mask(target, *pd) >> 7ul; + if (!v) return false; + + const uint64_t v_off = _blsr_u64(v); + const uint64_t h0 = get_clean_header(pd); + + if (v_off == 0) { + const uint64_t mask = v << quot; + return (_mm_popcnt_u64(h0 & (mask - 1)) == quot) && (!(h0 & mask)); + } + + if (quot == 0) + return v & (_blsmsk_u64(h0) >> 1ul); + + uint64_t new_v = (v << quot) & ~h0; + const uint64_t mask = (~_bzhi_u64(-1, quot - 1)); + const uint64_t h_cleared_quot_set_bits = _pdep_u64(mask, h0); + const uint64_t h_cleared_quot_plus_one_set_bits = _blsr_u64(h_cleared_quot_set_bits); + const uint64_t v_mask = _blsmsk_u64(h_cleared_quot_set_bits) ^ _blsmsk_u64(h_cleared_quot_plus_one_set_bits); + // bool att = v_mask & new_v; + return v_mask & new_v; + } + + + /** + * @brief indicate if we should solely look for the element in the next level. + * + * @param qr + * @param pd + * @return true Look only in the second level. + * @return false Look only in this PD. + */ + inline bool cmp_qr1(uint16_t qr, const __m256i *pd) { + if (((uint64_t *) pd)[0] & 32) { + assert(!did_pd_overflowed(pd)); + return false; + } + const uint64_t hfb = ((uint64_t *) pd)[0] & 31; + const uint16_t old_qr = (hfb << 8ul) | get_last_byte(pd); + return old_qr < qr; + } + +}// namespace min_pd + + +#endif// FILTERS_PD256_PLUS_HPP diff --git a/README.md b/README.md new file mode 100644 index 0000000..0318ffe --- /dev/null +++ b/README.md @@ -0,0 +1,108 @@ +# The Prefix Filter + +Implementation of **Prefix-Filter**, which is an incremental filter (approximate set-membership queries). +If you plan on using the Prefix-Filter, please cite our paper: +**Prefix Filter: Practically and Theoretically Better Than Bloom.** Tomer Even, Guy Even, Adam Morrison. +To appear in PVLDB, 15(7). +## Prerequisites + +- **Compiler:** A C++17 compiler such as GNU G++ or LLVM Clang++. +- CMake (Version 3.10 or more). +- **System:** Linux. +- **Hardware:** Intel. Support of AVX2 is a must. AVX512 is need to run the code "as is". (Although the Prefix-Filter does not use it directly.). + +###### Python Packages To Produce The Graphs + +- matplotlib +- brokenaxes (From [here](https://github.com/bendichter/brokenaxes)). +- pandas + + + + +There are three main targets for three different benchmarks. + +1) `measure_perf` for benchmarking performance of insertions and lookups under various loads. +2) `measure_build` for build-time. +3) `measure_fpp` for evaluating the false positive probability, and the "effective space consumption". + +There is also an example of how to use the Prefix-Filter in the file `example.cpp`: +```cpp +#include "Tests/wrappers.hpp" + +int main(){ + using spare = TC_shortcut; // Any incremental filter can replace TC_shortcut. + using prefixFilter = Prefix_Filter; + + size_t filter_max_capacity = 1'000'000; // Choose any size. + prefixFilter example_filter = FilterAPI::ConstructFromAddCount(filter_max_capacity); + + uint64_t x1 = 0x0123'4567'89ab'cdef; + FilterAPI::Add(x1, &example_filter); // Insertions of an item x1. Insertion can be performed only one step at a time. + + bool res = FilterAPI::Contain(x1, &example_filter); // Lookup of x1. + assert(res); //No false negative. + + uint64_t y1 = ~0x0123'4567'89ab'cdef; + bool res2 = FilterAPI::Contain(y1, &example_filter); // Lookup of y1. + std::cout << res2 << std::endl; // Possible false positive. (Although with one item in the filter, this is highly unlikely.) + return 0; +} +``` + +### To build + +``` +git clone -b master https://github.com/TheHolyJoker/Prefix-Filter.git +cd Prefix-Filter +mkdir build +cd build +cmake .. -DCMAKE_C_COMPILER=gcc-10 -DCMAKE_CXX_COMPILER=g++-10 +t="measure_perf measure_built measure_fpp"; time cmake --build ./ --target $t -j 20 +``` +**On GCC release:** Older releases like 9.3 will work. We recommend using newer releases, which seems to perform better. +### To Run + +To run all benchmarks (from `Prefix-Filter/build` directory): +``` +cp ../RunAll.sh RunAll.sh +./RunAll.sh +``` + + +###### Specific Target + +Any specific target (for example `measure_perf`) can be built and executed with as follows: +``` +t="measure_perf"; time cmake --build ./ --target $t -j 20 && time taskset -c 2 ./$t +``` + + + +# Credits + +- **Xor Filter**: +["Xor Filters: Faster and Smaller Than Bloom and Cuckoo +Filters."](https://arxiv.org/pdf/1912.08258.pdf) +Graf, Thomas Mueller, and Daniel Lemire. \ +[Repository](https://github.com/FastFilter/fastfilter_cpp).\ +We build upon Xor filter's benchmarks. +We also used Its BBF variant, its fast Bloom filter, and its [fast modulo alternative](https://lemire.me/blog/2016/06/27/a-fast-alternative-to-the-modulo-reduction/). + +- **Cuckoo Filter** \ +["Cuckoo Filter: Practically Better Than Bloom." ](https://www.cs.cmu.edu/~dga/papers/cuckoo-conext2014.pdf) Fan B, Andersen DG, Kaminsky M, Mitzenmacher MD. +[Repository](https://github.com/efficient/cuckoofilter) +- **Blocked Bloom Filter**\ +We used two variants taken from the Xor filter's repository. + + +- **Vector Quotient Filter**\ +["Vector Quotient Filters: Overcoming The Time/Space Trade-Off In Filter Design."](https://research.vmware.com/files/attachments/0/0/0/0/1/4/7/sigmod21.pdf). Pandey P, Conway A, Durie J, Bender MA, Farach-Colton M, Johnson R. Vector quotient filters: Overcoming the time/space trade-off in filter design.\ +[Repository](https://github.com/splatlab/vqf).\ +However, we used our own implementation, called *twoChoicer* (In file `TC-Shortcut/TC-shortcut.hpp`). diff --git a/RunAll.sh b/RunAll.sh new file mode 100755 index 0000000..b7fd2ee --- /dev/null +++ b/RunAll.sh @@ -0,0 +1,33 @@ + +mkdir -p ../scripts/Inputs +t="measure_perf"; +s="measure_built"; +time cmake --build ./ --target $t -j 50 +if ! [ $? -eq 0 ]; then + exit 1; +fi +time cmake --build ./ --target $s -j 50 +if ! [ $? -eq 0 ]; then + exit 2; +fi + +if ! [ -z "$(ls -A ../scripts/Inputs)" ]; then + echo "Inputs is not empty!" + exit 3; +fi + +time taskset -c 2 ./$t +if ! [ $? -eq 0 ]; then + echo "The benchmark was not completed!" + exit; +fi +#sleep 120 +time taskset -c 2 ./$s +if ! [ $? -eq 0 ]; then + echo "The Built-bench was not completed!" + exit; +fi +files_path="../scripts/Inputs/" +../scripts/arg-plotter.py $files_path +../scripts/build-csv-parser.py +time cmake --build ./ --target measure_fpp -j 50 && time taskset -c 2 ./measure_fpp \ No newline at end of file diff --git a/TC-Shortcut/TC-shortcut.hpp b/TC-Shortcut/TC-shortcut.hpp new file mode 100644 index 0000000..cc7db6b --- /dev/null +++ b/TC-Shortcut/TC-shortcut.hpp @@ -0,0 +1,309 @@ + +#ifndef TC_SHORTCUT_HPP +#define TC_SHORTCUT_HPP + + +#include "../hashutil.h" +#include "./tc-sym.hpp" + + +class TC_shortcut { + hashing::TwoIndependentMultiplyShift h0; + size_t capacity{0}; + const size_t filter_max_capacity; + // const size_t remainder_length = 8; + const size_t quotient_range = tc_sym::QUOTS; + // const uint16_t qr_range = 12800UL; + // const size_t quotient_length = 6; + const size_t single_pd_capacity = tc_sym::MAX_CAP; + + const size_t number_of_pd; + const double load; + __m512i *pd_array; + + size_t insert_existing_counter = 0; + size_t add_op_counter = 0; + +public: + static inline auto TC_compute_number_of_PD(size_t max_number_of_elements, size_t single_pd_max_cap, double l1_load) -> size_t { + double b = single_pd_max_cap * l1_load; + size_t res = (std::size_t) ceil(max_number_of_elements / ((double) b)); + return (res & 1) ? res + 1 : res; + } + TC_shortcut(size_t max_number_of_elements, double level1_load_factor) + : filter_max_capacity(max_number_of_elements), + number_of_pd(TC_compute_number_of_PD(max_number_of_elements, single_pd_capacity, level1_load_factor)), + load(level1_load_factor), h0() + // pd_index_length(ceil_log2(compute_number_of_PD(max_number_of_elements, max_capacity, level1_load_factor, 1))) + { + // hashing_test = false; + assert(quotient_range + single_pd_capacity * 9 <= 512); + assert(!(number_of_pd & 1)); + assert(single_pd_capacity == tc_sym::MAX_CAP); + int ok = posix_memalign((void **) &pd_array, 64, 64 * number_of_pd); + + if (ok != 0) { + std::cout << "Failed!!!" << std::endl; + assert(false); + return; + } + + + // std::fill(pd_array, pd_array + number_of_pd, __m512i{(INT64_C(1) << 50) - 1, 0, 0, 0, 0, 0, 0, 0}); + static_assert(UINT64_C(-1) == 0xffff'ffff'ffff'ffff); + // __m512i init_pd = {0xffff'ffff'ffff'ffff, 0x00000000'0000ffff, 0, 0, 0, 0, 0, 0}; + ; + std::fill(pd_array, pd_array + number_of_pd, __m512i{-1, 0x00000000'0000ffff, 0, 0, 0, 0, 0, 0}); + } + + virtual ~TC_shortcut() { + free(pd_array); + // pd_capacity_vec.clear(); + } + + __attribute__((always_inline)) inline static uint32_t reduce32(uint32_t hash, uint32_t n) { + // http://lemire.me/blog/2016/06/27/a-fast-alternative-to-the-modulo-reduction/ + return (uint32_t) (((uint64_t) hash * n) >> 32); + } + + static inline uint32_t reduce(uint64_t hash, uint32_t n) { + // http://lemire.me/blog/2016/06/27/a-fast-alternative-to-the-modulo-reduction/ + return (uint32_t) (((hash & 0xffffffffL) * n) >> 32); + } + + + __attribute__((always_inline)) inline static uint16_t fixed_reduce(u32 hash) { + // http://lemire.me/blog/2016/06/27/a-fast-alternative-to-the-modulo-reduction/ + constexpr u32 mod = tc_sym::QUOTS << 8; + // static_assert(mod == 12800UL); + return (uint16_t) (((uint32_t) hash * mod) >> 16); + } + + + bool v_alt_cfs(uint32_t bin_index, uint32_t rem) const { + uint32_t alt_bin_index = get_alt_index_cf_stable(bin_index, rem); + uint32_t alt_alt_bin_index = get_alt_index_cf_stable(alt_bin_index, rem); + bool res = (bin_index == alt_alt_bin_index); + if (!res) { + // auto offset = Morton_offset(rem); + int diff1 = bin_index - alt_bin_index; + int diff2 = alt_alt_bin_index - alt_bin_index; + std::cout << std::string(80, '=') << std::endl; + std::cout << "number_of_pd: \t" << number_of_pd << std::endl; + std::cout << std::string(80, '~') << std::endl; + // std::cout << "offset: \t" << offset << std::endl; + std::cout << "bin_index: \t" << bin_index << std::endl; + std::cout << "alt_bin_index: \t" << alt_bin_index << std::endl; + std::cout << "alt_alt_bin_index: \t" << alt_alt_bin_index << std::endl; + std::cout << std::string(80, '~') << std::endl; + std::cout << "diff1: \t" << diff1 << "\t|\t" << (number_of_pd - diff1) << std::endl; + std::cout << "diff2: \t" << diff2 << "\t|\t" << (number_of_pd - diff2) << std::endl; + std::cout << std::string(80, '=') << std::endl; + + // auto offset1 = Morton_offset(rem); + } + assert(res); + return res; + } + + inline uint32_t get_alt_index_simp(uint32_t bin_index, uint32_t qr) const { + return (bin_index + qr) % number_of_pd; + } + // inline uint32_t get_alt_index_cf_stable(uint32_t bin_index, uint32_t rem) const { + inline uint32_t get_alt_index_cf_stable(uint32_t bin_index, uint32_t qr) const { + //Taken from https://github.com/FastFilter/fastfilter_cpp/blob/master/src/cuckoo/cuckoofilter_stable.h + // (The variables names where changed). + uint64_t hash = qr * 0xc4ceb9fe1a85ec53L; + // we don't use xor; instead, we ensure bucketCount is even, + // and bucket2 = bucketCount - bucket - y, + // and if negative add the bucketCount, + // where y is 1..bucketCount - 1 and odd - + // that way, bucket2 is never the original bucket, + // and running this twice will give the original bucket, as needed + uint32_t r = (reduce(hash, number_of_pd >> 1) << 1) + 1; + + // this is needed because the bucket size is not always 2^n: + int32_t b2 = number_of_pd - bin_index - r; + if (b2 < 0) { + b2 += number_of_pd; + } + // I tried the following alternatives (also combinations), + // but performance is the same: + + // uint32_t b2 = bucketCount - index - r; + // b2 += bucketCount * (b2 >> 31); + + // int32_t b2 = bucketCount - index - r; + // b2 += bucketCount & (b2 >> 31); + + // int32_t b2 = r - index; + // b2 += bucketCount & (b2 >> 31); + + return b2; + } + + inline auto lookup(const uint64_t &item) const -> bool { + const u64 s = h0(item); + uint32_t out1 = s >> 32u, out2 = s; + const uint32_t pd_index1 = reduce32(out1, (uint32_t) number_of_pd); + const uint16_t qr = fixed_reduce((uint16_t) out2); + const int64_t quot = qr >> 8; + const uint8_t rem = qr; + + assert(pd_index1 < number_of_pd); + assert(quot <= tc_sym::QUOTS); + // assert(validate_get_alt_index_non_2power(pd_index1, rem)); + assert(v_alt_cfs(pd_index1, qr)); + assert(v_alt_cfs(pd_index1, rem)); + + + return (tc_sym::find(quot, rem, pd_array + pd_index1)) || (tc_sym::find(quot, rem, pd_array + get_alt_index_cf_stable(pd_index1, qr))); + // return (tc_sym::find(quot, rem, pd_array + pd_index1)) || (tc_sym::find(quot, rem, pd_array + get_alt_index_simp(pd_index1, qr))); + // (tc_sym::find(quot, rem, pd_array + get_alt_index_non_2power(pd_index1, rem))); + } + + bool insert_no_shortcut(const uint64_t &item) { + // add_op_counter++; + const u64 s = h0(item); + uint32_t out1 = s >> 32u, out2 = s; + const uint32_t pd_index1 = reduce32(out1, (uint32_t) number_of_pd); + const uint16_t qr = fixed_reduce((uint16_t) out2); + const int64_t quot = qr >> 8; + const uint8_t rem = qr; + assert(pd_index1 < number_of_pd); + assert(quot <= quotient_range); + assert(rem <= 255); + // assert(validate_get_alt_index_non_2power(pd_index1, rem)); + assert(v_alt_cfs(pd_index1, rem)); + assert(v_alt_cfs(pd_index1, qr)); + + // const uint32_t pd_index2 = get_alt_index_non_2power(pd_index1, rem); + const uint32_t pd_index2 = get_alt_index_cf_stable(pd_index1, qr); + assert(pd_index2 < number_of_pd); + + auto cap1 = tc_sym::get_cap(pd_array + pd_index1); + auto cap2 = tc_sym::get_cap(pd_array + pd_index2); + if (cap1 < cap2) { + auto res = tc_sym::add(quot, rem, &pd_array[pd_index1]); + assert((!res) or lookup(item)); + return res; + + } else { + if (cap2 == tc_sym::MAX_CAP) { + return false; + } + auto res = tc_sym::add(quot, rem, &pd_array[pd_index2]); + assert((!res) or lookup(item)); + return res; + } + } + + bool insert(const uint64_t &item) { + const u64 s = h0(item); + uint32_t out1 = s >> 32u, out2 = s; + const uint32_t pd_index1 = reduce32(out1, (uint32_t) number_of_pd); + const uint16_t qr = fixed_reduce((uint16_t) out2); + const int64_t quot = qr >> 8; + const uint8_t rem = qr; + assert(pd_index1 < number_of_pd); + assert(quot <= quotient_range); + assert(rem <= 255); + // assert(validate_get_alt_index_non_2power(pd_index1, rem)); + assert(v_alt_cfs(pd_index1, rem)); + assert(v_alt_cfs(pd_index1, qr)); + + if (tc_sym::pd_less_than_thres(pd_array + pd_index1)) { +#ifndef NDEBUG + auto res = tc_sym::add(quot, rem, &pd_array[pd_index1]); + assert((!res) or lookup(item)); + return res; +#endif//!NDEBUG + return tc_sym::add(quot, rem, &pd_array[pd_index1]); + } + const uint32_t pd_index2 = get_alt_index_cf_stable(pd_index1, qr); + // const uint32_t pd_index2 = get_alt_index_simp(pd_index1, qr); + assert(pd_index2 < number_of_pd); + + const uint64_t *word1 = ((const uint64_t *) (pd_array + pd_index1)) + 1; + const uint64_t *word2 = ((const uint64_t *) (pd_array + pd_index2)) + 1; + + if (word1[0] < word2[0]) { + assert(tc_sym::get_cap(pd_array + pd_index1) <= tc_sym::get_cap(pd_array + pd_index2)); + if (word1[0] >> 63) { + assert(tc_sym::pd_full(pd_array + pd_index1)); + return false; + } + auto res = tc_sym::add(quot, rem, &pd_array[pd_index1]); + assert((!res) or lookup(item)); + return res; + } else { + assert(tc_sym::get_cap(pd_array + pd_index1) >= tc_sym::get_cap(pd_array + pd_index2)); + if (word2[0] >> 63) { + assert(tc_sym::pd_full(pd_array + pd_index2)); + return false; + } + auto res = tc_sym::add(quot, rem, &pd_array[pd_index2]); + assert((!res) or lookup(item)); + return res; + } + } + + void remove(const uint64_t &item) { + // add_op_counter++; + const u64 s = h0(item); + assert(lookup(item)); + uint32_t out1 = s >> 32u, out2 = s; + const uint32_t pd_index1 = reduce32(out1, (uint32_t) number_of_pd); + const uint16_t qr = fixed_reduce((uint16_t) out2); + const int64_t quot = qr >> 8; + const uint8_t rem = qr; + // assert(validate_get_alt_index_non_2power(pd_index1, rem)); + assert(v_alt_cfs(pd_index1, rem)); + assert(v_alt_cfs(pd_index1, qr)); + tc_sym::conditional_remove(quot, rem, &pd_array[pd_index1]) || tc_sym::remove(quot, rem, &pd_array[get_alt_index_cf_stable(pd_index1, qr)]); + } + + auto get_capacity() const -> size_t { + size_t res = 0; + for (size_t i = 0; i < number_of_pd; ++i) { + res += tc_sym::get_cap(&pd_array[i]); + } + return res; + } + + size_t get_byte_size() const { + return number_of_pd * sizeof(pd_array[0]); + } + + auto get_name() const -> std::string { + return "TC-shortcut"; + } + + auto get_cap() const -> size_t { + return get_capacity(); + } + + auto get_effective_load() const -> double { + const size_t slots = number_of_pd * tc_sym::MAX_CAP; + const size_t filter_cap = get_cap(); + double ratio = 1.0 * filter_cap / slots; + return ratio; + } + + std::string info() const { + std::stringstream ss; + size_t cap = get_cap(); + ss << std::string(80, '=') << std::endl; + double ratio = (1.0 * cap) / filter_max_capacity; + ss << "filter_max_capacity: \t" << filter_max_capacity << std::endl; + ss << "cap: \t" << cap << std::endl; + ss << "ratio: \t" << ratio << std::endl; + ss << "number_of_pd: \t" << number_of_pd << std::endl; + ss << "given-load: \t" << load << std::endl; + // ss << "actual-load: \t" << load << std::endl; + ss << std::string(80, '=') << std::endl; + return ss.str(); + } +}; + +#endif// TWOCHOICER_HEADER diff --git a/TC-Shortcut/tc-sym.cpp b/TC-Shortcut/tc-sym.cpp new file mode 100644 index 0000000..ffdb603 --- /dev/null +++ b/TC-Shortcut/tc-sym.cpp @@ -0,0 +1,135 @@ +#include "tc-sym.hpp" + + +namespace tc_sym::check { + + auto validate_number_of_quotient(const __m512i *pd) -> bool { + auto pd64 = (const u64 *) pd; + u64 h0 = pd64[0]; + u64 h1 = pd64[1]; + u64 h1_masked = pd64[1] & _bzhi_u64(-1, QUOTS + MAX_CAP - 64); + auto pop0 = _mm_popcnt_u64(h0); + auto pop1 = _mm_popcnt_u64(h1_masked); + auto pop1_extended = _mm_popcnt_u64(h1); + auto pop1_e2 = _mm_popcnt_u64(h1 & _bzhi_u64(-1, 40)); + if (pop0 + pop1 == QUOTS) + return true; + + + std::cout << "h0: \t" << format_word_to_string(h0) << std::endl; + std::cout << "h1: \t" << format_word_to_string(h1) << std::endl; + std::cout << "h1_m: \t" << format_word_to_string(h1_masked) << std::endl; + + assert(0); + return false; + } + + + auto validate_number_of_quotient(const __m512i *pd, const __m512i *backup_pd) -> bool { + auto pd64 = (const u64 *) pd; + u64 h0 = pd64[0]; + u64 h1 = pd64[1]; + u64 h1_masked = pd64[1] & _bzhi_u64(-1, QUOTS + MAX_CAP - 64); + auto pop0 = _mm_popcnt_u64(h0); + auto pop1 = _mm_popcnt_u64(h1_masked); + auto pop1_extended = _mm_popcnt_u64(h1); + auto pop1_e2 = _mm_popcnt_u64(h1 & _bzhi_u64(-1, 40)); + if (pop0 + pop1 == QUOTS) + return true; + + + auto bpd64 = (const u64 *) backup_pd; + std::cout << std::string(80, '=') << std::endl; + std::cout << "h0: \t" << format_word_to_string(h0) << std::endl; + std::cout << "h0: \t" << format_word_to_string(bpd64[0]) << std::endl; + std::cout << std::endl; + std::cout << "h1: \t" << format_word_to_string(h1) << std::endl; + std::cout << "h1: \t" << format_word_to_string(bpd64[1]) << std::endl; + std::cout << std::endl; + std::cout << "h1_m: \t" << format_word_to_string(h1_masked) << std::endl; + std::cout << "h1_m: \t" << format_word_to_string(bpd64[1] & _bzhi_u64(-1, 40)) << std::endl; + std::cout << std::string(80, '=') << std::endl; + // std::cout << std::string(80, '~') << std::endl; + // std::cout << "h1: \t" << format_word_to_string(bpd64[1]) << std::endl; + + assert(0); + return false; + } + + +}// namespace tc_sym::check + +// for printing +namespace tc_sym::check { + void p_format_word(uint64_t x) { + std::string res = to_bin(x, 64); + std::cout << space_string(res) << std::endl; + } + + auto format_word_to_string(uint64_t x, size_t length) -> std::string { + std::string res = to_bin(x, length);// + "\n"; + return space_string(res); + // std::cout << space_string(res) << std::endl; + } + + /** + * @brief This prints the binary representation of x. Usually, a reversed representation is needed. + * + * @param x + * @param length + * @return std::string + */ + auto to_bin(uint64_t x, size_t length) -> std::string { + assert(length <= 64); + uint64_t b = 1ULL; + std::string res; + for (size_t i = 0; i < length; i++) { + res += (b & x) ? "1" : "0"; + b <<= 1ul; + } + return res; + } + + auto space_string(std::string s) -> std::string { + std::string new_s = ""; + for (size_t i = 0; i < s.size(); i += 4) { + if (i) { + if (i % 16 == 0) { + new_s += "|"; + } else if (i % 4 == 0) { + new_s += "."; + } + } + new_s += s.substr(i, 4); + } + return new_s; + } + + void print_pd_first_two_words(const __m512i *pd, size_t tabs = 1) { + uint64_t h0 = 0, h1 = 0; + memcpy(&h0, pd, 8); + memcpy(&h1, reinterpret_cast(pd) + 1, 8); + auto s0 = format_word_to_string(h0, 64); + auto s1 = format_word_to_string(h1, 64); + + auto tabs_to_add = std::string(tabs, '\t'); + // size_t pops[2] = {_mm_popcnt_u64(h0), _mm_popcnt_u64(h1)}; + std::cout << "h0: \t" + tabs_to_add << s0; + std::cout << "\t|\t (" << _mm_popcnt_u64(h0) << ", " << (64 - _mm_popcnt_u64(h0)) << ")" << std::endl; + std::cout << "h1: \t" + tabs_to_add << s1; + std::cout << "\t|\t (" << _mm_popcnt_u64(h1) << ", " << (64 - _mm_popcnt_u64(h1)) << ")" << std::endl; + } + + void print_pd(const __m512i *pd) { + std::cout << std::string(80, '~') << std::endl; + // assert(pd512::get_capacity(pd) == pd512::get_capacity_naive(pd)); + std::cout << "pd capacity:" << get_cap(pd) << std::endl; + // v_pd512_plus::print_headers_extended(pd); + print_pd_first_two_words(pd); + auto mp = ((const u8 *) pd) + 16; + auto body_str = str_bitsMani::str_array_with_line_numbers(mp, MAX_CAP); + std::cout << body_str << std::endl; + std::cout << std::string(80, '~') << std::endl; + } + +}// namespace tc_sym::check diff --git a/TC-Shortcut/tc-sym.hpp b/TC-Shortcut/tc-sym.hpp new file mode 100644 index 0000000..7938fda --- /dev/null +++ b/TC-Shortcut/tc-sym.hpp @@ -0,0 +1,733 @@ +/* + * My implementation of twoChoicer. A filter with "Power-of-2-choices" insertion policy. + * Also known as Vector-Quotient-Filter. + * In this version, deletion should work, but was not extensively tested. + */ + +#ifndef TC_SYM_HPP +#define TC_SYM_HPP + +#include "../Prefix-Filter/Shift_op.hpp" + +#include +#include +#include +#include +#include +#include +#include +#include + + +typedef uint64_t u64; +typedef uint32_t u32; +typedef uint16_t u16; +typedef uint8_t u8; + +typedef uint_fast64_t uf64; +typedef uint_fast32_t uf32; +typedef uint_fast16_t uf16; +typedef uint_fast8_t uf8; + + +namespace tc_sym::check { + template + void zero_array(T *a, size_t a_size) { + for (size_t i = 0; i < a_size; i++) { + a[i] = 0; + } + } + + auto space_string(std::string s) -> std::string; + auto to_bin(uint64_t x, size_t length) -> std::string; + void p_format_word(uint64_t x); + auto format_word_to_string(uint64_t x, size_t length = 64) -> std::string; + + void print_pd(const __m512i *pd); + + auto validate_number_of_quotient(const __m512i *pd) -> bool; + + auto validate_number_of_quotient(const __m512i *pd, const __m512i *backup_pd) -> bool; +}// namespace tc_sym::check + +namespace tc_sym { + + constexpr size_t QUOTS = 80; + constexpr size_t MAX_CAP = 48; + constexpr unsigned kBytes2copy = (QUOTS + MAX_CAP + CHAR_BIT - 1) / CHAR_BIT; + + + inline uint_fast8_t popcount128(unsigned __int128 x) { + const uint64_t hi = x >> 64; + const uint64_t lo = x; + return _mm_popcnt_u64(lo) + _mm_popcnt_u64(hi); + } + + inline uint_fast8_t popcount128_on_pd(const __m512i *pd) { + const auto temp = _mm512_castsi512_si128(*pd); + return _mm_popcnt_u64(_mm_extract_epi64(temp, 0)) + _mm_popcnt_u64(_mm_extract_epi64(temp, 1)); + } + + __attribute__((always_inline)) inline uint64_t select64(uint64_t x, int64_t j) { + assert(j < 64); + const uint64_t y = _pdep_u64(UINT64_C(1) << j, x); + return _tzcnt_u64(y); + } + + inline uint64_t select128(unsigned __int128 x, int64_t j) { + const int64_t pop = _mm_popcnt_u64(x); + if (j < pop) + return select64(x, j); + return 64 + select64(x >> 64, j - pop); + } + + __attribute__((always_inline)) inline size_t select_on_first_part(int64_t quot, const __m512i *pd) { + return select128(((unsigned __int128 const *) pd)[0], quot); + } + + __attribute__((always_inline)) inline size_t select_on_pd_cap(const __m512i *pd) { + constexpr size_t t = QUOTS - 1; + u64 Header[2]; + memcpy(Header, pd, 16); + // = (const u64*) pd; + const int64_t pop = _mm_popcnt_u64(Header[0]); + if (t < pop) + return select64(Header[0], t); + return 64 + select64(Header[1], t - pop); + // return select128(((unsigned __int128 const *) pd)[0], quot); + } + + __attribute__((always_inline)) inline void select_both_on_word_arr(u64 x, size_t j, uf8 res[2]) { + assert(j < 64); + const uint64_t y = _pdep_u64(UINT64_C(3) << j, x); + assert(_mm_popcnt_u64(y) == 2); + + res[0] = _tzcnt_u64(y); + res[1] = _tzcnt_u64(_blsr_u64(y)); + } + + inline void select_both_case0_arr(size_t k, u8 res[2], const __m512i *pd) { + const u64 h0 = ((const u64 *) pd)[0]; + const u64 h1 = ((const u64 *) pd)[1]; + if (k == 0) { + res[0] = 0; + res[1] = _tzcnt_u64(h0); + return; + } + auto pop0 = _mm_popcnt_u64(h0); + if (k < pop0) { + select_both_on_word_arr(h0, k - 1, res); + return; + } + if (k > pop0) { + auto new_k = k - pop0; + select_both_on_word_arr(h1, new_k - 1, res); + res[0] += 64; + res[1] += 64; + return; + } else { + res[0] = 63 - _lzcnt_u64(h0); + res[1] = 64 + _tzcnt_u64(h1); + } + } + + /** + * @brief Get the select mask object + * + * keeps the (j)'th 1 and the (j + 1)'th 1 in x turn on, and turn off the other bits. + * @param x + * @param j >= 0 + * @return uint64_t + */ + inline uint64_t get_select_mask(uint64_t x, int64_t j) { + assert(_mm_popcnt_u64(x) > j); + return _pdep_u64(3ul << (j), x); + } + + /** + * @brief + * + * @param x a number with only two set bits. (62 zeros, and 2 ones). + * @return uint64_t turn on the bits between the currently set bits. + * Also turn off the previously turned on bits. + */ + inline uint64_t mask_between_bits(uint64_t x) { + assert(_mm_popcnt_u64(x) == 2); + uint64_t hi_bit = (x - 1) & x; + uint64_t clear_hi = hi_bit - 1; + uint64_t lo_set = (x - 1); + uint64_t res = (clear_hi ^ lo_set) & (~x); + return res; + } + + inline bool pd_full(const __m512i *pd) { + uint8_t header_end; + memcpy(&header_end, reinterpret_cast(pd) + 15, 1); + return header_end & 128; + } + + + inline uf8 get_cap_naive(const __m512i *pd) { + auto res = select_on_pd_cap(pd) - (QUOTS - 1); +#ifndef NDEBUG + auto res0 = select_on_first_part(QUOTS - 1, pd) - (QUOTS - 1); + assert(res == res0); +#endif//!NDEBUG + return res; + } + + __attribute__((always_inline)) inline size_t get_cap(const __m512i *pd) { + u64 h_last; + // memcpy(&h_last, (const u8 *) pd + (kBytes2copy - 8), 8); + memcpy(&h_last, (const u8 *) pd + 8, 8); + auto temp = _lzcnt_u64(h_last); + auto res = MAX_CAP - temp; + +#ifndef NDEBUG + auto val = get_cap_naive(pd); + if (res == val) + return res; + std::cout << "res: " << res << std::endl; + std::cout << "val: " << val << std::endl; + + assert(0); +#endif//!NDEBUG + assert(res == get_cap_naive(pd)); + assert((res == MAX_CAP) == pd_full(pd)); + return res; + } + + inline bool pd_less_than_thres(const __m512i *pd) { + constexpr size_t thres_cap = 36; + //We need to to test if the last 12+1 bits contains only zeros. + constexpr u64 thres = (1ULL << (128 - 13 - 64)) - 1; + const uint64_t h1 = _mm_extract_epi64(_mm512_castsi512_si128(*pd), 1); + const bool res = h1 < thres; +#ifndef NDEBUG + auto cap = get_cap(pd); + bool val = cap < thres_cap; + if (val != res) { + get_cap(pd); + std::cout << "cap: " << cap << std::endl; + std::cout << "val: " << val << std::endl; + std::cout << "res: " << res << std::endl; + } +#endif//!NDEBUG + return res; + } + + inline size_t get_spec_quot_cap_inside_word(size_t quot, u64 word) { + const u64 p_mask = 3 << (quot - 1); + u64 pdep_res = _pdep_u64(p_mask, word); + assert(__builtin_popcountll(pdep_res) == 2); + size_t begin = _tzcnt_u64(pdep_res) + 1; + size_t end = _tzcnt_u64(_blsr_u64(pdep_res)); + size_t res = end - begin; + return res; + } + + inline size_t get_spec_quot_cap(size_t quot, const __m512i *pd) { + assert(0); + assert(quot < QUOTS); + const u64 *pd64 = (const u64 *) pd; + // const u64 clean_h = get_clean_header(pd); + if (quot == 0) { + std::cout << "h0" << std::endl; + return _tzcnt_u64(pd64[0]); + } + const size_t pop0 = _mm_popcnt_u64(pd64[0]); + if (quot < pop0) { + std::cout << "h1" << std::endl; + return get_spec_quot_cap_inside_word(quot - 1, pd64[0]); + } else if (pop0 < quot) { + std::cout << "h2" << std::endl; + size_t new_q = quot - pop0; + return get_spec_quot_cap_inside_word(new_q - 1, pd64[1]); + } + std::cout << "h3" << std::endl; + const size_t part1 = _lzcnt_u64(pd64[0]); + const size_t part2 = _tzcnt_u64(pd64[1]); + return part1 + part2; + } + + inline size_t get_spec_quot_cap2(size_t quot, const __m512i *pd) { + assert(quot < QUOTS); + const u64 *pd64 = (const u64 *) pd; + if (quot == 0) { + // std::cout << "h0" << std::endl; + return _tzcnt_u64(pd64[0]); + } + size_t begin = select_on_first_part(quot - 1, pd) + 1; + size_t end = select_on_first_part(quot, pd); + return end - begin; + } + + + /** + * @brief Shift 'a' 8 bits right. + * @param a + * @return __m512i + */ + inline __m512i shift_right(__m512i a) { + // The indices encoded here actually encode shift left. + // idx is an "uint8_t arr[64]" where "arr[i] = i-1" (arr[0] = 0). + constexpr __m512i idx = {433757350076153919, 1012478732780767239, 1591200115485380623, 2169921498189994007, + 2748642880894607391, 3327364263599220775, 3906085646303834159, 4484807029008447543}; + constexpr uint64_t mask = 18446744073709551614ULL; + __m512i res = _mm512_maskz_permutexvar_epi8(mask, idx, a); + return res; + } + + inline __m512i shift_left(__m512i a) { + constexpr __m512i idx = {578437695752307201, 1157159078456920585, 1735880461161533969, 2314601843866147353, 2893323226570760737, 3472044609275374121, 4050765991979987505, 17801356257212985}; + + constexpr uint64_t mask = 9223372036854775807ULL; + __m512i res = _mm512_maskz_permutexvar_epi8(mask, idx, a); + return res; + } + + inline bool pd_find_naive(int64_t quot, uint8_t rem, const __m512i *pd) { + assert(0 == (reinterpret_cast(pd) % 64)); + assert(quot < QUOTS); + const __m512i target = _mm512_set1_epi8(rem); + uint64_t v = _mm512_cmpeq_epu8_mask(target, *pd) >> 16ul; + + if (!v) return false; + + // const unsigned __int128 *h = (const unsigned __int128 *) pd; + // constexpr unsigned __int128 kLeftoverMask = (((unsigned __int128) 1) << (50 + 51)) - 1; + const unsigned __int128 header = ((const unsigned __int128 *) pd)[0]; + assert(popcount128(header) == QUOTS); + const uint64_t begin = quot ? select128(header, quot - 1) + 1 - quot : 0; + const uint64_t end = select128(header, quot) - quot; + assert(begin <= end); + assert(end <= MAX_CAP); + return (v & ((UINT64_C(1) << end) - 1)) >> begin; + } + + inline bool pd_find_50_v18(int64_t quot, uint8_t rem, const __m512i *pd) { + assert(0 == (reinterpret_cast(pd) % 64)); + assert(quot < QUOTS); + const __m512i target = _mm512_set1_epi8(rem); + uint64_t v = _mm512_cmpeq_epu8_mask(target, *pd) >> 16ul; + + if (!v) return false; + + const uint64_t h0 = _mm_extract_epi64(_mm512_castsi512_si128(*pd), 0); + const uint64_t h1 = _mm_extract_epi64(_mm512_castsi512_si128(*pd), 1); + if (_blsr_u64(v) == 0) { + // if ((v << quot)) { + if ((quot < 64) && (v << quot)) { + // const unsigned __int128 *h = (const unsigned __int128 *) pd; + // const unsigned __int128 header = (*h); + const int64_t mask = v << quot; + const bool att = (!(h0 & mask)) && (_mm_popcnt_u64(h0 & (mask - 1)) == quot); + /* if (att != pd_find_naive(quot, rem, pd)) { + bool val = pd_find_naive(quot, rem, pd); + std::cout << std::string(80, '=') << std::endl; + std::cout << "val: \t" << val << std::endl; + std::cout << "att: \t" << att << std::endl; + std::cout << "quot: \t" << quot << std::endl; + std::cout << "rem: \t" << (u16) rem << std::endl; + std::cout << "cap: \t" << get_cap(pd) << std::endl; + std::cout << std::string(80, '~') << std::endl; + bool a = (!(h0 & mask)); + bool b = (_mm_popcnt_u64(h0 & (mask - 1)) == quot); + std::cout << "a: " << a << std::endl; + std::cout << "b: " << b << std::endl; + std::cout << std::string(80, '=') << std::endl; + + assert(att == pd_find_naive(quot, rem, pd)); + } + */ + assert(att == pd_find_naive(quot, rem, pd)); + return (!(h0 & mask)) && (_mm_popcnt_u64(h0 & (mask - 1)) == quot); + } else { + // auto *h = (const unsigned __int128 *) pd; + // constexpr unsigned __int128 kLeftoverMask = (((unsigned __int128) 1) << (50 + 51)) - 1; + // const unsigned __int128 header = (*h) & kLeftoverMask; + const unsigned __int128 header = ((const unsigned __int128 *) pd)[0]; + const unsigned __int128 mask = ((unsigned __int128) v) << quot; + const bool att = (!(header & mask)) && (popcount128(header & (mask - 1)) == quot); + assert(att == pd_find_naive(quot, rem, pd)); + return (!(header & mask)) && (popcount128(header & (mask - 1)) == quot); + } + } + + const int64_t pop = _mm_popcnt_u64(h0); + + if (quot == 0) { + // std::cout << "h0" << std::endl; + return v & (_blsmsk_u64(h0) >> 1ul); + } else if (quot < pop) { + // std::cout << "h1" << std::endl; + const uint64_t mask = (~_bzhi_u64(-1, quot - 1)); + const uint64_t h_cleared_quot_set_bits = _pdep_u64(mask, h0); + return (((_blsmsk_u64(h_cleared_quot_set_bits) ^ _blsmsk_u64(_blsr_u64(h_cleared_quot_set_bits))) & (~h0)) >> quot) & v; + } else if (quot > pop) { + // std::cout << "h2" << std::endl; + + const uint64_t mask = (~_bzhi_u64(-1, quot - pop - 1)); + const uint64_t h_cleared_quot_set_bits = _pdep_u64(mask, h1); + return (((_blsmsk_u64(h_cleared_quot_set_bits) ^ _blsmsk_u64(_blsr_u64(h_cleared_quot_set_bits))) & (~h1)) >> (quot - pop)) & (v >> (64 - pop)); + } else { + // std::cout << "h3" << std::endl; + + const uint64_t helper = _lzcnt_u64(h0); + const uint64_t temp = (63 - helper) + 1; + const uint64_t diff = helper + _tzcnt_u64(h1); + return diff && ((v >> (temp - quot)) & ((UINT64_C(1) << diff) - 1)); + } + } + + inline bool find(int64_t quot, uint8_t rem, const __m512i *pd) { +#ifndef NDEBUG + bool val = pd_find_naive(quot, rem, pd); + bool res = pd_find_50_v18(quot, rem, pd); + if (val != res) { + std::cout << "val: \t" << val << std::endl; + std::cout << "res: \t" << res << std::endl; + std::cout << "quot: \t" << quot << std::endl; + std::cout << "rem: \t" << (u16) rem << std::endl; + std::cout << "cap: \t" << get_cap(pd) << std::endl; + assert(0); + } +#endif//!NDEBUG + return pd_find_50_v18(quot, rem, pd); + } + + inline void body_remove_case0_avx(size_t index, __m512i *pd) { + const __m512i shifted_pd = shift_left(*pd); + const uint64_t mask = _bzhi_u64(-1, kBytes2copy + index); + _mm512_store_si512(pd, _mm512_mask_blend_epi8(mask, shifted_pd, *pd)); + } + + inline void header_remove_branch(size_t h_end, __m512i *pd) { +#ifndef NDEBUG + const __m512i backup = *pd; +#endif// DEBUG \ + // assert(check::validate_number_of_quotient_case0(pd)); \ + // assert(get_cap_wrap(pd)); \ + // assert(get_cap_wrap(pd) <= MAX_CAP0); + constexpr uint64_t J = 64; + uint64_t *pd64 = ((uint64_t *) pd); + if (h_end >= 64) { + const size_t rel_index = h_end - 64u; + assert(rel_index < J); + const uint64_t index_mask = _bzhi_u64(-1, rel_index); + uint64_t lo = pd64[1] & index_mask; + uint64_t hi = ((pd64[1] & ~index_mask) >> 1u);// & _bzhi_u64(-1, J); + // uint64_t hi = (pd64[1] >> rel_index) << (rel_index + 1); + assert(!(lo & hi)); + const uint64_t new_h1 = (lo | hi); + memcpy(pd64 + 1, &new_h1, 8); + assert(check::validate_number_of_quotient(pd, &backup)); + assert(check::validate_number_of_quotient(pd)); + return; + } + uint64_t h0, h1; + // memcpy(&h0, (const uint64_t *) pd, 8); + memcpy(&h0, pd64, 8); + memcpy(&h1, pd64 + 1, 8); + const uint64_t bit_to_move = pd64[1] << 63u; + const uint64_t h0_mask = _bzhi_u64(-1, h_end); + + const uint64_t h0_lower = h0 & h0_mask; + const uint64_t h0_hi = (h0 & ~h0_mask) >> 1u; + assert(!(h0_lower & h0_hi)); + pd64[0] = h0_lower | h0_hi | bit_to_move; + + pd64[1] >>= 1u; + // const uint64_t new_h1 = (pd64[1] >> 1u + // memcpy(pd64 + 1, &new_h1, 5); + assert(check::validate_number_of_quotient(pd, &backup)); + assert(check::validate_number_of_quotient(pd)); + } + + inline bool conditional_remove(int64_t quot, uint8_t rem, __m512i *pd) { + assert(quot < QUOTS); + + const __m512i target = _mm512_set1_epi8(rem); + uint64_t v = _mm512_cmpeq_epu8_mask(target, *pd) >> 13ul; + if (!v) + return false; + + + /* if (_blsr_u64(v) == 0) { + const uint64_t i = _tzcnt_u64(v); + + const bool find_res = (!(header & (((unsigned __int128) 1) << (quot + i)))) && + (pd512::popcount128(header & (((unsigned __int128) 1 << (quot + i)) - 1)) == quot); + + if (find_res) { + assert(rem == ((const uint8_t *) pd)[kBytes2copy + i]); + + const uint64_t shift = i + quot; + unsigned __int128 new_header = header & ((((unsigned __int128) 1) << shift) - 1); + new_header |= ((header >> (shift + 1)) << (shift)); + // new_header |= ((header >> shift) << (shift - 1)); + + assert(pd512::popcount128(header) == 50); + + assert(pd512::validate_number_of_quotient(pd)); + memcpy(pd, &new_header, kBytes2copy); + assert(pd512::validate_number_of_quotient(pd)); + + memmove(&((uint8_t *) pd)[kBytes2copy + i], + &((const uint8_t *) pd)[kBytes2copy + i + 1], + sizeof(*pd) - (kBytes2copy + i + 1)); + } + return find_res; + } + */ + + uf8 res[2] = {0, 0}; + select_both_case0_arr(quot, res, pd); + const uf64 begin = res[0] + (quot != 0); + uf64 end = res[1]; + assert(begin <= end); + const uint64_t begin_fingerprint = begin - quot; + const uint64_t end_fingerprint = end - quot; + + assert(begin_fingerprint <= end_fingerprint); + assert(end_fingerprint <= MAX_CAP); + + uint64_t v1 = v >> begin_fingerprint; + uint64_t i = _tzcnt_u64(v1) + begin_fingerprint; + + // assert(((1 << end_fingerprint) < v) == (i < end_fingerprint)); + if (i >= end_fingerprint) + return false; + + assert(pd_find_naive(quot, rem, pd)); + assert(rem == ((const uint8_t *) pd)[kBytes2copy + i]); + + const uint64_t shift = i + quot; + + header_remove_branch(shift, pd); + body_remove_case0_avx(i, pd); + + return true; + } + + inline bool remove(int64_t quot, uint8_t rem, __m512i *pd) { + assert(quot < QUOTS); + assert(find(quot, rem, pd)); + + const __m512i target = _mm512_set1_epi8(rem); + uint64_t v = _mm512_cmpeq_epu8_mask(target, *pd) >> 16ul; + assert(v); + + + if (_blsr_u64(v) == 0) { + const uint64_t i = _tzcnt_u64(v); + size_t h_index = i + quot; + + header_remove_branch(h_index, pd); + body_remove_case0_avx(i, pd); + return true; + } + + uf8 res[2] = {0, 0}; + select_both_case0_arr(quot, res, pd); + const uf64 begin = res[0] + (quot != 0); + uf64 end = res[1]; + assert(end == select_on_first_part(quot, pd)); + assert(begin <= end); + const uint64_t begin_fingerprint = begin - quot; + const uint64_t end_fingerprint = end - quot; + + const uint64_t b_mask = ~((1ull << (begin_fingerprint)) - 1); + const uint64_t end_mask = ((1ull << end_fingerprint) - 1); + const uint64_t mask = b_mask & end_mask; + assert((begin < end) ? mask : !mask); + const uint64_t v_masked = v & mask; + assert(v_masked); + + const uint64_t i = _tzcnt_u64(v_masked); + + header_remove_branch(end - 1, pd); + body_remove_case0_avx(i, pd); + + return true; + } + + inline void body_add3(size_t end_fingerprint, uint8_t rem, __m512i *pd) { + const __m512i shifted_pd = shift_right(*pd); + ((uint8_t *) pd)[kBytes2copy + end_fingerprint] = rem; + const uint64_t mask = _bzhi_u64(-1, kBytes2copy + end_fingerprint + 1); + _mm512_store_si512(pd, _mm512_mask_blend_epi8(mask, shifted_pd, *pd)); + } + + inline void write_header6(uint64_t index, __m512i *pd) { + assert(check::validate_number_of_quotient(pd)); + // v_pd512_plus::print_headers(pd); + // constexpr uint64_t h1_mask = ((1ULL << (101 - 64)) - 1); + + uint64_t *pd64 = (uint64_t *) pd; + // const uint64_t low_h1 = ((pd64[1] << 1) & h1_const_mask) | (pd64[0] >> 63u); + const uint64_t low_h1 = (pd64[1] << 1) | (pd64[0] >> 63u); + + const uint64_t h0_mask = _bzhi_u64(-1, index); + const uint64_t h0_lower = pd64[0] & h0_mask; + + // pd64[0] = h0_lower | ((pd64[0] << 1u) & ~h0_mask); + pd64[0] = h0_lower | ((pd64[0] & ~h0_mask) << 1u); + memcpy(pd64 + 1, &low_h1, kBytes2copy - 8); + // v_pd512_plus::print_headers(pd); + + assert(check::validate_number_of_quotient(pd)); + } + + + inline void header_remove_naive(uint64_t index, __m512i *pd) { + assert(check::validate_number_of_quotient(pd)); + + const unsigned __int128 *h = (const unsigned __int128 *) pd; + constexpr unsigned __int128 kLeftoverMask = (((unsigned __int128) 1) << (50 + 51)) - 1; + const unsigned __int128 header = (*h) & kLeftoverMask; + + // const uint64_t end = select128(header, quot); + + const unsigned __int128 mask = (((unsigned __int128) 1) << index) - 1ull; + unsigned __int128 high_header = (header & ~mask) >> 1ull; + unsigned __int128 low_header = header & mask; + // assert(!(high_header & low_header)); + unsigned __int128 new_header = high_header | low_header; + memcpy(pd, &new_header, kBytes2copy); + assert(check::validate_number_of_quotient(pd)); + } + + inline void header_remove(uint64_t index, __m512i *pd) { + assert(tc_sym::check::validate_number_of_quotient(pd)); + // v_pd512_plus::print_headers(pd); + + uint64_t *pd64 = (uint64_t *) pd; + const uint64_t h1_lsb = pd64[1] << 63u; + // const uint64_t low_h1 = (pd64[1] & h1_const_mask) >> 1u; + pd64[1] >>= 1u; + // const uint64_t low_h1 = pd64[1] & h1_const_mask) >> 1u; + const uint64_t h0_mask = _bzhi_u64(-1, index); + const uint64_t h0_lower = pd64[0] & h0_mask; + const uint64_t h0_higher = ((pd64[0] & ~h0_mask) >> 1u) | h1_lsb; + + pd64[0] = h0_lower | h0_higher; + // memcpy(pd64 + 1, &low_h1, kBytes2copy - 8); + + // v_pd512_plus::print_headers(pd); + assert(tc_sym::check::validate_number_of_quotient(pd)); + } + + + inline void add_quot0(uint8_t rem, __m512i *pd) { + assert(check::validate_number_of_quotient(pd)); + uint64_t *pd64 = (uint64_t *) pd; + //TODO: end can always be zero. + const uint64_t end = _tzcnt_u64(pd64[0]); + const uint64_t low_h1 = ((pd64[1] << 1)) | (pd64[0] >> 63u); + memcpy(pd64 + 1, &low_h1, kBytes2copy - 8); + pd64[0] <<= 1u; + assert(check::validate_number_of_quotient(pd)); + + body_add3(end, rem, pd); + } + + + /** + * @brief Inserting a new element when pd is not full. + * + * @param quot + * @param rem + * @param pd + */ + inline void add_wrap(int64_t quot, uint8_t rem, __m512i *pd) { + assert(!pd_full(pd)); + assert(quot < QUOTS); + + if (quot == 0) { + add_quot0(rem, pd); + return; + } + + + // constexpr uint64_t h1_const_mask = ((1ULL << (101 - 64)) - 1); + + const uint64_t h0 = _mm_extract_epi64(_mm512_castsi512_si128(*pd), 0); + const uint64_t pop = _mm_popcnt_u64(h0); + // const uint64_t pop = (h0 ^ (h0 >> 8u)) % QUOTS; + if (quot < pop) { + const uint64_t end = select64(h0, quot); + write_header6(end, pd); + // write_header_naive(quot, end, pd); + body_add3(end - quot, rem, pd); + return; + } else { + const uint64_t h1 = _mm_extract_epi64(_mm512_castsi512_si128(*pd), 1); + const uint64_t end = select64(h1, quot - pop); + + //header + assert(tc_sym::check::validate_number_of_quotient(pd)); + + const uint64_t h1_mask = _bzhi_u64(-1, end); + const uint64_t h1_low = h1 & h1_mask; + assert(end < 64); + const uint64_t h1_high = (h1 >> end) << (end + 1); + assert(!(h1_low & h1_high)); + const uint64_t new_h1 = h1_low | h1_high; + + memcpy(&((uint64_t *) pd)[1], &new_h1, kBytes2copy - 8); + assert(tc_sym::check::validate_number_of_quotient(pd)); + + //body + const uint64_t index = 64 + end - quot; + // body_add_naive(index, rem, pd); + body_add3(index, rem, pd); + + assert(tc_sym::check::validate_number_of_quotient(pd)); + assert(find(quot, rem, pd)); + + return; + } + } + + + inline bool add_db(int64_t quot, uint8_t rem, __m512i *pd) { + // if (pd_full(pd)) + assert(!pd_full(pd)); + auto prev_q_occ = get_spec_quot_cap2(quot, pd); + add_wrap(quot, rem, pd); + auto post_q_occ = get_spec_quot_cap2(quot, pd); + auto post_q_occ2 = quot ? bitsMani::count_zeros_between_consecutive_ones(quot - 1, (const u64 *) pd, 512) : select_on_first_part(0, pd); + // auto post_q_occ3 = get_spec_quot_cap2(quot, pd); + // if ((post_q_occ != post_q_occ2) or (post_q_occ != post_q_occ3)) { + if (post_q_occ != post_q_occ2) { + std::cout << "post_q_occ: \t" << post_q_occ << std::endl; + std::cout << "post_q_occ2: \t" << post_q_occ2 << std::endl; + // std::cout << "post_q_occ3: \t" << post_q_occ3 << std::endl; + tc_sym::check::print_pd(pd); + assert(0); + } + if (prev_q_occ + 1 != post_q_occ) { + std::cout << "prev_q_occ: \t" << prev_q_occ << std::endl; + std::cout << "post_q_occ: \t" << post_q_occ << std::endl; + std::cout << "quot: \t" << quot << std::endl; + std::cout << "rem: \t" << (u16) rem << std::endl; + + tc_sym::check::print_pd(pd); + } + assert(prev_q_occ + 1 == post_q_occ); + assert(find(quot, rem, pd)); + return true; + } + + inline bool add(int64_t quot, uint8_t rem, __m512i *pd) { + // return add_db(quot, rem, pd); + assert(!pd_full(pd)); + add_wrap(quot, rem, pd); + assert(find(quot, rem, pd)); + return true; + } +}// namespace tc_sym + + +#endif// TC_SYM_HPP diff --git a/Tests/PerfEvent.hpp b/Tests/PerfEvent.hpp new file mode 100644 index 0000000..b8b9619 --- /dev/null +++ b/Tests/PerfEvent.hpp @@ -0,0 +1,266 @@ +/* + +Copyright (c) 2018 Viktor Leis + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + */ + +#pragma once + + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +struct PerfEvent { + + struct event { + struct read_format { + uint64_t value; + uint64_t time_enabled; + uint64_t time_running; + uint64_t id; + }; + + perf_event_attr pe; + int fd; + read_format prev; + read_format data; + + double readCounter() { + double multiplexingCorrection = static_cast(data.time_enabled - prev.time_enabled) / (data.time_running - prev.time_running); + return (data.value - prev.value) * multiplexingCorrection; + } + }; + + std::vector events; + std::vector names; + std::chrono::time_point startTime; + std::chrono::time_point stopTime; + + PerfEvent() { + registerCounter("cycles", PERF_TYPE_HARDWARE, PERF_COUNT_HW_CPU_CYCLES); + registerCounter("instructions", PERF_TYPE_HARDWARE, PERF_COUNT_HW_INSTRUCTIONS); + registerCounter("L1-misses", PERF_TYPE_HW_CACHE, PERF_COUNT_HW_CACHE_L1D | (PERF_COUNT_HW_CACHE_OP_READ << 8) | (PERF_COUNT_HW_CACHE_RESULT_MISS << 16)); + registerCounter("LLC-misses", PERF_TYPE_HARDWARE, PERF_COUNT_HW_CACHE_MISSES); + registerCounter("branch-misses", PERF_TYPE_HARDWARE, PERF_COUNT_HW_BRANCH_MISSES); + registerCounter("task-clock", PERF_TYPE_SOFTWARE, PERF_COUNT_SW_TASK_CLOCK); + // additional counters can be found in linux/perf_event.h + + const int pid = 0; // the current process + const int cpu = 2; + const int group = -1;// all CPUs + const unsigned long flags = 0; + for (unsigned i = 0; i < events.size(); i++) { + auto &event = events[i]; + event.fd = syscall(__NR_perf_event_open, &event.pe, pid, cpu, group, flags); + if (event.fd < 0) { + std::cerr << "Error opening counter " << names[i] << std::endl; + events.resize(0); + names.resize(0); + return; + } + } + } + + void registerCounter(const std::string &name, uint64_t type, uint64_t eventID) { + names.push_back(name); + events.push_back(event()); + auto &event = events.back(); + auto &pe = event.pe; + memset(&pe, 0, sizeof(struct perf_event_attr)); + pe.type = type; + pe.size = sizeof(struct perf_event_attr); + pe.config = eventID; + pe.disabled = true; + pe.inherit = 1; + pe.inherit_stat = 0; + pe.exclude_kernel = false; + pe.exclude_hv = false; + pe.read_format = PERF_FORMAT_TOTAL_TIME_ENABLED | PERF_FORMAT_TOTAL_TIME_RUNNING; + } + + void startCounters() { + for (unsigned i = 0; i < events.size(); i++) { + auto &event = events[i]; + ioctl(event.fd, PERF_EVENT_IOC_RESET, 0); + ioctl(event.fd, PERF_EVENT_IOC_ENABLE, 0); + if (read(event.fd, &event.prev, sizeof(uint64_t) * 3) != sizeof(uint64_t) * 3) + std::cerr << "Error reading counter " << names[i] << std::endl; + } + startTime = std::chrono::steady_clock::now(); + } + + ~PerfEvent() { + for (auto &event : events) { + close(event.fd); + } + } + + void stopCounters() { + stopTime = std::chrono::steady_clock::now(); + for (unsigned i = 0; i < events.size(); i++) { + auto &event = events[i]; + if (read(event.fd, &event.data, sizeof(uint64_t) * 3) != sizeof(uint64_t) * 3) + std::cerr << "Error reading counter " << names[i] << std::endl; + ioctl(event.fd, PERF_EVENT_IOC_DISABLE, 0); + } + } + + double getDuration() { + return std::chrono::duration(stopTime - startTime).count(); + } + + ulong get_time() { + return std::chrono::duration_cast(stopTime - startTime).count(); + // return std::chrono::duration(stopTime - startTime).count(); + } + + double getIPC() { + return getCounter("instructions") / getCounter("cycles"); + } + + double getCPUs() { + return getCounter("task-clock") / (getDuration() * 1e9); + } + + double getGHz() { + return getCounter("cycles") / getCounter("task-clock"); + } + + double getCounter(const std::string &name) { + for (unsigned i = 0; i < events.size(); i++) + if (names[i] == name) + return events[i].readCounter(); + return -1; + } + + static void printCounter(std::ostream &headerOut, std::ostream &dataOut, std::string name, std::string counterValue, bool addComma = true) { + auto width = std::max(name.length(), counterValue.length()); + headerOut << std::setw(width) << name << (addComma ? "," : "") << " "; + dataOut << std::setw(width) << counterValue << (addComma ? "," : "") << " "; + } + + template + static void printCounter(std::ostream &headerOut, std::ostream &dataOut, std::string name, T counterValue, bool addComma = true) { + std::stringstream stream; + stream << std::fixed << std::setprecision(2) << counterValue; + PerfEvent::printCounter(headerOut, dataOut, name, stream.str(), addComma); + } + + void printReport(std::ostream &out, uint64_t normalizationConstant) { + std::stringstream header; + std::stringstream data; + printReport(header, data, normalizationConstant); + out << header.str() << std::endl; + out << data.str() << std::endl; + } + + void printReport_NoHeader(std::ostream &out, uint64_t normalizationConstant) { + std::stringstream header; + std::stringstream data; + printReport(header, data, normalizationConstant); + out << data.str() << std::endl; + // out << header.str() << std::endl; + } + + void printReport(std::ostream &headerOut, std::ostream &dataOut, uint64_t normalizationConstant) { + if (!events.size()) + return; + + // print all metrics + for (unsigned i = 0; i < events.size(); i++) { + printCounter(headerOut, dataOut, names[i], events[i].readCounter() / normalizationConstant); + } + + printCounter(headerOut, dataOut, "scale", normalizationConstant); + + // derived metrics + printCounter(headerOut, dataOut, "IPC", getIPC()); + printCounter(headerOut, dataOut, "CPUs", getCPUs()); + printCounter(headerOut, dataOut, "GHz", getGHz(), false); + } +}; + +struct BenchmarkParameters { + + void setParam(const std::string &name, const std::string &value) { + params[name] = value; + } + + void setParam(const std::string &name, const char *value) { + params[name] = value; + } + + template + void setParam(const std::string &name, T value) { + setParam(name, std::to_string(value)); + } + + void printParams(std::ostream &header, std::ostream &data) { + for (auto &p : params) { + PerfEvent::printCounter(header, data, p.first, p.second); + } + } + + BenchmarkParameters(std::string name = "") { + if (name.length()) + setParam("name", name); + } + +private: + std::map params; +}; + +struct PerfEventBlock { + PerfEvent e; + uint64_t scale; + BenchmarkParameters parameters; + bool printHeader; + + PerfEventBlock(uint64_t scale = 1, BenchmarkParameters params = {}, bool printHeader = true) + : scale(scale), + parameters(params), + printHeader(printHeader) { + e.startCounters(); + } + + ~PerfEventBlock() { + e.stopCounters(); + std::stringstream header; + std::stringstream data; + parameters.printParams(header, data); + PerfEvent::printCounter(header, data, "time sec", e.getDuration()); + e.printReport(header, data, scale); + if (printHeader) + std::cout << header.str() << std::endl; + std::cout << data.str() << std::endl; + } +}; diff --git a/Tests/smart_tests.cpp b/Tests/smart_tests.cpp new file mode 100644 index 0000000..227934d --- /dev/null +++ b/Tests/smart_tests.cpp @@ -0,0 +1,171 @@ +#include "smart_tests.hpp" +namespace testSmart { + + size_t count_uniques(std::vector *v) { + std::sort(v->begin(), v->end()); + auto uniqueCount = std::unique(v->begin(), v->end()) - v->begin(); + return uniqueCount; + } + + void vector_concatenate_and_shuffle(const std::vector *v1, const std::vector *v2, std::vector *res, std::mt19937_64 rng) { + size_t all_size = v1->size() + v2->size(); + res->resize(all_size); + res->insert(res->end(), v1->begin(), v1->end()); + res->insert(res->end(), v2->begin(), v2->end()); + std::shuffle(res->begin(), res->end(), rng); + } + + void weighted_vector_concatenate_and_shuffle(const std::vector *v_yes, const std::vector *v_uni, std::vector *res, double yes_div, std::mt19937_64 rng) { + assert(yes_div <= 1); + auto v_yes_items = std::ceil(v_yes->size() * yes_div); + size_t all_size = v_yes_items + v_uni->size(); + res->resize(all_size); + res->insert(res->end(), v_yes->begin(), v_yes->begin() + v_yes_items); + res->insert(res->end(), v_uni->begin(), v_uni->end()); + std::shuffle(res->begin(), res->end(), rng); + } + + void vector_concatenate_and_shuffle(const std::vector *v1, const std::vector *v2, std::vector *res) { + std::uint_least64_t seed; + sysrandom(&seed, sizeof(seed)); + std::mt19937_64 new_rng(seed); + vector_concatenate_and_shuffle(v1, v2, res, new_rng); + } + + size_t test_shuffle_function(const std::vector *v1, const std::vector *v2, std::vector *res) { + size_t all_size = v1->size() + v2->size(); + res->resize(all_size); + res->insert(res->end(), v1->begin(), v1->end()); + res->insert(res->end(), v2->begin(), v2->end()); + res->shrink_to_fit(); + std::vector temp_vec(*res); + for (size_t i = 0; i < 100; i++) { assert(temp_vec.at(i) == res->at(i)); } + + std::uint_least64_t seed; + sysrandom(&seed, sizeof(seed)); + std::mt19937_64 new_rng(seed); + std::shuffle(res->begin(), res->end(), new_rng); + new_rng(); + // std::shuffle(res->begin(), res->end(), new_rng);new_rng(); + // std::shuffle(res->begin(), res->end(), new_rng);new_rng(); + // std::shuffle(res->begin(), res->end(), new_rng);new_rng(); + + size_t counter = 0; + for (size_t i = 0; i < all_size; i++) { counter += (temp_vec.at(i) == res->at(i)); } + + auto u_count = count_uniques(&temp_vec); + std::cout << "u_count: \t" << u_count << std::endl; + auto ratio = (1.0 * u_count) / temp_vec.size(); + std::cout << "ratio: \t" << ratio << std::endl; + + return counter; + // assert + } + + void print_vector(const std::vector *vec) { + std::cout << vec->at(0);// << std::endl; + for (size_t i = 1; i < vec->size(); i++) { + std::cout << ", " << vec->at(i);// << std::endl; + } + std::cout << std::endl; + } + + void print_vector(const std::vector *vec, size_t start, size_t end) { + assert(start < end); + assert(end < vec->size()); + std::cout << vec->at(start);// << std::endl; + for (size_t i = start + 1; i < end; i++) { + std::cout << ", " << vec->at(i);// << std::endl; + } + std::cout << std::endl; + } + + + std::mt19937_64 fill_vec_smart(std::vector *vec, size_t number_of_elements) { + + std::uint_least64_t seed; + sysrandom(&seed, sizeof(seed)); + // if (1) { + // std::cout << "seed is constant: " << 0xf1234'5678'9abc << std::endl; + // seed = 0xf1234'5678'9abc; + // } + std::mt19937_64 rng(seed); + std::uniform_int_distribution dist(0, UINT64_MAX); + + vec->resize(number_of_elements); + for (size_t i = 0; i < number_of_elements; ++i) { + vec->at(i) = dist(rng); + } + return rng; + } + + void fill_vec_from_range_and_shuffle(size_t start, size_t end, size_t length, const std::vector *input_vec, std::vector *temp_vec, std::mt19937_64 rng) { + assert(start < end); + assert(start + length <= end); + temp_vec->resize(end - start); + + for (size_t i = start; i < end; i++) { + temp_vec->at(i - start) = input_vec->at(i); + } + std::shuffle(temp_vec->begin(), temp_vec->end(), rng); + } + + void my_naive_sample(size_t start, size_t end, size_t length, const std::vector *input_vec, std::vector *temp_vec, std::mt19937_64 &rng) { + std::uniform_int_distribution<> dis(start, end); + for (size_t i = 0; i < length; i++) { + u64 temp_item = input_vec->at(dis(rng)); + temp_vec->at(i) = temp_item; + } + } + + void fill_vec_by_samples(size_t start, size_t end, size_t length, const std::vector *input_vec, std::vector *temp_vec, std::mt19937_64 rng) { + std::uint_least64_t seed; + sysrandom(&seed, sizeof(seed)); + std::mt19937_64 new_rng(seed); + assert(start < end); + assert(start + length <= end); + temp_vec->resize(length); + // auto it_start = input_vec->begin() + start; + // auto it_end = input_vec->begin() + end; + // std::sample(it_start, it_end, temp_vec->begin(), length, new_rng); + my_naive_sample(start, end, length, input_vec, temp_vec, new_rng); + temp_vec->shrink_to_fit(); + assert(temp_vec->size() == length); + std::shuffle(temp_vec->begin(), temp_vec->end(), new_rng); + } + + void fill_vec_by_samples(size_t start, size_t end, size_t length, const std::vector *input_vec, std::vector *temp_vec) { + std::uint_least64_t seed; + sysrandom(&seed, sizeof(seed)); + std::mt19937_64 new_rng(seed); + assert(start < end); + assert(start + length <= end); + temp_vec->resize(length); + // auto it_start = input_vec->begin() + start; + // auto it_end = input_vec->begin() + end; + // std::sample(it_start, it_end, temp_vec->begin(), length, new_rng); + my_naive_sample(start, end, length, input_vec, temp_vec, new_rng); + + temp_vec->shrink_to_fit(); + assert(temp_vec->size() == length); + std::shuffle(temp_vec->begin(), temp_vec->end(), new_rng); + } + + void print_data(const u64 *data, size_t size, size_t bench_precision, size_t find_step) { + const unsigned width = 12; + const unsigned items_in_line = 4; + const unsigned lines = bench_precision / items_in_line; + for (size_t i = 0; i < lines; i++) { + auto temp_sum = 0; + size_t index = i * items_in_line; + std::cout << i << ":\t" << std::setw(width) << ((1.0 * find_step) / (1.0 * data[index] / 1e9)); + temp_sum += data[index]; + for (size_t j = 1; j < items_in_line; j++) { + std::cout << ", " << std::setw(width) << ((1.0 * find_step) / (1.0 * data[index + j] / 1e9)); + temp_sum += data[index + j]; + } + std::cout << "|Average:\t" << ((1.0 * items_in_line * find_step) / (1.0 * temp_sum / 1e9)) << std::endl; + // std::cout << std::endl; + } + } +}// namespace testSmart diff --git a/Tests/smart_tests.hpp b/Tests/smart_tests.hpp new file mode 100644 index 0000000..b62043e --- /dev/null +++ b/Tests/smart_tests.hpp @@ -0,0 +1,688 @@ +#ifndef FILTERS_SMART_TESTS_HPP +#define FILTERS_SMART_TESTS_HPP + +#define PREVENT_PIPELINING (1) +#include "../Tests/wrappers.hpp" +// #include "PerfEvent.hpp" +#include +#include +#include +#include +#include + +// #include "timing.hpp" +// #include + +typedef std::chrono::nanoseconds ns; + +namespace testSmart { + constexpr size_t db_speeder = 1; + constexpr size_t ROUNDS = 9; + + size_t count_uniques(std::vector *v); + void vector_concatenate_and_shuffle(const std::vector *v1, const std::vector *v2, std::vector *res, std::mt19937_64 rng); + + void vector_concatenate_and_shuffle(const std::vector *v1, const std::vector *v2, std::vector *res); + + void weighted_vector_concatenate_and_shuffle(const std::vector *v_yes, const std::vector *v_uni, std::vector *res, double yes_div, std::mt19937_64 rng); + + size_t test_shuffle_function(const std::vector *v1, const std::vector *v2, std::vector *res); + + void print_data(const u64 *data, size_t size, size_t bench_precision, size_t find_step); + + + //Building elements vector + + std::mt19937_64 fill_vec_smart(std::vector *vec, size_t number_of_elements); + + void my_naive_sample(size_t start, size_t end, size_t length, const std::vector *input_vec, std::vector *temp_vec, std::mt19937_64 &rng); + + void fill_vec_by_samples(size_t start, size_t end, size_t length, const std::vector *input_vec, std::vector *temp_vec, std::mt19937_64 rng); + + void fill_vec_by_samples(size_t start, size_t end, size_t length, const std::vector *input_vec, std::vector *temp_vec); +}// namespace testSmart + +namespace testSmart { + template + void write_res_to_file_core(const Table *wrap_filter, size_t init_time, size_t filter_max_capacity, size_t lookup_reps, size_t bench_precision, const u64 *data, std::string file_prefix); + + template + void write_perf_res_to_file(const Table *wrap_filter, size_t init_time, size_t filter_max_capacity, size_t lookup_reps, size_t bench_precision, const u64 *data, std::string file_prefix, std::stringstream &add_ss, std::stringstream &uni_find_ss, std::stringstream &yes_find_ss); + + template + void FPR_test0_after_build(const Table *wrap_filter, const std::vector *v_add, const std::vector *v_find, size_t bench_precision); + + template + std::string FPR_parse_data_str_22(const Table *wrap_filter, const std::vector *v_add, const std::vector *v_find, size_t yes_res); + + inline size_t sysrandom(void *dst, size_t dstlen) { + char *buffer = reinterpret_cast(dst); + std::ifstream stream("/dev/urandom", std::ios_base::binary | std::ios_base::in); + stream.read(buffer, dstlen); + + return dstlen; + } + + template + __attribute__((noinline)) auto time_lookups(const Table *wrap_filter, const std::vector *element_set, size_t start, size_t end) -> ulong { + static volatile bool dummy; + bool x = 0; + + auto t0 = std::chrono::high_resolution_clock::now(); + for (size_t i = start; i < end; ++i) { + x ^= FilterAPI::Contain(element_set->at(i), wrap_filter); + // #if PREVENT_PIPELINING + // asm volatile( + // "rdtscp\n\t" + // "lfence" + // : + // : + // : "rax", "rcx", "rdx", "memory"); + // #endif + } + auto t1 = std::chrono::high_resolution_clock::now(); + + dummy = x; + return std::chrono::duration_cast(t1 - t0).count(); + } + + template + __attribute__((noinline)) auto time_insertions(Table *wrap_filter, const std::vector *element_set, size_t start, size_t end) -> ulong { + auto t0 = std::chrono::steady_clock::now(); + for (size_t i = start; i < end; ++i) { + FilterAPI
::Add(element_set->at(i), wrap_filter); + // #if PREVENT_PIPELINING + // asm volatile( + // "rdtscp\n\t" + // "lfence" + // : + // : + // : "rax", "rcx", "rdx", "memory"); + // #endif + } + // FilterAPI
::AddAll(*element_set, start, end, wrap_filter); + auto t1 = std::chrono::steady_clock::now(); + return std::chrono::duration_cast(t1 - t0).count(); + } + + /*template + __attribute__((noinline)) auto time_lookups_perf(const Table *wrap_filter, const std::vector *element_set, size_t start, size_t end, std::stringstream &ss, bool with_header) -> ulong { + static volatile bool dummy; + bool x = 0; + + PerfEvent e; + asm volatile( + "rdtscp\n\t" + "lfence" + : + : + : "rax", "rcx", "rdx", "memory"); + e.startCounters(); + // auto t0 = std::chrono::high_resolution_clock::now(); + for (size_t i = start; i < end; ++i) { + x ^= FilterAPI
::Contain(element_set->at(i), wrap_filter); + // #if PREVENT_PIPELINING + // asm volatile( + // "rdtscp\n\t" + // "lfence" + // : + // : + // : "rax", "rcx", "rdx", "memory"); + // #endif + } + // auto t1 = std::chrono::high_resolution_clock::now(); + dummy = x; + e.stopCounters(); + asm volatile( + "rdtscp\n\t" + "lfence" + : + : + : "rax", "rcx", "rdx", "memory"); + if (with_header) { + e.printReport(ss, end - start); + } else { + e.printReport_NoHeader(ss, end - start); + } + // return std::chrono::duration_cast(t1 - t0).count(); + return e.get_time(); + } + + template + __attribute__((noinline)) auto time_insertions_perf(Table *wrap_filter, const std::vector *element_set, size_t start, size_t end, std::stringstream &ss) -> ulong { + PerfEvent e; + e.startCounters(); + // auto t0 = std::chrono::high_resolution_clock::now(); + for (size_t i = start; i < end; ++i) { + FilterAPI
::Add(element_set->at(i), wrap_filter); + // #if PREVENT_PIPELINING + // asm volatile( + // "rdtscp\n\t" + // "lfence" + // : + // : + // : "rax", "rcx", "rdx", "memory"); + // #endif + } + // FilterAPI
::AddAll(*element_set, start, end, wrap_filter); + // auto t1 = std::chrono::high_resolution_clock::now(); + e.stopCounters(); + asm volatile( + "rdtscp\n\t" + "lfence" + : + : + : "rax", "rcx", "rdx", "memory"); + if (start == 0) { + e.printReport(ss, end - start); + } else { + e.printReport_NoHeader(ss, end - start); + } + // return std::chrono::duration_cast(t1 - t0).count(); + return e.get_time(); + // return std::chrono::duration_cast(t1 - t0).count(); + } + */ + template + __attribute__((noinline)) auto time_deletions(Table *wrap_filter, const std::vector *element_set, size_t start, size_t end) -> ulong { + if (!(FilterAPI
::get_functionality(wrap_filter) & 4)) { + //FIXME: UNCOMMENT! + std::cout << FilterAPI
::get_name(wrap_filter) << " does not support deletions." << std::endl; + return 0; + } + + auto t0 = std::chrono::steady_clock::now(); + for (size_t i = start; i < end; ++i) { + FilterAPI
::Remove(element_set->at(i), wrap_filter); + } + auto t1 = std::chrono::steady_clock::now(); + return std::chrono::duration_cast(t1 - t0).count(); + } + + template + void benchmark_single_round_np_incremental(Table *wrap_filter, const std::vector *add_vec, const std::vector *find_vec, size_t round_counter, size_t benchmark_precision, u64 *data, bool to_print, std::stringstream &add_ss, std::stringstream &uni_find_ss, std::stringstream &yes_find_ss) { + /* switch between the commented lines with "time_time_insertions" and "time_insertions_perf" to also get a csv file with data on the performances counters.*/ + const size_t find_step = find_vec->size() / benchmark_precision; + size_t add_step = add_vec->size() / benchmark_precision; + const size_t true_find_step = add_step; + size_t add_start = round_counter * add_step; + + + auto insertion_time = time_insertions(wrap_filter, add_vec, add_start, add_start + add_step); + // auto insertion_time = time_insertions_perf(wrap_filter, add_vec, add_start, add_start + add_step, add_ss); + asm volatile( + "rdtscp\n\t" + "lfence" + : + : + : "rax", "rcx", "rdx", "memory"); + auto find_start = find_step * round_counter; + auto uniform_lookup_time = time_lookups(wrap_filter, find_vec, find_start, find_start + find_step); + // auto uniform_lookup_time = time_lookups_perf(wrap_filter, find_vec, find_start, find_start + find_step, uni_find_ss, round_counter == 0); + asm volatile( + "rdtscp\n\t" + "lfence" + : + : + : "rax", "rcx", "rdx", "memory"); + // auto true_lookup_time = time_lookups(wrap_filter, add_vec, del_start, del_start + add_step); + std::vector temp_vec; + fill_vec_by_samples(0, add_start + add_step, true_find_step, add_vec, &temp_vec); + asm volatile( + "rdtscp\n\t" + "lfence" + : + : + : "rax", "rcx", "rdx", "memory"); + auto true_lookup_time = time_lookups(wrap_filter, &temp_vec, 0, true_find_step); + // auto true_lookup_time = time_lookups_perf(wrap_filter, &temp_vec, 0, true_find_step, yes_find_ss, round_counter == 0); + asm volatile( + "rdtscp\n\t" + "lfence" + : + : + : "rax", "rcx", "rdx", "memory"); + + size_t index = 4 * (round_counter); + data[index + 0] = insertion_time; + data[index + 1] = uniform_lookup_time; + data[index + 2] = true_lookup_time; + data[index + 3] = 0; + + if (to_print) { + constexpr size_t width = 12; + std::cout << round_counter << ": \t"; + std::cout << std::setw(width) << std::left << ((1.0 * add_step) / (1.0 * data[index + 0] / 1e9)) << ", "; + std::cout << std::setw(width) << std::left << ((1.0 * find_step) / (1.0 * data[index + 1] / 1e9)) << ", "; + std::cout << std::setw(width) << std::left << ((1.0 * add_step) / (1.0 * data[index + 2] / 1e9)) << ", "; + std::cout << std::setw(width) << std::left << ((1.0 * add_step) / (1.0 * data[index + 3] / 1e9)) << std::endl; + } + } + + template + void Bench_res_to_file_incremental_22(size_t filter_max_capacity, size_t bench_precision, const std::vector *add_vec, const std::vector *lookup_vec, std::string file_prefix, bool to_print = false) { + const size_t data_size = (bench_precision + 2) * 4; + assert(data_size < 1024); + u64 data[data_size]; + std::fill(data, data + data_size, 0); + // std::cout << "H0!" << std::endl; + auto t0 = std::chrono::high_resolution_clock::now(); + Table filter = FilterAPI
::ConstructFromAddCount(filter_max_capacity); + auto t1 = std::chrono::high_resolution_clock::now(); + // std::cout << "Here!" << std::endl; + auto init_time = std::chrono::duration_cast(t1 - t0).count(); + Table *wrap_filter = &filter; + + std::string filter_name = FilterAPI
::get_name(wrap_filter); + if (to_print) + std::cout << "filter_name: " << filter_name << std::endl; + // benchmark_round0_np(wrap_filter, add_vec, lookup_vec, bench_precision, rng, data, to_print); + + if (to_print) std::cout << std::string(80, '=') << std::endl; + std::stringstream add_ss, uni_find_ss, yes_find_ss; + for (size_t round = 0; round < bench_precision; ++round) { + benchmark_single_round_np_incremental(wrap_filter, add_vec, lookup_vec, round, bench_precision, data, to_print, add_ss, uni_find_ss, yes_find_ss); + // if (to_print) std::cout << std::string(80, '=') << std::endl; + asm volatile( + "rdtscp\n\t" + "lfence" + : + : + : "rax", "rcx", "rdx", "memory"); + } + if (to_print) std::cout << std::string(80, '=') << std::endl; + + //UNCOMMENT me to get CSV files. + // write_perf_res_to_file(wrap_filter, init_time, filter_max_capacity, lookup_vec->size(), bench_precision, data, file_prefix, add_ss, uni_find_ss, yes_find_ss); + write_res_to_file_core(wrap_filter, init_time, filter_max_capacity, lookup_vec->size(), bench_precision, data, file_prefix); + + if (to_print) + FPR_test0_after_build(wrap_filter, add_vec, lookup_vec, bench_precision); + } + + template + void write_perf_res_to_file(const Table *wrap_filter, size_t init_time, size_t filter_max_capacity, size_t lookup_reps, size_t bench_precision, const u64 *data, std::string file_prefix, std::stringstream &add_ss, std::stringstream &uni_find_ss, std::stringstream &yes_find_ss) { + std::string filter_name = FilterAPI
::get_name(wrap_filter); + std::string file_name = file_prefix + filter_name + ".csv"; + std::cout << "file_name: " << file_name << std::endl; + std::fstream file(file_name, std::fstream::in | std::fstream::out | std::fstream::app); + // file << std::endl; + // std::fstream file(file_name, std::fstream::in | std::fstream::out | std::fstream::trunc); + // std::string str_add = add_ss.str(); + // std::cout << std::string(80, '@') << std::endl; + // std::cout << str_add << std::endl; + // std::cout << std::string(80, '@') << std::endl; + file << "add, uni_find, yes_find" << std::endl; + for (size_t i = 0; i < bench_precision + 1; i++) { + std::string temp[3]; + std::getline(add_ss, temp[0]); + std::getline(uni_find_ss, temp[1]); + std::getline(yes_find_ss, temp[2]); + file << temp[0] << ","; + file << temp[1] << ","; + file << temp[2] << std::endl; + } + file.close(); + } + + template + void write_res_to_file_core(const Table *wrap_filter, size_t init_time, size_t filter_max_capacity, size_t lookup_reps, size_t bench_precision, const u64 *data, std::string file_prefix) { + std::string filter_name = FilterAPI
::get_name(wrap_filter); + std::string file_name = file_prefix + filter_name; + std::cout << "file_name: " << file_name << std::endl; + std::fstream file(file_name, std::fstream::in | std::fstream::out | std::fstream::app); + file << endl; + // std::fstream file(file_name, std::fstream::in | std::fstream::out | std::fstream::trunc); + file << "# This is a comment." << std::endl; + file << "NAME\t" << filter_name << std::endl; + file << "INIT_TIME(NANO_SECOND)\t" << init_time << std::endl; + file << "FILTER_MAX_CAPACITY\t" << filter_max_capacity << std::endl; + file << "BYTE_SIZE\t" << FilterAPI
::get_byte_size(wrap_filter) << std::endl; + file << "NUMBER_OF_LOOKUP\t" << lookup_reps << std::endl; + file << std::endl; + file << "# add, uniform lookup, true_lookup, deletions. Each columns unit is in nano second." << std::endl; + file << std::endl; + file << "BENCH_START" << std::endl; + for (size_t i = 0; i < bench_precision; i++) { + size_t index = i * 4; + file << data[index]; + for (size_t j = 1; j < 4; j++) { + file << ", " << data[index + j]; + } + file << std::endl; + } + file << std::endl; + file << "BENCH_END" << std::endl; + file << "END_OF_FILE!" << std::endl; + file.close(); + } + + template + void write_build_res_to_file(const Table *wrap_filter, size_t init_time, size_t built_time, size_t filter_max_capacity, std::string file_prefix) { + std::string filter_name = FilterAPI
::get_name(wrap_filter); + std::string file_name = file_prefix + filter_name; + std::cout << "file_name: " << file_name << std::endl; + std::fstream file(file_name, std::fstream::in | std::fstream::out | std::fstream::app); + file << endl; + // std::fstream file(file_name, std::fstream::in | std::fstream::out | std::fstream::trunc); + file << "# This is a comment." << std::endl; + file << "# Results for build." << std::endl; + file << "NAME\t" << filter_name << std::endl; + file << "INIT_TIME(NANO_SECOND)\t" << init_time << std::endl; + file << "BUILT_TIME(NANO_SECOND)\t" << built_time << std::endl; + file << "FILTER_MAX_CAPACITY(Actually-number-of-items-in-the-filter)\t" << filter_max_capacity << std::endl; + file << "BYTE_SIZE\t" << FilterAPI
::get_byte_size(wrap_filter) << std::endl; + file << std::endl; + file << "END_OF_FILE!" << std::endl; + file.close(); + } + + + template + void bench_build_to_file(size_t filter_max_capacity, const std::vector *v_add, std::string file_prefix) { + auto t0 = std::chrono::high_resolution_clock::now(); + Table filter = FilterAPI
::ConstructFromAddCount(filter_max_capacity); + auto t1 = std::chrono::high_resolution_clock::now(); + auto init_time = std::chrono::duration_cast(t1 - t0).count(); + Table *wrap_filter = &filter; + std::string filter_name = FilterAPI
::get_name(wrap_filter); + auto is_static = (FilterAPI
::get_functionality(wrap_filter) == 1); + auto built_time = time_insertions(wrap_filter, v_add, 0, v_add->size()); + write_build_res_to_file(wrap_filter, init_time, built_time, filter_max_capacity, file_prefix); + } + + template + size_t bench_build_to_file22(size_t filter_max_capacity, const std::vector *v_add) { + auto t0 = std::chrono::high_resolution_clock::now(); + Table filter = FilterAPI
::ConstructFromAddCount(filter_max_capacity); + auto t1 = std::chrono::high_resolution_clock::now(); + auto init_time = std::chrono::duration_cast(t1 - t0).count(); + Table *wrap_filter = &filter; + // std::string filter_name = FilterAPI
::get_name(wrap_filter); + // auto is_static = (FilterAPI
::get_functionality(wrap_filter) == 1); + auto built_time = time_insertions(wrap_filter, v_add, 0, v_add->size()); + return built_time; + } + //////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////// + + /* template +size_t count_finds(Table *wrap_filter, const std::vector *vec) { + size_t counter = 0; + for (size_t i = 0; i < vec->size(); i++) { counter += FilterAPI
::Contain(vec->at(i), wrap_filter); + } + return counter; +} */ + + template + size_t count_finds(const Table *wrap_filter, const std::vector *vec) { + size_t counter = 0; + for (size_t i = 0; i < vec->size(); i++) { counter += FilterAPI
::Contain(vec->at(i), wrap_filter); } + return counter; + } + + /** + * @brief Get the FPR (false positive probability) test0 object. + * + * @tparam Table + * @param wrap_filter + * @param yes_vec + * @return std::tuple + */ + template + size_t get_FPR_test0(Table *wrap_filter, const std::vector *v_add, const std::vector *v_find) { + /**Insertion*/ + for (auto el : *v_add) { + FilterAPI
::Add(el, wrap_filter); + } + size_t counter = 0; + for (auto el : *v_add) { + counter++; + if (!FilterAPI
::Contain(el, wrap_filter)) { + auto name = FilterAPI
::get_name(wrap_filter); + std::cout << "Filter (" << name << ") has2 a false negative. exiting." << std::endl; + std::cout << "counter: \t" << counter << std::endl; + FilterAPI
::Contain(el, wrap_filter); + assert(0); + exit(-42); + } + } + + size_t yes_res = count_finds(wrap_filter, v_find); + return yes_res; + } + + template + void FPR_test0_after_build(const Table *wrap_filter, const std::vector *v_add, const std::vector *v_find, size_t bench_precision) { + // Table filter = FilterAPI
::ConstructFromAddCount(v_add->size()); + // Table *wrap_filter = &filter; + size_t counter = 0; + const size_t lim = v_add->size() / bench_precision * bench_precision; + for (auto el : *v_add) { + counter++; + if (counter >= lim) + break; + if (!FilterAPI
::Contain(el, wrap_filter)) { + auto name = FilterAPI
::get_name(wrap_filter); + std::cout << "Filter (" << name << ") has3 a false negative. exiting." << std::endl; + std::cout << "counter: \t" << counter << std::endl; + FilterAPI
::Contain(el, wrap_filter); + assert(0); + exit(-42); + } + } + + size_t yes_res = count_finds(wrap_filter, v_find); + // auto yes_res = get_FPR_test0(wrap_filter, v_add, v_find); + + auto s = FPR_parse_data_str_22(wrap_filter, v_add, v_find, yes_res); + std::cout << "s:\n" + << s << std::endl; + // FPR_printer(wrap_filter, v_add, v_find, yes_res); + } + + template + std::string FPR_parse_data_str_22(const Table *wrap_filter, const std::vector *v_add, const std::vector *v_find, size_t yes_res) { + size_t true_counter = yes_res; + // size_t true_counter = yes_res; + assert(true_counter <= v_find->size()); + size_t false_counter = v_find->size() - yes_res; + const size_t filter_max_capacity = v_add->size(); + const size_t filter_true_cap = FilterAPI
::get_cap(wrap_filter); + auto filter_id = FilterAPI
::get_ID(wrap_filter); + bool skip = (filter_id == BBF) or (filter_id == SIMD_fixed); + if ((!skip) and (filter_max_capacity != filter_true_cap)) { + std::cout << "filter_name: \t" << FilterAPI
::get_name(wrap_filter) << std::endl; + std::cout << "filter_max_cap: \t" << filter_max_capacity << std::endl; + std::cout << "filter_true_cap: \t" << filter_true_cap << std::endl; + } + std::string filter_name = FilterAPI
::get_name(wrap_filter); + const size_t filter_byte_size = FilterAPI
::get_byte_size(wrap_filter); + double positive_ratio = 1.0 * true_counter / (false_counter + true_counter); + double bpi = filter_byte_size * 8.0 / filter_max_capacity; + double optimal_bits_for_err = -log2(positive_ratio); + double bpi_diff = (bpi - optimal_bits_for_err); + double bpi_ratio = (bpi / optimal_bits_for_err); + double fpp_mult_factor = positive_ratio / (1.0 / 256); + double data[] = {positive_ratio, bpi, optimal_bits_for_err, bpi_diff, bpi_ratio, fpp_mult_factor}; + std::stringstream ss; + ss << std::setw(34) << std::left << filter_name << "\t, " << std::setw(12) << std::left << filter_byte_size; + for (auto &&x : data) { ss << ", " << std::setw(12) << std::left << x; } + ss << std::endl; + std::string line = ss.str(); + return line; + } + + template + std::string FPR_test_as_str(Table *wrap_filter, const std::vector *v_add, const std::vector *v_find) { + auto yes_res = get_FPR_test0(wrap_filter, v_add, v_find); + size_t true_counter = yes_res; + assert(true_counter <= v_find->size()); + size_t false_counter = v_find->size() - yes_res; + const size_t filter_max_capacity = v_add->size(); + const size_t filter_true_cap = FilterAPI
::get_cap(wrap_filter); + auto filter_id = FilterAPI
::get_ID(wrap_filter); + bool skip = (filter_id == BBF) or (filter_id == SIMD_fixed); + if ((!skip) and (filter_max_capacity != filter_true_cap)) { + // UNCOMMENT ME!!! FIXME!!! + std::cout << "filter_name: \t" << FilterAPI
::get_name(wrap_filter) << std::endl; + std::cout << "filter_max_cap: \t" << filter_max_capacity << std::endl; + std::cout << "filter_true_cap: \t" << filter_true_cap << std::endl; + } + std::string filter_name = FilterAPI
::get_name(wrap_filter); + const size_t filter_byte_size = FilterAPI
::get_byte_size(wrap_filter); + double positive_ratio = 1.0 * true_counter / (false_counter + true_counter); + double bpi = filter_byte_size * 8.0 / filter_max_capacity; + double optimal_bits_for_err = -log2(positive_ratio); + double bpi_diff = (bpi - optimal_bits_for_err); + double bpi_ratio = (bpi / optimal_bits_for_err); + // double fpp_mult_factor = positive_ratio / (1.0 / 256); + double data[] = {positive_ratio, bpi, optimal_bits_for_err, bpi_diff, bpi_ratio}; + std::stringstream ss; + ss << std::setw(34) << std::left << filter_name << "\t, " << std::setw(12) << std::left << filter_byte_size; + for (auto &&x : data) { ss << ", " << std::setw(12) << std::left << x; } + ss << std::endl; + std::string line = ss.str(); + return line; + // std::cout << line;// << std::endl; + } + + + template + void FPR_test(const std::vector *v_add, const std::vector *v_find, std::string path, bool create_file = false) { + + + const size_t filter_max_capacity = v_add->size(); + Table filter = FilterAPI
::ConstructFromAddCount(v_add->size()); + Table *wrap_filter = &filter; + auto line = FPR_test_as_str(wrap_filter, v_add, v_find); + + std::fstream file(path, std::fstream::in | std::fstream::out | std::fstream::app); + file << line; + file.close(); + + // std::cout << line << std::endl; + } + + template + void profile_benchmark(Table *wrap_filter, const std::vector *> *elements) { + auto add_vec = elements->at(0); + auto find_vec = elements->at(1); + auto delete_vec = elements->at(2); + + auto insertion_time = time_insertions(wrap_filter, add_vec, 0, add_vec->size()); + + printf("insertions done\n"); + fflush(stdout); + ulong uniform_lookup_time = 0; + ulong true_lookup_time = 0; + // size_t true_lookup_time = 0; + char buf[1024]; + // sprintf(buf, "perf record -p %d &", getpid()); + // sprintf(buf, "perf stat -p %d -e cycles -e instructions -e cache-misses -e cache-references -e L1-dcache-load-misses -e L1-dcache-loads -e LLC-load-misses -e LLC-loads -e dTLB-load-misses -e dTLB-loads -e node-load-misses -e node-loads -e branches -e branch-misses &", getpid()); + sprintf(buf, "perf stat -p %d \ + -e cycles \ + -e instructions \ + -e cache-misses \ + -e cache-references \ + -e L1-dcache-load-misses \ + -e L1-dcache-loads \ + -e LLC-load-misses \ + -e LLC-loads \ + -e dTLB-load-misses \ + -e dTLB-loads \ + -e node-load-misses \ + -e node-loads \ + -e alignment-faults \ + -e branches \ + -e branch-misses \ + -e branch-loads \ + -e branch-loads-misses \ + &", + getpid()); + // sprintf(buf, "perf stat -p %d -e cycles -e instructions -e cache-misses -e cache-references -e L1-dcache-load-misses -e L1-dcache-loads -e LLC-load-misses -e LLC-loads -e dTLB-load-misses -e dTLB-loads -e node-load-misses -e node-loads -e branches -e branch-misses -e uops_executed.stall_cycles &", getpid()); + auto junk = system(buf); + for (int i = 0; i < 16; i++) { + // true_lookup_time = time_lookups(wrap_filter, add_vec, 0, add_step); + uniform_lookup_time += time_lookups(wrap_filter, find_vec, 0, find_vec->size()); + // true_lookup_time += time_lookups(wrap_filter, add_vec, 0, add_vec->size()); + // uniform_lookup_time += time_lookups(wrap_filter, find_vec, 0, find_vec->size()); + } + // printf("%zd\n", 500 * add_step); + printf("%zd\n", 16 * find_vec->size()); + // printf("%zd\n", 16 * add_vec->size()); + // printf("%zd\n", 8 * find_vec->size() + 8 * add_vec->size() ); + // printf("%zd\n", 500 * true_find_step); + exit(0); + } + + inline std::string get_int_with_commas(uint64_t x) { + auto s = std::to_string(x); + + if (s.size() <= 3) + return s; + + + std::string res; + std::string prefix = s; + // const size_t s_size = s.size(); + while (prefix.size() > 3) { + size_t index = prefix.size() - 3; + std::string temp = prefix.substr(index, 3); + res = "," + temp + res; + + prefix = prefix.substr(0, index); + } + res = prefix + res; + return res; + } + + template + void profile_benchmark_cache(Table *wrap_filter, const std::vector *> *elements) { + auto add_vec = elements->at(0); + auto find_vec = elements->at(1); + // auto delete_vec = elements->at(2); + + auto insertion_time = time_insertions(wrap_filter, add_vec, 0, add_vec->size()); + + printf("insertions done\n"); + fflush(stdout); + ulong uniform_lookup_time = 0; + // ulong true_lookup_time = 0; + // size_t true_lookup_time = 0; + char buf[1024]; + + + // sprintf(buf, "perf stat -p %d + sprintf(buf, "perf stat -p %d \ + -e cpu/event=0x2e,umask=0x41,name=LONGEST_LAT_CACHE.MISS/ \ + & ", + getpid()); + + /* -e cache-misses \ + -e cache-references \ + -e L1-dcache-load-misses \ + -e L1-dcache-loads \ + -e LLC-load-misses \ + -e LLC-loads \ + -e dTLB-load-misses \ + -e dTLB-loads \ + -e node-load-misses \ + -e node-loads \ + -e branches \ + -e branch-misses \ + */ + auto junk = system(buf); + constexpr size_t reps = 16; + for (size_t i = 0; i < reps; i++) { + uniform_lookup_time += time_lookups(wrap_filter, find_vec, 0, find_vec->size()); + } + // printf("%zd\n", 16 * find_vec->size()); + std::cout << "Number of lookups: \t" << get_int_with_commas(reps * find_vec->size()) << std::endl; + printf("Number of lookups: %zd\n", reps * find_vec->size()); + exit(0); + } +}// namespace testSmart + +#endif// FILTERS_CON_TESTS_HPP diff --git a/Tests/wrappers.hpp b/Tests/wrappers.hpp new file mode 100644 index 0000000..c4c67b2 --- /dev/null +++ b/Tests/wrappers.hpp @@ -0,0 +1,959 @@ +/* Taken from + * https://github.com/FastFilter/fastfilter_cpp + * */ + +//#pragma once +#ifndef FILTERS_WRAPPERS_HPP +#define FILTERS_WRAPPERS_HPP +// #define CONTAIN_ATTRIBUTES inline +#define CONTAIN_ATTRIBUTES __attribute__((always_inline)) +// #define CONTAIN_ATTRIBUTES __attribute__((noinline)) + + +#include + +#include "../Bloom_Filter/bloom.hpp" +#include "../Bloom_Filter/simd-block-fixed-fpp.h" +#include "../Bloom_Filter/Impala512.h" +#include "../Bloom_Filter/simd-block.h" +#include "../Prefix-Filter/min_pd256.hpp" +#include "../TC-Shortcut/TC-shortcut.hpp" +#include "../cuckoofilter/src/cuckoofilter.h" +#include "../cuckoofilter/src/cuckoofilter_stable.h" +// #include "linux-perf-events.h" +#include + +enum filter_id { + Trivial_id, + CF, + SIMD, + BBF, + BBF_gen_id, + SIMD_fixed, + BBF_Flex, + prefix_id, + TC_shortcut_id, + VQF_Wrapper_id, + cf1ma_id, + cf3ma_id, + cf_stable_id, + cf_flex_id, + bloom_id, + bf_ma_id, + bloomSimple_id, + bloomTrivial_id, + bloomPower_id, + bloomPowerDoubleHash_id, + simple_bbf_id, +}; + +template +struct FilterAPI { +}; + +class TrivialFilter { +public: + TrivialFilter(size_t max_items) { + } + + __attribute__((always_inline)) inline static constexpr uint16_t fixed_reduce(uint16_t hash) { + // http://lemire.me/blog/2016/06/27/a-fast-alternative-to-the-modulo-reduction/ + return (uint16_t) (((uint32_t) hash * 6400) >> 16); + } + + + inline auto Find(const u64 &item) const -> bool { + return true; + } + + void Add(const u64 &item) {} + + auto get_capacity() const -> size_t { + return -1; + } + + auto get_name() const -> std::string { + return "Trivial-Filter "; + } + + auto get_byte_size() const -> size_t { + return 0; + } + + auto get_cap() const -> size_t { + return -1; + } +}; + +template<> +struct FilterAPI { + using Table = TrivialFilter; + + static Table ConstructFromAddCount(size_t add_count) { + return Table(add_count); + } + + static void Add(uint64_t key, Table *table) { + table->Add(key); + } + CONTAIN_ATTRIBUTES static bool Contain(uint64_t key, const Table *table) { + return table->Find(key); + } + + static void Remove(uint64_t key, Table *table) { + throw std::runtime_error("Unsupported"); + } + + static std::string get_name(const Table *table) { + return table->get_name(); + } + + static auto get_functionality(const Table *table) -> uint32_t { + return 0; + } + static auto get_ID(const Table *table) -> filter_id { + return Trivial_id; + } + + static size_t get_byte_size(const Table *table) { + return table->get_byte_size(); + } + + static size_t get_cap(const Table *table) { + return table->get_cap(); + } +}; + + +template class TableType, typename HashFamily> +struct FilterAPI> { + using Table = cuckoofilter::CuckooFilter; + + static Table ConstructFromAddCount(size_t add_count) { + return Table(add_count); + } + + static void Add(uint64_t key, Table *table) { + if (table->Add(key) != cuckoofilter::Ok) { + std::cerr << "Cuckoo filter is too full. Insertion of the element (" << key << ") failed.\n"; + std::cout << get_info(table).str() << std::endl; + + throw std::logic_error("The filter is too small to hold all of the elements"); + } + } + + static bool Add_attempt(uint64_t key, Table *table) { + if (table->Add(key) != cuckoofilter::Ok) { + std::cout << get_info(table).str() << std::endl; + return false; + // throw std::logic_error("The filter is too small to hold all of the elements"); + } + return true; + } + + static void Remove(uint64_t key, Table *table) { + table->Delete(key); + } + + CONTAIN_ATTRIBUTES static bool Contain(uint64_t key, const Table *table) { + return (0 == table->Contain(key)); + } + + static std::string get_name(const Table *table) { + auto ss = table->Info(); + std::string temp = "PackedHashtable"; + if (ss.find(temp) != std::string::npos) { + return "CF-ss"; + } + if (bits_per_item == 8) { + // return "Cuckoo-8-mod-m1"; + return "Cuckoo-8"; + } else if (bits_per_item == 12) { + return "Cuckoo-12"; + // return "Cuckoo-12-mod-m1"; + } else if (bits_per_item == 16) + return "Cuckoo-16"; + else if (bits_per_item == 32) { + return "Cuckoo-32"; + } + return "Cuckoo-?"; + // return "Cuckoo-" + std::to_string(bits_per_item); + } + + static auto get_info(const Table *table) -> std::stringstream { + std::string state = table->Info(); + std::stringstream ss; + ss << state; + return ss; + // std::cout << state << std::endl; + } + + /** + * Returns int indicating which function can the filter do. + * 1 is for lookups. + * 2 is for adds. + * 4 is for deletions. + */ + static auto get_functionality(const Table *table) -> uint32_t { + return 7; + } + + static auto get_ID(const Table *table) -> filter_id { + return CF; + } + + static size_t get_byte_size(const Table *table) { + return table->SizeInBytes(); + } + + static size_t get_cap(const Table *table) { + return table->get_cap(); + } +}; +template class TableType, typename HashFamily> +struct FilterAPI> { + using Table = cuckoofilter::CuckooFilterStable; + + static Table ConstructFromAddCount(size_t add_count) { + return Table(add_count); + } + + static void Add(uint64_t key, Table *table) { + if (table->Add(key) != cuckoofilter::Ok) { + std::cerr << "Stable Cuckoo filter is too full. Insertion of the element (" << key << ") failed.\n"; + std::cout << get_info(table).str() << std::endl; + + throw std::logic_error("The filter is too small to hold all of the elements"); + } + } + + static void Remove(uint64_t key, Table *table) { + table->Delete(key); + } + + CONTAIN_ATTRIBUTES static bool Contain(uint64_t key, const Table *table) { + return (0 == table->Contain(key)); + } + + static std::string get_name(const Table *table) { + auto ss = table->Info(); + std::string temp = "PackedHashtable"; + if (ss.find(temp) != std::string::npos) { + return "CF-ss"; + } + if (bits_per_item == 8) { + // return "Cuckoo-8-mod-m1"; + return "CuckooStable-8"; + } else if (bits_per_item == 12) { + return "CuckooStable-12"; + } else if (bits_per_item == 16) + return "CuckooStable-16"; + else if (bits_per_item == 32) { + return "CuckooStable-32"; + } + return "Cuckoo-?"; + } + + static auto get_info(const Table *table) -> std::stringstream { + std::string state = table->Info(); + std::stringstream ss; + ss << state; + return ss; + // std::cout << state << std::endl; + } + + /** + * Returns int indicating which function can the filter do. + * 1 is for lookups. + * 2 is for adds. + * 4 is for deletions. + */ + static auto get_functionality(const Table *table) -> uint32_t { + return 7; + } + + static auto get_ID(const Table *table) -> filter_id { + return cf_stable_id; + } + static size_t get_byte_size(const Table *table) { + return table->SizeInBytes(); + } + + static size_t get_cap(const Table *table) { + return table->get_cap(); + } + + static double get_eLoad(const Table *table) { + return table->get_effective_load(); + } +}; + +template<> +struct FilterAPI> { + using Table = SimdBlockFilter<>; + + static Table ConstructFromAddCount(size_t add_count) { + Table ans(ceil(log2(add_count * 8.0 / CHAR_BIT))); + return ans; + } + + static void Add(uint64_t key, Table *table) { + table->Add(key); + } + + CONTAIN_ATTRIBUTES static bool Contain(uint64_t key, const Table *table) { + return table->Find(key); + } + + static void Remove(uint64_t key, Table *table) { + throw std::runtime_error("Unsupported"); + } + + static std::string get_name(const Table *table) { + return "SimdBlockFilter"; + } + + static auto get_info(const Table *table) -> std::stringstream { + assert(false); + std::stringstream ss; + return ss; + } + + /** + * Returns int indicating which function can the filter do. + * 1 is for lookups. + * 2 is for adds. + * 4 is for deletions. + */ + static auto get_functionality(const Table *table) -> uint32_t { + return 3; + } + static auto get_ID(const Table *table) -> filter_id { + return BBF; + } + + static size_t get_byte_size(const Table *table) { + return table->SizeInBytes(); + } + + static size_t get_cap(const Table *table) { + return table->get_cap(); + } +}; + + +template<> +struct FilterAPI> { + using Table = SimdBlockFilterFixed<>; + + static Table ConstructFromAddCount(size_t add_count) { + Table ans(ceil(add_count * 8.0 / CHAR_BIT)); + return ans; + } + + static void Add(uint64_t key, Table *table) { + table->Add(key); + } + + CONTAIN_ATTRIBUTES static bool Contain(uint64_t key, const Table *table) { + return table->Find(key); + } + + static void Remove(uint64_t key, Table *table) { + throw std::runtime_error("Unsupported"); + } + + static std::string get_name(const Table *table) { + return "BBF-Fixed"; + } + + static auto get_info(const Table *table) -> std::stringstream { + assert(false); + std::stringstream ss; + return ss; + } + + /** + * Returns int indicating which function can the filter do. + * 1 is for lookups. + * 2 is for adds. + * 4 is for deletions. + */ + static auto get_functionality(const Table *table) -> uint32_t { + return 3; + } + static auto get_ID(const Table *table) -> filter_id { + return SIMD_fixed; + } + static size_t get_byte_size(const Table *table) { + return table->SizeInBytes(); + } + + static size_t get_cap(const Table *table) { + return table->get_cap(); + } +}; + +template<> +struct FilterAPI> { + using Table = Impala512<>; + + static Table ConstructFromAddCount(size_t add_count) { + return Table(add_count); + // return ans; + } + + static void Add(uint64_t key, Table *table) { + table->Add(key); + } + + CONTAIN_ATTRIBUTES static bool Contain(uint64_t key, const Table *table) { + return table->Find(key); + } + + static void Remove(uint64_t key, Table *table) { + throw std::runtime_error("Unsupported"); + } + + static std::string get_name(const Table *table) { + return "Impala512"; + } + + static auto get_info(const Table *table) -> std::stringstream { + assert(false); + std::stringstream ss; + return ss; + } + + /** + * Returns int indicating which function can the filter do. + * 1 is for lookups. + * 2 is for adds. + * 4 is for deletions. + */ + static auto get_functionality(const Table *table) -> uint32_t { + return 3; + } + static auto get_ID(const Table *table) -> filter_id { + return SIMD_fixed; + } + static size_t get_byte_size(const Table *table) { + return table->SizeInBytes(); + } + + static size_t get_cap(const Table *table) { + return table->get_cap(); + } +}; + + +template<> +struct FilterAPI { + using Table = TC_shortcut; + // using Table = dict512; + + static Table ConstructFromAddCount(size_t add_count) { + constexpr float load = .935; + return Table(add_count, load); + } + + static void Add(uint64_t key, Table *table) { + if (!table->insert(key)) { + std::cout << table->info() << std::endl; + // std::cout << "max_load: \t" << 0.945 << std::endl; + throw std::logic_error(table->get_name() + " is too small to hold all of the elements"); + } + } + + static bool Add_attempt(uint64_t key, Table *table) { + if (!table->insert(key)) { + std::cout << "load when failed: \t" << table->get_effective_load() << std::endl; + std::cout << table->info() << std::endl; + return false; + } + return true; + } + + static void Remove(uint64_t key, Table *table) { + // throw std::runtime_error("Unsupported"); + table->remove(key); + } + + CONTAIN_ATTRIBUTES static bool Contain(uint64_t key, const Table *table) { + // std::cout << "here!!!" << std::endl; + return table->lookup(key); + // return table->lookup_consecutive_only_body(key); + // return table->lookup_consecutive(key); + } + + static std::string get_name(const Table *table) { + return table->get_name(); + } + + static auto get_info(const Table *table) -> std::stringstream { + std::stringstream ss; + ss << ""; + return ss; + // return table->get_extended_info(); + } + + static auto get_functionality(const Table *table) -> uint32_t { + return 7; + } + + static auto get_ID(const Table *table) -> filter_id { + return TC_shortcut_id; + } + + static size_t get_byte_size(const Table *table) { + return table->get_byte_size(); + } + + static size_t get_cap(const Table *table) { + return table->get_cap(); + } + + static double get_eLoad(const Table *table) { + return table->get_effective_load(); + } +}; + + +template +inline size_t get_l2_slots(size_t l1_items, const double overflowing_items_ratio, const float loads[2]) { + const double expected_items_reaching_next_level = l1_items * overflowing_items_ratio; + size_t slots_in_l2 = (expected_items_reaching_next_level / loads[1]); + return slots_in_l2; +} + +template<> +inline size_t get_l2_slots>(size_t l1_items, const double overflowing_items_ratio, const float loads[2]) { + // const double expected_items_reaching_next_level = l1_items * 0.0752; + // const double spare_workload = 0.0752 / 0.0586; + // size_t slots_in_l2 = std::ceil(expected_items_reaching_next_level); + // return slots_in_l2; + constexpr auto expected_items95 = 0.0586; + constexpr auto expected_items100 = 0.07952; + constexpr auto expected_items105 = 0.1031; + constexpr auto spare_workload = 0.94; + constexpr auto safety = 1.08; + constexpr auto factor95 = safety * expected_items95 / spare_workload; + constexpr auto factor100 = safety * expected_items100 / spare_workload; + constexpr auto factor105 = safety * expected_items105 / spare_workload; + // const double expected_items_reaching_next_level = l1_items * (0.06 / 0.9); + const double expected_items_reaching_next_level = l1_items * factor95; + return expected_items_reaching_next_level; +} + +template<> +inline size_t get_l2_slots(size_t l1_items, const double overflowing_items_ratio, const float loads[2]) { + constexpr auto expected_items95 = 0.0586; + constexpr auto expected_items100 = 0.07952; + constexpr auto expected_items105 = 0.1031; + constexpr auto spare_workload = 0.935; + constexpr auto safety = 1.08; + constexpr auto factor95 = safety * expected_items95 / spare_workload; + constexpr auto factor100 = safety * expected_items100 / spare_workload; + constexpr auto factor105 = safety * expected_items105 / spare_workload; + // const double expected_items_reaching_next_level = l1_items * (0.06 / 0.9); + const double expected_items_reaching_next_level = l1_items * factor95; + size_t slots_in_l2 = std::ceil(expected_items_reaching_next_level); + return slots_in_l2; +} + + +template<> +inline size_t get_l2_slots>(size_t l1_items, const double overflowing_items_ratio, const float loads[2]) { + const double expected_items_reaching_next_level = l1_items * overflowing_items_ratio; + size_t slots_in_l2 = (expected_items_reaching_next_level / loads[1]); + return slots_in_l2 * 4; +} + +template<> +inline size_t get_l2_slots>(size_t l1_items, const double overflowing_items_ratio, const float loads[2]) { + const double expected_items_reaching_next_level = l1_items * overflowing_items_ratio; + size_t slots_in_l2 = (expected_items_reaching_next_level / loads[1]); + return slots_in_l2 * 2; +} + +template<> +inline size_t get_l2_slots>(size_t l1_items, const double overflowing_items_ratio, const float loads[2]) { + constexpr auto expected_items95 = 0.0586; + constexpr auto expected_items100 = 0.07952; + constexpr auto expected_items105 = 0.1031; + constexpr auto spare_workload = 1; + constexpr auto safety = 1.08; + constexpr auto factor95 = safety * expected_items95 / spare_workload; + constexpr auto factor100 = safety * expected_items100 / spare_workload; + constexpr auto factor105 = safety * expected_items105 / spare_workload; + // const double expected_items_reaching_next_level = l1_items * (0.06 / 0.9); + const double expected_items_reaching_next_level = l1_items * factor95; + size_t slots_in_l2 = std::ceil(expected_items_reaching_next_level); + return slots_in_l2; +} + + +template +class Prefix_Filter { + const size_t filter_max_capacity; + const size_t number_of_pd; + size_t cap[2] = {0}; + + hashing::TwoIndependentMultiplyShift Hasher, H0; + __m256i *pd_array; + Table GenSpare; + + static double constexpr overflowing_items_ratio = 0.0586;// = expected_items95 + +public: + Prefix_Filter(size_t max_items, const float loads[2]) + : filter_max_capacity(max_items), + number_of_pd(std::ceil(1.0 * max_items / (min_pd::MAX_CAP0 * loads[0]))), + GenSpare(FilterAPI
::ConstructFromAddCount(get_l2_slots
(max_items, overflowing_items_ratio, loads))), + Hasher(), H0() { + + int ok = posix_memalign((void **) &pd_array, 32, 32 * number_of_pd); + if (ok != 0) { + std::cout << "Space allocation failed!" << std::endl; + assert(false); + exit(-3); + } + + constexpr uint64_t pd256_plus_init_header = (((INT64_C(1) << min_pd::QUOTS) - 1) << 6) | 32; + std::fill(pd_array, pd_array + number_of_pd, __m256i{pd256_plus_init_header, 0, 0, 0}); + + // size_t l1 = sizeof(__m256i) * number_of_pd; + // size_t l2 = FilterAPI
::get_byte_size(&GenSpare); + // double ratio = 1.0 * l2 / l1; + // std::cout << get_name() << ".\t"; + // std::cout << "spare-size / First level:\t\t " << ratio << std::endl; + } + + ~Prefix_Filter() { + free(pd_array); + } + + __attribute__((always_inline)) inline static constexpr uint32_t reduce32(uint32_t hash, uint32_t n) { + // http://lemire.me/blog/2016/06/27/a-fast-alternative-to-the-modulo-reduction/ + return (uint32_t) (((uint64_t) hash * n) >> 32); + } + + + __attribute__((always_inline)) inline static constexpr uint16_t fixed_reduce(uint16_t hash) { + // http://lemire.me/blog/2016/06/27/a-fast-alternative-to-the-modulo-reduction/ + return (uint16_t) (((uint32_t) hash * 6400) >> 16); + } + + + inline auto Find(const u64 &item) const -> bool { + const u64 s = H0(item); + uint32_t out1 = s >> 32u, out2 = s; + const uint32_t pd_index = reduce32(out1, (uint32_t) number_of_pd); + const uint16_t qr = fixed_reduce(out2); + const int64_t quot = qr >> 8; + const uint8_t rem = qr; + // return min_pd::pd_find_25(quot, rem, &pd_array[pd_index]); + // return (!min_pd::cmp_qr1(qr, &pd_array[pd_index])) ? min_pd::pd_find_25(quot, rem, &pd_array[pd_index]) + return (!min_pd::cmp_qr1(qr, &pd_array[pd_index])) ? min_pd::find_core(quot, rem, &pd_array[pd_index]) + : incSpare_lookup(pd_index, qr); + } + + inline auto incSpare_lookup(size_t pd_index, u16 qr) const -> bool { + const u64 data = (pd_index << 13u) | qr; + // u64 hashed_res = Hasher(data); + return FilterAPI
::Contain(data, &GenSpare); + } + + inline void incSpare_add(size_t pd_index, const min_pd::add_res &a_info) { + cap[1]++; + u16 qr = (((u16) a_info.quot) << 8u) | a_info.rem; + const u64 data = (pd_index << 13u) | qr; + // u64 hashed_res = Hasher(data); + return FilterAPI
::Add(data, &GenSpare); + } + + void Add(const u64 &item) { + const u64 s = H0(item); + constexpr u64 full_mask = (1ULL << 55); + uint32_t out1 = s >> 32u, out2 = s; + + const uint32_t pd_index = reduce32(out1, (uint32_t) number_of_pd); + + auto pd = pd_array + pd_index; + const uint64_t header = reinterpret_cast(pd)[0]; + const bool not_full = !(header & full_mask); + + const uint16_t qr = fixed_reduce(out2); + const int64_t quot = qr >> 8; + const uint8_t rem = qr; + + if (not_full) { + cap[0]++; + assert(!min_pd::is_pd_full(pd)); + size_t end = min_pd::select64(header >> 6, quot); + assert(min_pd::check::val_header(pd)); + const size_t h_index = end + 6; + const u64 mask = _bzhi_u64(-1, h_index); + const u64 lo = header & mask; + const u64 hi = ((header & ~mask) << 1u);// & h_mask; + assert(!(lo & hi)); + const u64 h7 = lo | hi; + memcpy(pd, &h7, 7); + + assert(min_pd::check::val_header(pd)); + + const size_t body_index = end - quot; + min_pd::body_add_case0_avx(body_index, rem, pd); + // auto mp = (u8 *) pd + 7 + body_index; + // const size_t b2m = (32 - 7) - (body_index + 1); + // memmove(mp + 1, mp, b2m); + // mp[0] = rem; + assert(min_pd::find_core(quot, rem, pd)); + assert(Find(item)); + return; + } else { + auto add_res = min_pd::new_pd_swap_short(quot, rem, pd); + assert(min_pd::check::val_last_quot_is_sorted(pd)); + incSpare_add(pd_index, add_res); + assert(Find(item)); + } + } + + ///////////////////////////////////////////////////////////////////////////////////////////////////////// + ///////////////////////////////////////////////////////////////////////////////////////////////////////// + /////////////////////////////// Validation functions.//////////////////////////////////////////////////// + ///////////////////////////////////////////////////////////////////////////////////////////////////////// + ///////////////////////////////////////////////////////////////////////////////////////////////////////// + + auto get_capacity() const -> size_t { + size_t res = 0; + for (size_t i = 0; i < number_of_pd; ++i) { + res += min_pd::get_capacity(&pd_array[i]); + } + assert(res == cap[0]); + return res; + } + + auto get_name() const -> std::string { + std::string s0 = "Prefix-Filter "; + std::string s1 = FilterAPI
::get_name(&GenSpare); + return s0 + "[ " + s1 + " ]"; + } + + auto count_overflowing_PDs() -> size_t { + size_t count_overflowing_PD = 0; + for (int i = 0; i < number_of_pd; ++i) { + bool add_cond = min_pd::pd_full(&pd_array[i]); + count_overflowing_PD += add_cond; + bool is_full = min_pd::pd_full(&pd_array[i]); + // bool is_full2 = pd_vec[i]->is_full(); + // assert(is_full == is_full2); + bool final = (!add_cond or is_full); + // assert(final); + } + return count_overflowing_PD; + } + + auto count_empty_PDs() -> size_t { + size_t count_empty_PD = 0; + for (int i = 0; i < number_of_pd; ++i) { + bool add_cond = (min_pd::get_capacity(&pd_array[i]) <= 0); + count_empty_PD += add_cond; + } + return count_empty_PD; + } + + auto get_byte_size() const -> size_t { + size_t l1 = sizeof(__m256i) * number_of_pd; + // size_t l2 = FilterAPI
::get_byte_size(GenSpare); + size_t l2 = FilterAPI
::get_byte_size(&GenSpare); + auto res = l1 + l2; + return res; + } + + auto get_cap() const -> size_t { + return cap[0] + cap[1]; + } +}; + + +template +struct FilterAPI> { + using Table = Prefix_Filter; + + static Table ConstructFromAddCount(size_t add_count) { + constexpr float loads[2] = {.95, .95}; + // std::cout << "Lower workload" << std::endl; + // std::cout << "Workload 1!" << std::endl; + return Table(add_count, loads); + } + + static void Add(u64 key, Table *table) { + table->Add(key); + } + static void Remove(u64 key, Table *table) { + throw std::runtime_error("Unsupported"); + } + + CONTAIN_ATTRIBUTES static bool Contain(u64 key, const Table *table) { + return table->Find(key); + } + + static std::string get_name(const Table *table) { + return table->get_name(); + } + + static auto get_functionality(const Table *table) -> uint32_t { + return 3; + } + + static auto get_ID(const Table *table) -> filter_id { + return prefix_id; + } + + static size_t get_byte_size(const Table *table) { + return table->get_byte_size(); + } + + static size_t get_cap(const Table *table) { + return table->get_cap(); + } +}; + + +template +struct FilterAPI> { + using Table = bloomfilter::BloomFilter; + + static Table ConstructFromAddCount(size_t add_count) { + return Table(add_count); + } + + static void Add(uint64_t key, Table *table) { + table->Add(key); + } + + static void Remove(uint64_t key, Table *table) { + throw std::runtime_error("Unsupported"); + } + + inline static bool Contain(uint64_t key, const Table *table) { + return table->Contain(key) == bloomfilter::Ok; + } + + static std::string get_name(const Table *table) { + return table->get_name(); + } + + static auto get_info(const Table *table) -> std::stringstream { + assert(0); + std::stringstream ss; + return ss; + } + + static auto get_functionality(const Table *table) -> uint32_t { + return 3; + } + static auto get_ID(const Table *table) -> filter_id { + return bloom_id; + } + + static size_t get_byte_size(const Table *table) { + return table->SizeInBytes(); + } + + static size_t get_cap(const Table *table) { + return -1; + // return table->get_cap(); + } +}; + +/* +// The statistics gathered for each table type: +struct Statistics { + size_t add_count; + double nanos_per_add; + double nanos_per_remove; + // key: percent of queries that were expected to be positive + map nanos_per_finds; + double false_positive_probabilty; + double bits_per_item; +}; + + +// Output for the first row of the table of results. type_width is the maximum number of +// characters of the description of any table type, and find_percent_count is the number +// of different lookup statistics gathered for each table. This function assumes the +// lookup expected positive probabiilties are evenly distributed, with the first being 0% +// and the last 100%. +inline string StatisticsTableHeader(int type_width, const std::vector &found_probabilities) { + ostringstream os; + + os << string(type_width, ' '); + os << setw(8) << right << ""; + os << setw(8) << right << ""; + for (size_t i = 0; i < found_probabilities.size(); ++i) { + os << setw(8) << "find"; + } + os << setw(8) << "1*add+"; + os << setw(8) << "" << setw(11) << "" << setw(11) + << "optimal" << setw(8) << "wasted" << setw(8) << "million" << endl; + + os << string(type_width, ' '); + os << setw(8) << right << "add"; + os << setw(8) << right << "remove"; + for (double prob : found_probabilities) { + os << setw(8 - 1) << static_cast(prob * 100.0) << '%'; + } + os << setw(8) << "3*find"; + os << setw(9) << "ε%" << setw(11) << "bits/item" << setw(11) + << "bits/item" << setw(8) << "space%" << setw(8) << "keys"; + return os.str(); +} + +// Overloading the usual operator<< as used in "std::cout << foo", but for Statistics +template +basic_ostream &operator<<( + basic_ostream &os, const Statistics &stats) { + os << fixed << setprecision(2) << setw(8) << right + << stats.nanos_per_add; + double add_and_find = 0; + os << fixed << setprecision(2) << setw(8) << right + << stats.nanos_per_remove; + for (const auto &fps : stats.nanos_per_finds) { + os << setw(8) << fps.second; + add_and_find += fps.second; + } + add_and_find = add_and_find * 3 / stats.nanos_per_finds.size(); + add_and_find += stats.nanos_per_add; + os << setw(8) << add_and_find; + + // we get some nonsensical result for very small fpps + if (stats.false_positive_probabilty > 0.0000001) { + const auto minbits = log2(1 / stats.false_positive_probabilty); + os << setw(8) << setprecision(4) << stats.false_positive_probabilty * 100 + << setw(11) << setprecision(2) << stats.bits_per_item << setw(11) << minbits + << setw(8) << setprecision(1) << 100 * (stats.bits_per_item / minbits - 1) + << " " << setw(7) << setprecision(3) << (stats.add_count / 1000000.); + } else { + os << setw(8) << setprecision(4) << stats.false_positive_probabilty * 100 + << setw(11) << setprecision(2) << stats.bits_per_item << setw(11) << 64 + << setw(8) << setprecision(1) << 0 + << " " << setw(7) << setprecision(3) << (stats.add_count / 1000000.); + } + return os; +} + +struct samples { + double found_probability; + std::vector to_lookup_mixed; + size_t true_match; + size_t actual_sample_size; +}; + +typedef struct samples samples_t; + */ +#endif diff --git a/cmake-build-debug/.cmake/api/v1/query/cache-v2 b/cmake-build-debug/.cmake/api/v1/query/cache-v2 new file mode 100644 index 0000000..e69de29 diff --git a/cmake-build-debug/.cmake/api/v1/query/cmakeFiles-v1 b/cmake-build-debug/.cmake/api/v1/query/cmakeFiles-v1 new file mode 100644 index 0000000..e69de29 diff --git a/cmake-build-debug/.cmake/api/v1/query/codemodel-v2 b/cmake-build-debug/.cmake/api/v1/query/codemodel-v2 new file mode 100644 index 0000000..e69de29 diff --git a/cmake-build-debug/.cmake/api/v1/query/toolchains-v1 b/cmake-build-debug/.cmake/api/v1/query/toolchains-v1 new file mode 100644 index 0000000..e69de29 diff --git a/cmake-build-debug/.cmake/api/v1/reply/cache-v2-2dd2a3e80239b44d83cc.json b/cmake-build-debug/.cmake/api/v1/reply/cache-v2-2dd2a3e80239b44d83cc.json new file mode 100644 index 0000000..c8da01a --- /dev/null +++ b/cmake-build-debug/.cmake/api/v1/reply/cache-v2-2dd2a3e80239b44d83cc.json @@ -0,0 +1,1147 @@ +{ + "entries" : + [ + { + "name" : "APD_ONLY_BINARY_DIR", + "properties" : + [ + { + "name" : "HELPSTRING", + "value" : "Value Computed by CMake" + } + ], + "type" : "STATIC", + "value" : "/home/tomer/Github/Public-PF/cmake-build-debug" + }, + { + "name" : "APD_ONLY_IS_TOP_LEVEL", + "properties" : + [ + { + "name" : "HELPSTRING", + "value" : "Value Computed by CMake" + } + ], + "type" : "STATIC", + "value" : "ON" + }, + { + "name" : "APD_ONLY_SOURCE_DIR", + "properties" : + [ + { + "name" : "HELPSTRING", + "value" : "Value Computed by CMake" + } + ], + "type" : "STATIC", + "value" : "/home/tomer/Github/Public-PF" + }, + { + "name" : "CMAKE_ADDR2LINE", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "Path to a program." + } + ], + "type" : "FILEPATH", + "value" : "/usr/bin/addr2line" + }, + { + "name" : "CMAKE_AR", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "Path to a program." + } + ], + "type" : "FILEPATH", + "value" : "/usr/bin/ar" + }, + { + "name" : "CMAKE_BUILD_TYPE", + "properties" : + [ + { + "name" : "HELPSTRING", + "value" : "Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel ..." + } + ], + "type" : "STRING", + "value" : "Debug" + }, + { + "name" : "CMAKE_CACHEFILE_DIR", + "properties" : + [ + { + "name" : "HELPSTRING", + "value" : "This is the directory where this CMakeCache.txt was created" + } + ], + "type" : "INTERNAL", + "value" : "/home/tomer/Github/Public-PF/cmake-build-debug" + }, + { + "name" : "CMAKE_CACHE_MAJOR_VERSION", + "properties" : + [ + { + "name" : "HELPSTRING", + "value" : "Major version of cmake used to create the current loaded cache" + } + ], + "type" : "INTERNAL", + "value" : "3" + }, + { + "name" : "CMAKE_CACHE_MINOR_VERSION", + "properties" : + [ + { + "name" : "HELPSTRING", + "value" : "Minor version of cmake used to create the current loaded cache" + } + ], + "type" : "INTERNAL", + "value" : "21" + }, + { + "name" : "CMAKE_CACHE_PATCH_VERSION", + "properties" : + [ + { + "name" : "HELPSTRING", + "value" : "Patch version of cmake used to create the current loaded cache" + } + ], + "type" : "INTERNAL", + "value" : "1" + }, + { + "name" : "CMAKE_COMMAND", + "properties" : + [ + { + "name" : "HELPSTRING", + "value" : "Path to CMake executable." + } + ], + "type" : "INTERNAL", + "value" : "/snap/clion/184/bin/cmake/linux/bin/cmake" + }, + { + "name" : "CMAKE_CPACK_COMMAND", + "properties" : + [ + { + "name" : "HELPSTRING", + "value" : "Path to cpack program executable." + } + ], + "type" : "INTERNAL", + "value" : "/snap/clion/184/bin/cmake/linux/bin/cpack" + }, + { + "name" : "CMAKE_CTEST_COMMAND", + "properties" : + [ + { + "name" : "HELPSTRING", + "value" : "Path to ctest program executable." + } + ], + "type" : "INTERNAL", + "value" : "/snap/clion/184/bin/cmake/linux/bin/ctest" + }, + { + "name" : "CMAKE_CXX_COMPILER", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "CXX compiler" + } + ], + "type" : "STRING", + "value" : "/usr/bin/g++-10" + }, + { + "name" : "CMAKE_CXX_COMPILER_AR", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "A wrapper around 'ar' adding the appropriate '--plugin' option for the GCC compiler" + } + ], + "type" : "FILEPATH", + "value" : "/usr/bin/gcc-ar-10" + }, + { + "name" : "CMAKE_CXX_COMPILER_RANLIB", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "A wrapper around 'ranlib' adding the appropriate '--plugin' option for the GCC compiler" + } + ], + "type" : "FILEPATH", + "value" : "/usr/bin/gcc-ranlib-10" + }, + { + "name" : "CMAKE_CXX_FLAGS", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "Flags used by the CXX compiler during all build types." + } + ], + "type" : "STRING", + "value" : "" + }, + { + "name" : "CMAKE_CXX_FLAGS_DEBUG", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "Flags used by the CXX compiler during DEBUG builds." + } + ], + "type" : "STRING", + "value" : "-g" + }, + { + "name" : "CMAKE_CXX_FLAGS_MINSIZEREL", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "Flags used by the CXX compiler during MINSIZEREL builds." + } + ], + "type" : "STRING", + "value" : "-Os -DNDEBUG" + }, + { + "name" : "CMAKE_CXX_FLAGS_RELEASE", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "Flags used by the CXX compiler during RELEASE builds." + } + ], + "type" : "STRING", + "value" : "-O3 -DNDEBUG" + }, + { + "name" : "CMAKE_CXX_FLAGS_RELWITHDEBINFO", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "Flags used by the CXX compiler during RELWITHDEBINFO builds." + } + ], + "type" : "STRING", + "value" : "-O2 -g -DNDEBUG" + }, + { + "name" : "CMAKE_C_COMPILER", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "C compiler" + } + ], + "type" : "STRING", + "value" : "/usr/bin/gcc-10" + }, + { + "name" : "CMAKE_C_COMPILER_AR", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "A wrapper around 'ar' adding the appropriate '--plugin' option for the GCC compiler" + } + ], + "type" : "FILEPATH", + "value" : "/usr/bin/gcc-ar-10" + }, + { + "name" : "CMAKE_C_COMPILER_RANLIB", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "A wrapper around 'ranlib' adding the appropriate '--plugin' option for the GCC compiler" + } + ], + "type" : "FILEPATH", + "value" : "/usr/bin/gcc-ranlib-10" + }, + { + "name" : "CMAKE_C_FLAGS", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "Flags used by the C compiler during all build types." + } + ], + "type" : "STRING", + "value" : "" + }, + { + "name" : "CMAKE_C_FLAGS_DEBUG", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "Flags used by the C compiler during DEBUG builds." + } + ], + "type" : "STRING", + "value" : "-g" + }, + { + "name" : "CMAKE_C_FLAGS_MINSIZEREL", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "Flags used by the C compiler during MINSIZEREL builds." + } + ], + "type" : "STRING", + "value" : "-Os -DNDEBUG" + }, + { + "name" : "CMAKE_C_FLAGS_RELEASE", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "Flags used by the C compiler during RELEASE builds." + } + ], + "type" : "STRING", + "value" : "-O3 -DNDEBUG" + }, + { + "name" : "CMAKE_C_FLAGS_RELWITHDEBINFO", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "Flags used by the C compiler during RELWITHDEBINFO builds." + } + ], + "type" : "STRING", + "value" : "-O2 -g -DNDEBUG" + }, + { + "name" : "CMAKE_DLLTOOL", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "Path to a program." + } + ], + "type" : "FILEPATH", + "value" : "CMAKE_DLLTOOL-NOTFOUND" + }, + { + "name" : "CMAKE_EXECUTABLE_FORMAT", + "properties" : + [ + { + "name" : "HELPSTRING", + "value" : "Executable file format" + } + ], + "type" : "INTERNAL", + "value" : "ELF" + }, + { + "name" : "CMAKE_EXE_LINKER_FLAGS", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "Flags used by the linker during all build types." + } + ], + "type" : "STRING", + "value" : "" + }, + { + "name" : "CMAKE_EXE_LINKER_FLAGS_DEBUG", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "Flags used by the linker during DEBUG builds." + } + ], + "type" : "STRING", + "value" : "" + }, + { + "name" : "CMAKE_EXE_LINKER_FLAGS_MINSIZEREL", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "Flags used by the linker during MINSIZEREL builds." + } + ], + "type" : "STRING", + "value" : "" + }, + { + "name" : "CMAKE_EXE_LINKER_FLAGS_RELEASE", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "Flags used by the linker during RELEASE builds." + } + ], + "type" : "STRING", + "value" : "" + }, + { + "name" : "CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "Flags used by the linker during RELWITHDEBINFO builds." + } + ], + "type" : "STRING", + "value" : "" + }, + { + "name" : "CMAKE_EXPORT_COMPILE_COMMANDS", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "Enable/Disable output of compile commands during generation." + } + ], + "type" : "BOOL", + "value" : "" + }, + { + "name" : "CMAKE_EXTRA_GENERATOR", + "properties" : + [ + { + "name" : "HELPSTRING", + "value" : "Name of external makefile project generator." + } + ], + "type" : "INTERNAL", + "value" : "" + }, + { + "name" : "CMAKE_GENERATOR", + "properties" : + [ + { + "name" : "HELPSTRING", + "value" : "Name of generator." + } + ], + "type" : "INTERNAL", + "value" : "Ninja" + }, + { + "name" : "CMAKE_GENERATOR_INSTANCE", + "properties" : + [ + { + "name" : "HELPSTRING", + "value" : "Generator instance identifier." + } + ], + "type" : "INTERNAL", + "value" : "" + }, + { + "name" : "CMAKE_GENERATOR_PLATFORM", + "properties" : + [ + { + "name" : "HELPSTRING", + "value" : "Name of generator platform." + } + ], + "type" : "INTERNAL", + "value" : "" + }, + { + "name" : "CMAKE_GENERATOR_TOOLSET", + "properties" : + [ + { + "name" : "HELPSTRING", + "value" : "Name of generator toolset." + } + ], + "type" : "INTERNAL", + "value" : "" + }, + { + "name" : "CMAKE_HOME_DIRECTORY", + "properties" : + [ + { + "name" : "HELPSTRING", + "value" : "Source directory with the top level CMakeLists.txt file for this project" + } + ], + "type" : "INTERNAL", + "value" : "/home/tomer/Github/Public-PF" + }, + { + "name" : "CMAKE_INSTALL_PREFIX", + "properties" : + [ + { + "name" : "HELPSTRING", + "value" : "Install path prefix, prepended onto install directories." + } + ], + "type" : "PATH", + "value" : "/usr/local" + }, + { + "name" : "CMAKE_INSTALL_SO_NO_EXE", + "properties" : + [ + { + "name" : "HELPSTRING", + "value" : "Install .so files without execute permission." + } + ], + "type" : "INTERNAL", + "value" : "1" + }, + { + "name" : "CMAKE_LINKER", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "Path to a program." + } + ], + "type" : "FILEPATH", + "value" : "/usr/bin/ld" + }, + { + "name" : "CMAKE_MAKE_PROGRAM", + "properties" : + [ + { + "name" : "HELPSTRING", + "value" : "No help, variable specified on the command line." + } + ], + "type" : "UNINITIALIZED", + "value" : "/snap/clion/184/bin/ninja/linux/ninja" + }, + { + "name" : "CMAKE_MODULE_LINKER_FLAGS", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "Flags used by the linker during the creation of modules during all build types." + } + ], + "type" : "STRING", + "value" : "" + }, + { + "name" : "CMAKE_MODULE_LINKER_FLAGS_DEBUG", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "Flags used by the linker during the creation of modules during DEBUG builds." + } + ], + "type" : "STRING", + "value" : "" + }, + { + "name" : "CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "Flags used by the linker during the creation of modules during MINSIZEREL builds." + } + ], + "type" : "STRING", + "value" : "" + }, + { + "name" : "CMAKE_MODULE_LINKER_FLAGS_RELEASE", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "Flags used by the linker during the creation of modules during RELEASE builds." + } + ], + "type" : "STRING", + "value" : "" + }, + { + "name" : "CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "Flags used by the linker during the creation of modules during RELWITHDEBINFO builds." + } + ], + "type" : "STRING", + "value" : "" + }, + { + "name" : "CMAKE_NM", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "Path to a program." + } + ], + "type" : "FILEPATH", + "value" : "/usr/bin/nm" + }, + { + "name" : "CMAKE_NUMBER_OF_MAKEFILES", + "properties" : + [ + { + "name" : "HELPSTRING", + "value" : "number of local generators" + } + ], + "type" : "INTERNAL", + "value" : "1" + }, + { + "name" : "CMAKE_OBJCOPY", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "Path to a program." + } + ], + "type" : "FILEPATH", + "value" : "/usr/bin/objcopy" + }, + { + "name" : "CMAKE_OBJDUMP", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "Path to a program." + } + ], + "type" : "FILEPATH", + "value" : "/usr/bin/objdump" + }, + { + "name" : "CMAKE_PLATFORM_INFO_INITIALIZED", + "properties" : + [ + { + "name" : "HELPSTRING", + "value" : "Platform information initialized" + } + ], + "type" : "INTERNAL", + "value" : "1" + }, + { + "name" : "CMAKE_PROJECT_DESCRIPTION", + "properties" : + [ + { + "name" : "HELPSTRING", + "value" : "Value Computed by CMake" + } + ], + "type" : "STATIC", + "value" : "" + }, + { + "name" : "CMAKE_PROJECT_HOMEPAGE_URL", + "properties" : + [ + { + "name" : "HELPSTRING", + "value" : "Value Computed by CMake" + } + ], + "type" : "STATIC", + "value" : "" + }, + { + "name" : "CMAKE_PROJECT_NAME", + "properties" : + [ + { + "name" : "HELPSTRING", + "value" : "Value Computed by CMake" + } + ], + "type" : "STATIC", + "value" : "APD_ONLY" + }, + { + "name" : "CMAKE_RANLIB", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "Path to a program." + } + ], + "type" : "FILEPATH", + "value" : "/usr/bin/ranlib" + }, + { + "name" : "CMAKE_READELF", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "Path to a program." + } + ], + "type" : "FILEPATH", + "value" : "/usr/bin/readelf" + }, + { + "name" : "CMAKE_ROOT", + "properties" : + [ + { + "name" : "HELPSTRING", + "value" : "Path to CMake installation." + } + ], + "type" : "INTERNAL", + "value" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21" + }, + { + "name" : "CMAKE_SHARED_LINKER_FLAGS", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "Flags used by the linker during the creation of shared libraries during all build types." + } + ], + "type" : "STRING", + "value" : "" + }, + { + "name" : "CMAKE_SHARED_LINKER_FLAGS_DEBUG", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "Flags used by the linker during the creation of shared libraries during DEBUG builds." + } + ], + "type" : "STRING", + "value" : "" + }, + { + "name" : "CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "Flags used by the linker during the creation of shared libraries during MINSIZEREL builds." + } + ], + "type" : "STRING", + "value" : "" + }, + { + "name" : "CMAKE_SHARED_LINKER_FLAGS_RELEASE", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "Flags used by the linker during the creation of shared libraries during RELEASE builds." + } + ], + "type" : "STRING", + "value" : "" + }, + { + "name" : "CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "Flags used by the linker during the creation of shared libraries during RELWITHDEBINFO builds." + } + ], + "type" : "STRING", + "value" : "" + }, + { + "name" : "CMAKE_SKIP_INSTALL_RPATH", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "If set, runtime paths are not added when installing shared libraries, but are added when building." + } + ], + "type" : "BOOL", + "value" : "NO" + }, + { + "name" : "CMAKE_SKIP_RPATH", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "If set, runtime paths are not added when using shared libraries." + } + ], + "type" : "BOOL", + "value" : "NO" + }, + { + "name" : "CMAKE_STATIC_LINKER_FLAGS", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "Flags used by the linker during the creation of static libraries during all build types." + } + ], + "type" : "STRING", + "value" : "" + }, + { + "name" : "CMAKE_STATIC_LINKER_FLAGS_DEBUG", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "Flags used by the linker during the creation of static libraries during DEBUG builds." + } + ], + "type" : "STRING", + "value" : "" + }, + { + "name" : "CMAKE_STATIC_LINKER_FLAGS_MINSIZEREL", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "Flags used by the linker during the creation of static libraries during MINSIZEREL builds." + } + ], + "type" : "STRING", + "value" : "" + }, + { + "name" : "CMAKE_STATIC_LINKER_FLAGS_RELEASE", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "Flags used by the linker during the creation of static libraries during RELEASE builds." + } + ], + "type" : "STRING", + "value" : "" + }, + { + "name" : "CMAKE_STATIC_LINKER_FLAGS_RELWITHDEBINFO", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "Flags used by the linker during the creation of static libraries during RELWITHDEBINFO builds." + } + ], + "type" : "STRING", + "value" : "" + }, + { + "name" : "CMAKE_STRIP", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "Path to a program." + } + ], + "type" : "FILEPATH", + "value" : "/usr/bin/strip" + }, + { + "name" : "CMAKE_UNAME", + "properties" : + [ + { + "name" : "HELPSTRING", + "value" : "uname command" + } + ], + "type" : "INTERNAL", + "value" : "/usr/bin/uname" + }, + { + "name" : "CMAKE_VERBOSE_MAKEFILE", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "If this value is on, makefiles will be generated without the .SILENT directive, and all commands will be echoed to the console during the make. This is useful for debugging only. With Visual Studio IDE projects all commands are done without /nologo." + } + ], + "type" : "BOOL", + "value" : "FALSE" + } + ], + "kind" : "cache", + "version" : + { + "major" : 2, + "minor" : 0 + } +} diff --git a/cmake-build-debug/.cmake/api/v1/reply/cmakeFiles-v1-eb5f60b98dcb2065ce32.json b/cmake-build-debug/.cmake/api/v1/reply/cmakeFiles-v1-eb5f60b98dcb2065ce32.json new file mode 100644 index 0000000..71f05fd --- /dev/null +++ b/cmake-build-debug/.cmake/api/v1/reply/cmakeFiles-v1-eb5f60b98dcb2065ce32.json @@ -0,0 +1,729 @@ +{ + "inputs" : + [ + { + "path" : "CMakeLists.txt" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/CMakeDetermineSystem.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/CMakeSystem.cmake.in" + }, + { + "isGenerated" : true, + "path" : "cmake-build-debug/CMakeFiles/3.21.1/CMakeSystem.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/CMakeSystemSpecificInitialize.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/CMakeDetermineCCompiler.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/CMakeDetermineCompiler.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/CMakeDetermineCompilerId.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/CMakeCompilerIdDetection.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/ADSP-DetermineCompiler.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/ARMCC-DetermineCompiler.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/ARMClang-DetermineCompiler.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/AppleClang-DetermineCompiler.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/Clang-DetermineCompilerInternal.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/Borland-DetermineCompiler.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/Bruce-C-DetermineCompiler.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/Clang-DetermineCompiler.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/Clang-DetermineCompilerInternal.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/Compaq-C-DetermineCompiler.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/Cray-DetermineCompiler.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/Embarcadero-DetermineCompiler.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/Fujitsu-DetermineCompiler.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/FujitsuClang-DetermineCompiler.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/GHS-DetermineCompiler.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/GNU-C-DetermineCompiler.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/HP-C-DetermineCompiler.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/IAR-DetermineCompiler.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/Intel-DetermineCompiler.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/IntelLLVM-DetermineCompiler.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/MSVC-DetermineCompiler.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/NVHPC-DetermineCompiler.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/NVIDIA-DetermineCompiler.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/OpenWatcom-DetermineCompiler.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/PGI-DetermineCompiler.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/PathScale-DetermineCompiler.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/ROCMClang-DetermineCompiler.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/SCO-DetermineCompiler.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/SDCC-C-DetermineCompiler.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/SunPro-C-DetermineCompiler.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/TI-DetermineCompiler.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/TinyCC-C-DetermineCompiler.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/VisualAge-C-DetermineCompiler.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/IBMCPP-C-DetermineVersionInternal.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/Watcom-DetermineCompiler.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/XL-C-DetermineCompiler.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/IBMCPP-C-DetermineVersionInternal.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/XLClang-C-DetermineCompiler.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/zOS-C-DetermineCompiler.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/IBMCPP-C-DetermineVersionInternal.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/CMakeFindBinUtils.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/GNU-FindBinUtils.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/CMakeCCompiler.cmake.in" + }, + { + "isGenerated" : true, + "path" : "cmake-build-debug/CMakeFiles/3.21.1/CMakeCCompiler.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/CMakeDetermineCXXCompiler.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/CMakeDetermineCompiler.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Platform/Linux-Determine-CXX.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/CMakeDetermineCompilerId.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/CMakeCompilerIdDetection.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/ADSP-DetermineCompiler.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/ARMCC-DetermineCompiler.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/ARMClang-DetermineCompiler.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/AppleClang-DetermineCompiler.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/Clang-DetermineCompilerInternal.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/Borland-DetermineCompiler.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/Clang-DetermineCompiler.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/Clang-DetermineCompilerInternal.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/Comeau-CXX-DetermineCompiler.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/Compaq-CXX-DetermineCompiler.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/Cray-DetermineCompiler.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/Embarcadero-DetermineCompiler.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/Fujitsu-DetermineCompiler.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/FujitsuClang-DetermineCompiler.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/GHS-DetermineCompiler.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/GNU-CXX-DetermineCompiler.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/HP-CXX-DetermineCompiler.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/IAR-DetermineCompiler.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/Intel-DetermineCompiler.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/IntelLLVM-DetermineCompiler.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/MSVC-DetermineCompiler.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/NVHPC-DetermineCompiler.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/NVIDIA-DetermineCompiler.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/OpenWatcom-DetermineCompiler.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/PGI-DetermineCompiler.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/PathScale-DetermineCompiler.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/ROCMClang-DetermineCompiler.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/SCO-DetermineCompiler.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/SunPro-CXX-DetermineCompiler.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/TI-DetermineCompiler.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/VisualAge-CXX-DetermineCompiler.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/IBMCPP-CXX-DetermineVersionInternal.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/Watcom-DetermineCompiler.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/XL-CXX-DetermineCompiler.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/IBMCPP-CXX-DetermineVersionInternal.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/XLClang-CXX-DetermineCompiler.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/zOS-CXX-DetermineCompiler.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/IBMCPP-CXX-DetermineVersionInternal.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/CMakeFindBinUtils.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/GNU-FindBinUtils.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/CMakeCXXCompiler.cmake.in" + }, + { + "isGenerated" : true, + "path" : "cmake-build-debug/CMakeFiles/3.21.1/CMakeCXXCompiler.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/CMakeSystemSpecificInformation.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/CMakeGenericSystem.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/CMakeInitializeConfigs.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Platform/Linux.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Platform/UnixPaths.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/CMakeCInformation.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/CMakeLanguageInformation.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/GNU-C.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/GNU.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/CMakeCommonCompilerMacros.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Platform/Linux-GNU-C.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Platform/Linux-GNU.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/CMakeCommonLanguageInclude.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/CMakeTestCCompiler.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/CMakeTestCompilerCommon.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/CMakeDetermineCompilerABI.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/CMakeParseImplicitIncludeInfo.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/CMakeParseImplicitLinkInfo.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/CMakeParseLibraryArchitecture.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/CMakeTestCompilerCommon.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/CMakeCCompilerABI.c" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/CMakeDetermineCompileFeatures.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Internal/FeatureTesting.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/CMakeCCompiler.cmake.in" + }, + { + "isGenerated" : true, + "path" : "cmake-build-debug/CMakeFiles/3.21.1/CMakeCCompiler.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/CMakeCXXInformation.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/CMakeLanguageInformation.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/GNU-CXX.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/GNU.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Platform/Linux-GNU-CXX.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Platform/Linux-GNU.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/CMakeCommonLanguageInclude.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/CMakeTestCXXCompiler.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/CMakeTestCompilerCommon.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/CMakeDetermineCompilerABI.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/CMakeParseImplicitIncludeInfo.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/CMakeParseImplicitLinkInfo.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/CMakeParseLibraryArchitecture.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/CMakeTestCompilerCommon.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/CMakeCXXCompilerABI.cpp" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/CMakeDetermineCompileFeatures.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Internal/FeatureTesting.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/CMakeCXXCompiler.cmake.in" + }, + { + "isGenerated" : true, + "path" : "cmake-build-debug/CMakeFiles/3.21.1/CMakeCXXCompiler.cmake" + } + ], + "kind" : "cmakeFiles", + "paths" : + { + "build" : "/home/tomer/Github/Public-PF/cmake-build-debug", + "source" : "/home/tomer/Github/Public-PF" + }, + "version" : + { + "major" : 1, + "minor" : 0 + } +} diff --git a/cmake-build-debug/.cmake/api/v1/reply/codemodel-v2-5879e526388a2efa61dd.json b/cmake-build-debug/.cmake/api/v1/reply/codemodel-v2-5879e526388a2efa61dd.json new file mode 100644 index 0000000..cb134b5 --- /dev/null +++ b/cmake-build-debug/.cmake/api/v1/reply/codemodel-v2-5879e526388a2efa61dd.json @@ -0,0 +1,150 @@ +{ + "configurations" : + [ + { + "directories" : + [ + { + "build" : ".", + "jsonFile" : "directory-.-Debug-f5ebdc15457944623624.json", + "minimumCMakeVersion" : + { + "string" : "3.10" + }, + "projectIndex" : 0, + "source" : ".", + "targetIndexes" : + [ + 0, + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10 + ] + } + ], + "name" : "Debug", + "projects" : + [ + { + "directoryIndexes" : + [ + 0 + ], + "name" : "APD_ONLY", + "targetIndexes" : + [ + 0, + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10 + ] + } + ], + "targets" : + [ + { + "directoryIndex" : 0, + "id" : "example::@6890427a1f51a3e7e1df", + "jsonFile" : "target-example-Debug-f2fd9bd66abbfca03f37.json", + "name" : "example", + "projectIndex" : 0 + }, + { + "directoryIndex" : 0, + "id" : "example0::@6890427a1f51a3e7e1df", + "jsonFile" : "target-example0-Debug-722e45bf24620d8a1287.json", + "name" : "example0", + "projectIndex" : 0 + }, + { + "directoryIndex" : 0, + "id" : "measure_built::@6890427a1f51a3e7e1df", + "jsonFile" : "target-measure_built-Debug-0ba116b65bf3d7ab6884.json", + "name" : "measure_built", + "projectIndex" : 0 + }, + { + "directoryIndex" : 0, + "id" : "measure_built0::@6890427a1f51a3e7e1df", + "jsonFile" : "target-measure_built0-Debug-1c26e7153ab9b4dbb397.json", + "name" : "measure_built0", + "projectIndex" : 0 + }, + { + "directoryIndex" : 0, + "id" : "measure_built3::@6890427a1f51a3e7e1df", + "jsonFile" : "target-measure_built3-Debug-9e60f0edabd112451332.json", + "name" : "measure_built3", + "projectIndex" : 0 + }, + { + "directoryIndex" : 0, + "id" : "measure_fpp::@6890427a1f51a3e7e1df", + "jsonFile" : "target-measure_fpp-Debug-6218804baa2d893c8235.json", + "name" : "measure_fpp", + "projectIndex" : 0 + }, + { + "directoryIndex" : 0, + "id" : "measure_fpp0::@6890427a1f51a3e7e1df", + "jsonFile" : "target-measure_fpp0-Debug-ae3e716da61914872325.json", + "name" : "measure_fpp0", + "projectIndex" : 0 + }, + { + "directoryIndex" : 0, + "id" : "measure_fpp3::@6890427a1f51a3e7e1df", + "jsonFile" : "target-measure_fpp3-Debug-12090f7133d04d45c993.json", + "name" : "measure_fpp3", + "projectIndex" : 0 + }, + { + "directoryIndex" : 0, + "id" : "measure_perf::@6890427a1f51a3e7e1df", + "jsonFile" : "target-measure_perf-Debug-a7f31f032634834b67c5.json", + "name" : "measure_perf", + "projectIndex" : 0 + }, + { + "directoryIndex" : 0, + "id" : "measure_perf0::@6890427a1f51a3e7e1df", + "jsonFile" : "target-measure_perf0-Debug-b41767523d8bde5ed7bd.json", + "name" : "measure_perf0", + "projectIndex" : 0 + }, + { + "directoryIndex" : 0, + "id" : "measure_perf3::@6890427a1f51a3e7e1df", + "jsonFile" : "target-measure_perf3-Debug-1815e855f242cbd76a5a.json", + "name" : "measure_perf3", + "projectIndex" : 0 + } + ] + } + ], + "kind" : "codemodel", + "paths" : + { + "build" : "/home/tomer/Github/Public-PF/cmake-build-debug", + "source" : "/home/tomer/Github/Public-PF" + }, + "version" : + { + "major" : 2, + "minor" : 3 + } +} diff --git a/cmake-build-debug/.cmake/api/v1/reply/directory-.-Debug-f5ebdc15457944623624.json b/cmake-build-debug/.cmake/api/v1/reply/directory-.-Debug-f5ebdc15457944623624.json new file mode 100644 index 0000000..3a67af9 --- /dev/null +++ b/cmake-build-debug/.cmake/api/v1/reply/directory-.-Debug-f5ebdc15457944623624.json @@ -0,0 +1,14 @@ +{ + "backtraceGraph" : + { + "commands" : [], + "files" : [], + "nodes" : [] + }, + "installers" : [], + "paths" : + { + "build" : ".", + "source" : "." + } +} diff --git a/cmake-build-debug/.cmake/api/v1/reply/index-2022-03-18T10-15-38-0219.json b/cmake-build-debug/.cmake/api/v1/reply/index-2022-03-18T10-15-38-0219.json new file mode 100644 index 0000000..5042a01 --- /dev/null +++ b/cmake-build-debug/.cmake/api/v1/reply/index-2022-03-18T10-15-38-0219.json @@ -0,0 +1,108 @@ +{ + "cmake" : + { + "generator" : + { + "multiConfig" : false, + "name" : "Ninja" + }, + "paths" : + { + "cmake" : "/snap/clion/184/bin/cmake/linux/bin/cmake", + "cpack" : "/snap/clion/184/bin/cmake/linux/bin/cpack", + "ctest" : "/snap/clion/184/bin/cmake/linux/bin/ctest", + "root" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21" + }, + "version" : + { + "isDirty" : false, + "major" : 3, + "minor" : 21, + "patch" : 1, + "string" : "3.21.1", + "suffix" : "" + } + }, + "objects" : + [ + { + "jsonFile" : "codemodel-v2-5879e526388a2efa61dd.json", + "kind" : "codemodel", + "version" : + { + "major" : 2, + "minor" : 3 + } + }, + { + "jsonFile" : "cache-v2-2dd2a3e80239b44d83cc.json", + "kind" : "cache", + "version" : + { + "major" : 2, + "minor" : 0 + } + }, + { + "jsonFile" : "cmakeFiles-v1-eb5f60b98dcb2065ce32.json", + "kind" : "cmakeFiles", + "version" : + { + "major" : 1, + "minor" : 0 + } + }, + { + "jsonFile" : "toolchains-v1-b0b7064a037a803f7bb5.json", + "kind" : "toolchains", + "version" : + { + "major" : 1, + "minor" : 0 + } + } + ], + "reply" : + { + "cache-v2" : + { + "jsonFile" : "cache-v2-2dd2a3e80239b44d83cc.json", + "kind" : "cache", + "version" : + { + "major" : 2, + "minor" : 0 + } + }, + "cmakeFiles-v1" : + { + "jsonFile" : "cmakeFiles-v1-eb5f60b98dcb2065ce32.json", + "kind" : "cmakeFiles", + "version" : + { + "major" : 1, + "minor" : 0 + } + }, + "codemodel-v2" : + { + "jsonFile" : "codemodel-v2-5879e526388a2efa61dd.json", + "kind" : "codemodel", + "version" : + { + "major" : 2, + "minor" : 3 + } + }, + "toolchains-v1" : + { + "jsonFile" : "toolchains-v1-b0b7064a037a803f7bb5.json", + "kind" : "toolchains", + "version" : + { + "major" : 1, + "minor" : 0 + } + } + } +} diff --git a/cmake-build-debug/.cmake/api/v1/reply/target-example-Debug-f2fd9bd66abbfca03f37.json b/cmake-build-debug/.cmake/api/v1/reply/target-example-Debug-f2fd9bd66abbfca03f37.json new file mode 100644 index 0000000..51f6196 --- /dev/null +++ b/cmake-build-debug/.cmake/api/v1/reply/target-example-Debug-f2fd9bd66abbfca03f37.json @@ -0,0 +1,271 @@ +{ + "artifacts" : + [ + { + "path" : "example" + } + ], + "backtrace" : 1, + "backtraceGraph" : + { + "commands" : + [ + "add_executable", + "target_compile_options" + ], + "files" : + [ + "CMakeLists.txt" + ], + "nodes" : + [ + { + "file" : 0 + }, + { + "command" : 0, + "file" : 0, + "line" : 111, + "parent" : 0 + }, + { + "command" : 1, + "file" : 0, + "line" : 113, + "parent" : 0 + } + ] + }, + "compileGroups" : + [ + { + "compileCommandFragments" : + [ + { + "fragment" : "-march=native -g" + }, + { + "backtrace" : 2, + "fragment" : "-Ofast" + }, + { + "backtrace" : 2, + "fragment" : "-DNDEBUG" + }, + { + "fragment" : "-std=gnu++17" + } + ], + "language" : "CXX", + "languageStandard" : + { + "backtraces" : + [ + 1 + ], + "standard" : "17" + }, + "sourceIndexes" : + [ + 7, + 9, + 11, + 14, + 21, + 23 + ] + } + ], + "id" : "example::@6890427a1f51a3e7e1df", + "link" : + { + "commandFragments" : + [ + { + "fragment" : "-march=native -g", + "role" : "flags" + }, + { + "fragment" : "", + "role" : "flags" + } + ], + "language" : "CXX" + }, + "name" : "example", + "nameOnDisk" : "example", + "paths" : + { + "build" : ".", + "source" : "." + }, + "sourceGroups" : + [ + { + "name" : "Header Files", + "sourceIndexes" : + [ + 0, + 1, + 2, + 3, + 4, + 5, + 6, + 8, + 10, + 12, + 13, + 15, + 16, + 17, + 18, + 19, + 20, + 22 + ] + }, + { + "name" : "Source Files", + "sourceIndexes" : + [ + 7, + 9, + 11, + 14, + 21, + 23 + ] + } + ], + "sources" : + [ + { + "backtrace" : 1, + "path" : "Bloom_Filter/simd-block.h", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "path" : "Bloom_Filter/simd-block-fixed-fpp.h", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "path" : "Bloom_Filter/Impala512.h", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "path" : "Bloom_Filter/bloom.hpp", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "path" : "hashutil.h", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "path" : "Tests/wrappers.hpp", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "path" : "Tests/smart_tests.hpp", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "compileGroupIndex" : 0, + "path" : "Tests/smart_tests.cpp", + "sourceGroupIndex" : 1 + }, + { + "backtrace" : 1, + "path" : "Prefix-Filter/Shift_op.hpp", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "compileGroupIndex" : 0, + "path" : "Prefix-Filter/Shift_op.cpp", + "sourceGroupIndex" : 1 + }, + { + "backtrace" : 1, + "path" : "Prefix-Filter/min_pd256.hpp", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "compileGroupIndex" : 0, + "path" : "Prefix-Filter/min_pd256.cpp", + "sourceGroupIndex" : 1 + }, + { + "backtrace" : 1, + "path" : "cuckoofilter/src/bitsutil.h", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "path" : "cuckoofilter/src/permencoding.h", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "compileGroupIndex" : 0, + "path" : "cuckoofilter/src/printutil.cc", + "sourceGroupIndex" : 1 + }, + { + "backtrace" : 1, + "path" : "cuckoofilter/src/debug.h", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "path" : "cuckoofilter/src/singletable.h", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "path" : "cuckoofilter/src/packedtable.h", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "path" : "cuckoofilter/src/cuckoofilter.h", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "path" : "cuckoofilter/src/cuckoofilter_stable.h", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "path" : "TC-Shortcut/tc-sym.hpp", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "compileGroupIndex" : 0, + "path" : "TC-Shortcut/tc-sym.cpp", + "sourceGroupIndex" : 1 + }, + { + "backtrace" : 1, + "path" : "TC-Shortcut/TC-shortcut.hpp", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "compileGroupIndex" : 0, + "path" : "example.cpp", + "sourceGroupIndex" : 1 + } + ], + "type" : "EXECUTABLE" +} diff --git a/cmake-build-debug/.cmake/api/v1/reply/target-example0-Debug-722e45bf24620d8a1287.json b/cmake-build-debug/.cmake/api/v1/reply/target-example0-Debug-722e45bf24620d8a1287.json new file mode 100644 index 0000000..626e9ea --- /dev/null +++ b/cmake-build-debug/.cmake/api/v1/reply/target-example0-Debug-722e45bf24620d8a1287.json @@ -0,0 +1,275 @@ +{ + "artifacts" : + [ + { + "path" : "example0" + } + ], + "backtrace" : 1, + "backtraceGraph" : + { + "commands" : + [ + "add_executable", + "target_compile_options" + ], + "files" : + [ + "CMakeLists.txt" + ], + "nodes" : + [ + { + "file" : 0 + }, + { + "command" : 0, + "file" : 0, + "line" : 110, + "parent" : 0 + }, + { + "command" : 1, + "file" : 0, + "line" : 112, + "parent" : 0 + } + ] + }, + "compileGroups" : + [ + { + "compileCommandFragments" : + [ + { + "fragment" : "-march=native -g" + }, + { + "backtrace" : 2, + "fragment" : "-O0" + }, + { + "backtrace" : 2, + "fragment" : "-g3" + }, + { + "backtrace" : 2, + "fragment" : "-W" + }, + { + "fragment" : "-std=gnu++17" + } + ], + "language" : "CXX", + "languageStandard" : + { + "backtraces" : + [ + 1 + ], + "standard" : "17" + }, + "sourceIndexes" : + [ + 7, + 9, + 11, + 14, + 21, + 23 + ] + } + ], + "id" : "example0::@6890427a1f51a3e7e1df", + "link" : + { + "commandFragments" : + [ + { + "fragment" : "-march=native -g", + "role" : "flags" + }, + { + "fragment" : "", + "role" : "flags" + } + ], + "language" : "CXX" + }, + "name" : "example0", + "nameOnDisk" : "example0", + "paths" : + { + "build" : ".", + "source" : "." + }, + "sourceGroups" : + [ + { + "name" : "Header Files", + "sourceIndexes" : + [ + 0, + 1, + 2, + 3, + 4, + 5, + 6, + 8, + 10, + 12, + 13, + 15, + 16, + 17, + 18, + 19, + 20, + 22 + ] + }, + { + "name" : "Source Files", + "sourceIndexes" : + [ + 7, + 9, + 11, + 14, + 21, + 23 + ] + } + ], + "sources" : + [ + { + "backtrace" : 1, + "path" : "Bloom_Filter/simd-block.h", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "path" : "Bloom_Filter/simd-block-fixed-fpp.h", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "path" : "Bloom_Filter/Impala512.h", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "path" : "Bloom_Filter/bloom.hpp", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "path" : "hashutil.h", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "path" : "Tests/wrappers.hpp", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "path" : "Tests/smart_tests.hpp", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "compileGroupIndex" : 0, + "path" : "Tests/smart_tests.cpp", + "sourceGroupIndex" : 1 + }, + { + "backtrace" : 1, + "path" : "Prefix-Filter/Shift_op.hpp", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "compileGroupIndex" : 0, + "path" : "Prefix-Filter/Shift_op.cpp", + "sourceGroupIndex" : 1 + }, + { + "backtrace" : 1, + "path" : "Prefix-Filter/min_pd256.hpp", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "compileGroupIndex" : 0, + "path" : "Prefix-Filter/min_pd256.cpp", + "sourceGroupIndex" : 1 + }, + { + "backtrace" : 1, + "path" : "cuckoofilter/src/bitsutil.h", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "path" : "cuckoofilter/src/permencoding.h", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "compileGroupIndex" : 0, + "path" : "cuckoofilter/src/printutil.cc", + "sourceGroupIndex" : 1 + }, + { + "backtrace" : 1, + "path" : "cuckoofilter/src/debug.h", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "path" : "cuckoofilter/src/singletable.h", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "path" : "cuckoofilter/src/packedtable.h", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "path" : "cuckoofilter/src/cuckoofilter.h", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "path" : "cuckoofilter/src/cuckoofilter_stable.h", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "path" : "TC-Shortcut/tc-sym.hpp", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "compileGroupIndex" : 0, + "path" : "TC-Shortcut/tc-sym.cpp", + "sourceGroupIndex" : 1 + }, + { + "backtrace" : 1, + "path" : "TC-Shortcut/TC-shortcut.hpp", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "compileGroupIndex" : 0, + "path" : "example.cpp", + "sourceGroupIndex" : 1 + } + ], + "type" : "EXECUTABLE" +} diff --git a/cmake-build-debug/.cmake/api/v1/reply/target-measure_built-Debug-0ba116b65bf3d7ab6884.json b/cmake-build-debug/.cmake/api/v1/reply/target-measure_built-Debug-0ba116b65bf3d7ab6884.json new file mode 100644 index 0000000..a109b85 --- /dev/null +++ b/cmake-build-debug/.cmake/api/v1/reply/target-measure_built-Debug-0ba116b65bf3d7ab6884.json @@ -0,0 +1,271 @@ +{ + "artifacts" : + [ + { + "path" : "measure_built" + } + ], + "backtrace" : 1, + "backtraceGraph" : + { + "commands" : + [ + "add_executable", + "target_compile_options" + ], + "files" : + [ + "CMakeLists.txt" + ], + "nodes" : + [ + { + "file" : 0 + }, + { + "command" : 0, + "file" : 0, + "line" : 82, + "parent" : 0 + }, + { + "command" : 1, + "file" : 0, + "line" : 85, + "parent" : 0 + } + ] + }, + "compileGroups" : + [ + { + "compileCommandFragments" : + [ + { + "fragment" : "-march=native -g" + }, + { + "backtrace" : 2, + "fragment" : "-Ofast" + }, + { + "backtrace" : 2, + "fragment" : "-DNDEBUG" + }, + { + "fragment" : "-std=gnu++17" + } + ], + "language" : "CXX", + "languageStandard" : + { + "backtraces" : + [ + 1 + ], + "standard" : "17" + }, + "sourceIndexes" : + [ + 7, + 9, + 11, + 14, + 21, + 23 + ] + } + ], + "id" : "measure_built::@6890427a1f51a3e7e1df", + "link" : + { + "commandFragments" : + [ + { + "fragment" : "-march=native -g", + "role" : "flags" + }, + { + "fragment" : "", + "role" : "flags" + } + ], + "language" : "CXX" + }, + "name" : "measure_built", + "nameOnDisk" : "measure_built", + "paths" : + { + "build" : ".", + "source" : "." + }, + "sourceGroups" : + [ + { + "name" : "Header Files", + "sourceIndexes" : + [ + 0, + 1, + 2, + 3, + 4, + 5, + 6, + 8, + 10, + 12, + 13, + 15, + 16, + 17, + 18, + 19, + 20, + 22 + ] + }, + { + "name" : "Source Files", + "sourceIndexes" : + [ + 7, + 9, + 11, + 14, + 21, + 23 + ] + } + ], + "sources" : + [ + { + "backtrace" : 1, + "path" : "Bloom_Filter/simd-block.h", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "path" : "Bloom_Filter/simd-block-fixed-fpp.h", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "path" : "Bloom_Filter/Impala512.h", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "path" : "Bloom_Filter/bloom.hpp", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "path" : "hashutil.h", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "path" : "Tests/wrappers.hpp", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "path" : "Tests/smart_tests.hpp", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "compileGroupIndex" : 0, + "path" : "Tests/smart_tests.cpp", + "sourceGroupIndex" : 1 + }, + { + "backtrace" : 1, + "path" : "Prefix-Filter/Shift_op.hpp", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "compileGroupIndex" : 0, + "path" : "Prefix-Filter/Shift_op.cpp", + "sourceGroupIndex" : 1 + }, + { + "backtrace" : 1, + "path" : "Prefix-Filter/min_pd256.hpp", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "compileGroupIndex" : 0, + "path" : "Prefix-Filter/min_pd256.cpp", + "sourceGroupIndex" : 1 + }, + { + "backtrace" : 1, + "path" : "cuckoofilter/src/bitsutil.h", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "path" : "cuckoofilter/src/permencoding.h", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "compileGroupIndex" : 0, + "path" : "cuckoofilter/src/printutil.cc", + "sourceGroupIndex" : 1 + }, + { + "backtrace" : 1, + "path" : "cuckoofilter/src/debug.h", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "path" : "cuckoofilter/src/singletable.h", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "path" : "cuckoofilter/src/packedtable.h", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "path" : "cuckoofilter/src/cuckoofilter.h", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "path" : "cuckoofilter/src/cuckoofilter_stable.h", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "path" : "TC-Shortcut/tc-sym.hpp", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "compileGroupIndex" : 0, + "path" : "TC-Shortcut/tc-sym.cpp", + "sourceGroupIndex" : 1 + }, + { + "backtrace" : 1, + "path" : "TC-Shortcut/TC-shortcut.hpp", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "compileGroupIndex" : 0, + "path" : "main-built.cpp", + "sourceGroupIndex" : 1 + } + ], + "type" : "EXECUTABLE" +} diff --git a/cmake-build-debug/.cmake/api/v1/reply/target-measure_built0-Debug-1c26e7153ab9b4dbb397.json b/cmake-build-debug/.cmake/api/v1/reply/target-measure_built0-Debug-1c26e7153ab9b4dbb397.json new file mode 100644 index 0000000..eb9aade --- /dev/null +++ b/cmake-build-debug/.cmake/api/v1/reply/target-measure_built0-Debug-1c26e7153ab9b4dbb397.json @@ -0,0 +1,275 @@ +{ + "artifacts" : + [ + { + "path" : "measure_built0" + } + ], + "backtrace" : 1, + "backtraceGraph" : + { + "commands" : + [ + "add_executable", + "target_compile_options" + ], + "files" : + [ + "CMakeLists.txt" + ], + "nodes" : + [ + { + "file" : 0 + }, + { + "command" : 0, + "file" : 0, + "line" : 80, + "parent" : 0 + }, + { + "command" : 1, + "file" : 0, + "line" : 83, + "parent" : 0 + } + ] + }, + "compileGroups" : + [ + { + "compileCommandFragments" : + [ + { + "fragment" : "-march=native -g" + }, + { + "backtrace" : 2, + "fragment" : "-O0" + }, + { + "backtrace" : 2, + "fragment" : "-g3" + }, + { + "backtrace" : 2, + "fragment" : "-W" + }, + { + "fragment" : "-std=gnu++17" + } + ], + "language" : "CXX", + "languageStandard" : + { + "backtraces" : + [ + 1 + ], + "standard" : "17" + }, + "sourceIndexes" : + [ + 7, + 9, + 11, + 14, + 21, + 23 + ] + } + ], + "id" : "measure_built0::@6890427a1f51a3e7e1df", + "link" : + { + "commandFragments" : + [ + { + "fragment" : "-march=native -g", + "role" : "flags" + }, + { + "fragment" : "", + "role" : "flags" + } + ], + "language" : "CXX" + }, + "name" : "measure_built0", + "nameOnDisk" : "measure_built0", + "paths" : + { + "build" : ".", + "source" : "." + }, + "sourceGroups" : + [ + { + "name" : "Header Files", + "sourceIndexes" : + [ + 0, + 1, + 2, + 3, + 4, + 5, + 6, + 8, + 10, + 12, + 13, + 15, + 16, + 17, + 18, + 19, + 20, + 22 + ] + }, + { + "name" : "Source Files", + "sourceIndexes" : + [ + 7, + 9, + 11, + 14, + 21, + 23 + ] + } + ], + "sources" : + [ + { + "backtrace" : 1, + "path" : "Bloom_Filter/simd-block.h", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "path" : "Bloom_Filter/simd-block-fixed-fpp.h", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "path" : "Bloom_Filter/Impala512.h", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "path" : "Bloom_Filter/bloom.hpp", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "path" : "hashutil.h", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "path" : "Tests/wrappers.hpp", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "path" : "Tests/smart_tests.hpp", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "compileGroupIndex" : 0, + "path" : "Tests/smart_tests.cpp", + "sourceGroupIndex" : 1 + }, + { + "backtrace" : 1, + "path" : "Prefix-Filter/Shift_op.hpp", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "compileGroupIndex" : 0, + "path" : "Prefix-Filter/Shift_op.cpp", + "sourceGroupIndex" : 1 + }, + { + "backtrace" : 1, + "path" : "Prefix-Filter/min_pd256.hpp", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "compileGroupIndex" : 0, + "path" : "Prefix-Filter/min_pd256.cpp", + "sourceGroupIndex" : 1 + }, + { + "backtrace" : 1, + "path" : "cuckoofilter/src/bitsutil.h", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "path" : "cuckoofilter/src/permencoding.h", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "compileGroupIndex" : 0, + "path" : "cuckoofilter/src/printutil.cc", + "sourceGroupIndex" : 1 + }, + { + "backtrace" : 1, + "path" : "cuckoofilter/src/debug.h", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "path" : "cuckoofilter/src/singletable.h", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "path" : "cuckoofilter/src/packedtable.h", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "path" : "cuckoofilter/src/cuckoofilter.h", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "path" : "cuckoofilter/src/cuckoofilter_stable.h", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "path" : "TC-Shortcut/tc-sym.hpp", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "compileGroupIndex" : 0, + "path" : "TC-Shortcut/tc-sym.cpp", + "sourceGroupIndex" : 1 + }, + { + "backtrace" : 1, + "path" : "TC-Shortcut/TC-shortcut.hpp", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "compileGroupIndex" : 0, + "path" : "main-built.cpp", + "sourceGroupIndex" : 1 + } + ], + "type" : "EXECUTABLE" +} diff --git a/cmake-build-debug/.cmake/api/v1/reply/target-measure_built3-Debug-9e60f0edabd112451332.json b/cmake-build-debug/.cmake/api/v1/reply/target-measure_built3-Debug-9e60f0edabd112451332.json new file mode 100644 index 0000000..bc6ef2e --- /dev/null +++ b/cmake-build-debug/.cmake/api/v1/reply/target-measure_built3-Debug-9e60f0edabd112451332.json @@ -0,0 +1,271 @@ +{ + "artifacts" : + [ + { + "path" : "measure_built3" + } + ], + "backtrace" : 1, + "backtraceGraph" : + { + "commands" : + [ + "add_executable", + "target_compile_options" + ], + "files" : + [ + "CMakeLists.txt" + ], + "nodes" : + [ + { + "file" : 0 + }, + { + "command" : 0, + "file" : 0, + "line" : 81, + "parent" : 0 + }, + { + "command" : 1, + "file" : 0, + "line" : 84, + "parent" : 0 + } + ] + }, + "compileGroups" : + [ + { + "compileCommandFragments" : + [ + { + "fragment" : "-march=native -g" + }, + { + "backtrace" : 2, + "fragment" : "-O3" + }, + { + "backtrace" : 2, + "fragment" : "-g3" + }, + { + "fragment" : "-std=gnu++17" + } + ], + "language" : "CXX", + "languageStandard" : + { + "backtraces" : + [ + 1 + ], + "standard" : "17" + }, + "sourceIndexes" : + [ + 7, + 9, + 11, + 14, + 21, + 23 + ] + } + ], + "id" : "measure_built3::@6890427a1f51a3e7e1df", + "link" : + { + "commandFragments" : + [ + { + "fragment" : "-march=native -g", + "role" : "flags" + }, + { + "fragment" : "", + "role" : "flags" + } + ], + "language" : "CXX" + }, + "name" : "measure_built3", + "nameOnDisk" : "measure_built3", + "paths" : + { + "build" : ".", + "source" : "." + }, + "sourceGroups" : + [ + { + "name" : "Header Files", + "sourceIndexes" : + [ + 0, + 1, + 2, + 3, + 4, + 5, + 6, + 8, + 10, + 12, + 13, + 15, + 16, + 17, + 18, + 19, + 20, + 22 + ] + }, + { + "name" : "Source Files", + "sourceIndexes" : + [ + 7, + 9, + 11, + 14, + 21, + 23 + ] + } + ], + "sources" : + [ + { + "backtrace" : 1, + "path" : "Bloom_Filter/simd-block.h", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "path" : "Bloom_Filter/simd-block-fixed-fpp.h", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "path" : "Bloom_Filter/Impala512.h", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "path" : "Bloom_Filter/bloom.hpp", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "path" : "hashutil.h", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "path" : "Tests/wrappers.hpp", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "path" : "Tests/smart_tests.hpp", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "compileGroupIndex" : 0, + "path" : "Tests/smart_tests.cpp", + "sourceGroupIndex" : 1 + }, + { + "backtrace" : 1, + "path" : "Prefix-Filter/Shift_op.hpp", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "compileGroupIndex" : 0, + "path" : "Prefix-Filter/Shift_op.cpp", + "sourceGroupIndex" : 1 + }, + { + "backtrace" : 1, + "path" : "Prefix-Filter/min_pd256.hpp", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "compileGroupIndex" : 0, + "path" : "Prefix-Filter/min_pd256.cpp", + "sourceGroupIndex" : 1 + }, + { + "backtrace" : 1, + "path" : "cuckoofilter/src/bitsutil.h", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "path" : "cuckoofilter/src/permencoding.h", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "compileGroupIndex" : 0, + "path" : "cuckoofilter/src/printutil.cc", + "sourceGroupIndex" : 1 + }, + { + "backtrace" : 1, + "path" : "cuckoofilter/src/debug.h", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "path" : "cuckoofilter/src/singletable.h", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "path" : "cuckoofilter/src/packedtable.h", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "path" : "cuckoofilter/src/cuckoofilter.h", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "path" : "cuckoofilter/src/cuckoofilter_stable.h", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "path" : "TC-Shortcut/tc-sym.hpp", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "compileGroupIndex" : 0, + "path" : "TC-Shortcut/tc-sym.cpp", + "sourceGroupIndex" : 1 + }, + { + "backtrace" : 1, + "path" : "TC-Shortcut/TC-shortcut.hpp", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "compileGroupIndex" : 0, + "path" : "main-built.cpp", + "sourceGroupIndex" : 1 + } + ], + "type" : "EXECUTABLE" +} diff --git a/cmake-build-debug/.cmake/api/v1/reply/target-measure_fpp-Debug-6218804baa2d893c8235.json b/cmake-build-debug/.cmake/api/v1/reply/target-measure_fpp-Debug-6218804baa2d893c8235.json new file mode 100644 index 0000000..a3fd18f --- /dev/null +++ b/cmake-build-debug/.cmake/api/v1/reply/target-measure_fpp-Debug-6218804baa2d893c8235.json @@ -0,0 +1,271 @@ +{ + "artifacts" : + [ + { + "path" : "measure_fpp" + } + ], + "backtrace" : 1, + "backtraceGraph" : + { + "commands" : + [ + "add_executable", + "target_compile_options" + ], + "files" : + [ + "CMakeLists.txt" + ], + "nodes" : + [ + { + "file" : 0 + }, + { + "command" : 0, + "file" : 0, + "line" : 92, + "parent" : 0 + }, + { + "command" : 1, + "file" : 0, + "line" : 95, + "parent" : 0 + } + ] + }, + "compileGroups" : + [ + { + "compileCommandFragments" : + [ + { + "fragment" : "-march=native -g" + }, + { + "backtrace" : 2, + "fragment" : "-Ofast" + }, + { + "backtrace" : 2, + "fragment" : "-DNDEBUG" + }, + { + "fragment" : "-std=gnu++17" + } + ], + "language" : "CXX", + "languageStandard" : + { + "backtraces" : + [ + 1 + ], + "standard" : "17" + }, + "sourceIndexes" : + [ + 7, + 9, + 11, + 14, + 21, + 23 + ] + } + ], + "id" : "measure_fpp::@6890427a1f51a3e7e1df", + "link" : + { + "commandFragments" : + [ + { + "fragment" : "-march=native -g", + "role" : "flags" + }, + { + "fragment" : "", + "role" : "flags" + } + ], + "language" : "CXX" + }, + "name" : "measure_fpp", + "nameOnDisk" : "measure_fpp", + "paths" : + { + "build" : ".", + "source" : "." + }, + "sourceGroups" : + [ + { + "name" : "Header Files", + "sourceIndexes" : + [ + 0, + 1, + 2, + 3, + 4, + 5, + 6, + 8, + 10, + 12, + 13, + 15, + 16, + 17, + 18, + 19, + 20, + 22 + ] + }, + { + "name" : "Source Files", + "sourceIndexes" : + [ + 7, + 9, + 11, + 14, + 21, + 23 + ] + } + ], + "sources" : + [ + { + "backtrace" : 1, + "path" : "Bloom_Filter/simd-block.h", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "path" : "Bloom_Filter/simd-block-fixed-fpp.h", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "path" : "Bloom_Filter/Impala512.h", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "path" : "Bloom_Filter/bloom.hpp", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "path" : "hashutil.h", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "path" : "Tests/wrappers.hpp", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "path" : "Tests/smart_tests.hpp", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "compileGroupIndex" : 0, + "path" : "Tests/smart_tests.cpp", + "sourceGroupIndex" : 1 + }, + { + "backtrace" : 1, + "path" : "Prefix-Filter/Shift_op.hpp", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "compileGroupIndex" : 0, + "path" : "Prefix-Filter/Shift_op.cpp", + "sourceGroupIndex" : 1 + }, + { + "backtrace" : 1, + "path" : "Prefix-Filter/min_pd256.hpp", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "compileGroupIndex" : 0, + "path" : "Prefix-Filter/min_pd256.cpp", + "sourceGroupIndex" : 1 + }, + { + "backtrace" : 1, + "path" : "cuckoofilter/src/bitsutil.h", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "path" : "cuckoofilter/src/permencoding.h", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "compileGroupIndex" : 0, + "path" : "cuckoofilter/src/printutil.cc", + "sourceGroupIndex" : 1 + }, + { + "backtrace" : 1, + "path" : "cuckoofilter/src/debug.h", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "path" : "cuckoofilter/src/singletable.h", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "path" : "cuckoofilter/src/packedtable.h", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "path" : "cuckoofilter/src/cuckoofilter.h", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "path" : "cuckoofilter/src/cuckoofilter_stable.h", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "path" : "TC-Shortcut/tc-sym.hpp", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "compileGroupIndex" : 0, + "path" : "TC-Shortcut/tc-sym.cpp", + "sourceGroupIndex" : 1 + }, + { + "backtrace" : 1, + "path" : "TC-Shortcut/TC-shortcut.hpp", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "compileGroupIndex" : 0, + "path" : "main-fpp.cpp", + "sourceGroupIndex" : 1 + } + ], + "type" : "EXECUTABLE" +} diff --git a/cmake-build-debug/.cmake/api/v1/reply/target-measure_fpp0-Debug-ae3e716da61914872325.json b/cmake-build-debug/.cmake/api/v1/reply/target-measure_fpp0-Debug-ae3e716da61914872325.json new file mode 100644 index 0000000..0e6842e --- /dev/null +++ b/cmake-build-debug/.cmake/api/v1/reply/target-measure_fpp0-Debug-ae3e716da61914872325.json @@ -0,0 +1,275 @@ +{ + "artifacts" : + [ + { + "path" : "measure_fpp0" + } + ], + "backtrace" : 1, + "backtraceGraph" : + { + "commands" : + [ + "add_executable", + "target_compile_options" + ], + "files" : + [ + "CMakeLists.txt" + ], + "nodes" : + [ + { + "file" : 0 + }, + { + "command" : 0, + "file" : 0, + "line" : 90, + "parent" : 0 + }, + { + "command" : 1, + "file" : 0, + "line" : 93, + "parent" : 0 + } + ] + }, + "compileGroups" : + [ + { + "compileCommandFragments" : + [ + { + "fragment" : "-march=native -g" + }, + { + "backtrace" : 2, + "fragment" : "-O0" + }, + { + "backtrace" : 2, + "fragment" : "-g3" + }, + { + "backtrace" : 2, + "fragment" : "-W" + }, + { + "fragment" : "-std=gnu++17" + } + ], + "language" : "CXX", + "languageStandard" : + { + "backtraces" : + [ + 1 + ], + "standard" : "17" + }, + "sourceIndexes" : + [ + 7, + 9, + 11, + 14, + 21, + 23 + ] + } + ], + "id" : "measure_fpp0::@6890427a1f51a3e7e1df", + "link" : + { + "commandFragments" : + [ + { + "fragment" : "-march=native -g", + "role" : "flags" + }, + { + "fragment" : "", + "role" : "flags" + } + ], + "language" : "CXX" + }, + "name" : "measure_fpp0", + "nameOnDisk" : "measure_fpp0", + "paths" : + { + "build" : ".", + "source" : "." + }, + "sourceGroups" : + [ + { + "name" : "Header Files", + "sourceIndexes" : + [ + 0, + 1, + 2, + 3, + 4, + 5, + 6, + 8, + 10, + 12, + 13, + 15, + 16, + 17, + 18, + 19, + 20, + 22 + ] + }, + { + "name" : "Source Files", + "sourceIndexes" : + [ + 7, + 9, + 11, + 14, + 21, + 23 + ] + } + ], + "sources" : + [ + { + "backtrace" : 1, + "path" : "Bloom_Filter/simd-block.h", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "path" : "Bloom_Filter/simd-block-fixed-fpp.h", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "path" : "Bloom_Filter/Impala512.h", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "path" : "Bloom_Filter/bloom.hpp", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "path" : "hashutil.h", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "path" : "Tests/wrappers.hpp", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "path" : "Tests/smart_tests.hpp", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "compileGroupIndex" : 0, + "path" : "Tests/smart_tests.cpp", + "sourceGroupIndex" : 1 + }, + { + "backtrace" : 1, + "path" : "Prefix-Filter/Shift_op.hpp", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "compileGroupIndex" : 0, + "path" : "Prefix-Filter/Shift_op.cpp", + "sourceGroupIndex" : 1 + }, + { + "backtrace" : 1, + "path" : "Prefix-Filter/min_pd256.hpp", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "compileGroupIndex" : 0, + "path" : "Prefix-Filter/min_pd256.cpp", + "sourceGroupIndex" : 1 + }, + { + "backtrace" : 1, + "path" : "cuckoofilter/src/bitsutil.h", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "path" : "cuckoofilter/src/permencoding.h", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "compileGroupIndex" : 0, + "path" : "cuckoofilter/src/printutil.cc", + "sourceGroupIndex" : 1 + }, + { + "backtrace" : 1, + "path" : "cuckoofilter/src/debug.h", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "path" : "cuckoofilter/src/singletable.h", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "path" : "cuckoofilter/src/packedtable.h", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "path" : "cuckoofilter/src/cuckoofilter.h", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "path" : "cuckoofilter/src/cuckoofilter_stable.h", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "path" : "TC-Shortcut/tc-sym.hpp", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "compileGroupIndex" : 0, + "path" : "TC-Shortcut/tc-sym.cpp", + "sourceGroupIndex" : 1 + }, + { + "backtrace" : 1, + "path" : "TC-Shortcut/TC-shortcut.hpp", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "compileGroupIndex" : 0, + "path" : "main-fpp.cpp", + "sourceGroupIndex" : 1 + } + ], + "type" : "EXECUTABLE" +} diff --git a/cmake-build-debug/.cmake/api/v1/reply/target-measure_fpp3-Debug-12090f7133d04d45c993.json b/cmake-build-debug/.cmake/api/v1/reply/target-measure_fpp3-Debug-12090f7133d04d45c993.json new file mode 100644 index 0000000..4b13c3e --- /dev/null +++ b/cmake-build-debug/.cmake/api/v1/reply/target-measure_fpp3-Debug-12090f7133d04d45c993.json @@ -0,0 +1,271 @@ +{ + "artifacts" : + [ + { + "path" : "measure_fpp3" + } + ], + "backtrace" : 1, + "backtraceGraph" : + { + "commands" : + [ + "add_executable", + "target_compile_options" + ], + "files" : + [ + "CMakeLists.txt" + ], + "nodes" : + [ + { + "file" : 0 + }, + { + "command" : 0, + "file" : 0, + "line" : 91, + "parent" : 0 + }, + { + "command" : 1, + "file" : 0, + "line" : 94, + "parent" : 0 + } + ] + }, + "compileGroups" : + [ + { + "compileCommandFragments" : + [ + { + "fragment" : "-march=native -g" + }, + { + "backtrace" : 2, + "fragment" : "-O3" + }, + { + "backtrace" : 2, + "fragment" : "-g3" + }, + { + "fragment" : "-std=gnu++17" + } + ], + "language" : "CXX", + "languageStandard" : + { + "backtraces" : + [ + 1 + ], + "standard" : "17" + }, + "sourceIndexes" : + [ + 7, + 9, + 11, + 14, + 21, + 23 + ] + } + ], + "id" : "measure_fpp3::@6890427a1f51a3e7e1df", + "link" : + { + "commandFragments" : + [ + { + "fragment" : "-march=native -g", + "role" : "flags" + }, + { + "fragment" : "", + "role" : "flags" + } + ], + "language" : "CXX" + }, + "name" : "measure_fpp3", + "nameOnDisk" : "measure_fpp3", + "paths" : + { + "build" : ".", + "source" : "." + }, + "sourceGroups" : + [ + { + "name" : "Header Files", + "sourceIndexes" : + [ + 0, + 1, + 2, + 3, + 4, + 5, + 6, + 8, + 10, + 12, + 13, + 15, + 16, + 17, + 18, + 19, + 20, + 22 + ] + }, + { + "name" : "Source Files", + "sourceIndexes" : + [ + 7, + 9, + 11, + 14, + 21, + 23 + ] + } + ], + "sources" : + [ + { + "backtrace" : 1, + "path" : "Bloom_Filter/simd-block.h", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "path" : "Bloom_Filter/simd-block-fixed-fpp.h", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "path" : "Bloom_Filter/Impala512.h", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "path" : "Bloom_Filter/bloom.hpp", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "path" : "hashutil.h", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "path" : "Tests/wrappers.hpp", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "path" : "Tests/smart_tests.hpp", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "compileGroupIndex" : 0, + "path" : "Tests/smart_tests.cpp", + "sourceGroupIndex" : 1 + }, + { + "backtrace" : 1, + "path" : "Prefix-Filter/Shift_op.hpp", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "compileGroupIndex" : 0, + "path" : "Prefix-Filter/Shift_op.cpp", + "sourceGroupIndex" : 1 + }, + { + "backtrace" : 1, + "path" : "Prefix-Filter/min_pd256.hpp", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "compileGroupIndex" : 0, + "path" : "Prefix-Filter/min_pd256.cpp", + "sourceGroupIndex" : 1 + }, + { + "backtrace" : 1, + "path" : "cuckoofilter/src/bitsutil.h", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "path" : "cuckoofilter/src/permencoding.h", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "compileGroupIndex" : 0, + "path" : "cuckoofilter/src/printutil.cc", + "sourceGroupIndex" : 1 + }, + { + "backtrace" : 1, + "path" : "cuckoofilter/src/debug.h", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "path" : "cuckoofilter/src/singletable.h", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "path" : "cuckoofilter/src/packedtable.h", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "path" : "cuckoofilter/src/cuckoofilter.h", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "path" : "cuckoofilter/src/cuckoofilter_stable.h", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "path" : "TC-Shortcut/tc-sym.hpp", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "compileGroupIndex" : 0, + "path" : "TC-Shortcut/tc-sym.cpp", + "sourceGroupIndex" : 1 + }, + { + "backtrace" : 1, + "path" : "TC-Shortcut/TC-shortcut.hpp", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "compileGroupIndex" : 0, + "path" : "main-fpp.cpp", + "sourceGroupIndex" : 1 + } + ], + "type" : "EXECUTABLE" +} diff --git a/cmake-build-debug/.cmake/api/v1/reply/target-measure_perf-Debug-a7f31f032634834b67c5.json b/cmake-build-debug/.cmake/api/v1/reply/target-measure_perf-Debug-a7f31f032634834b67c5.json new file mode 100644 index 0000000..3359b09 --- /dev/null +++ b/cmake-build-debug/.cmake/api/v1/reply/target-measure_perf-Debug-a7f31f032634834b67c5.json @@ -0,0 +1,271 @@ +{ + "artifacts" : + [ + { + "path" : "measure_perf" + } + ], + "backtrace" : 1, + "backtraceGraph" : + { + "commands" : + [ + "add_executable", + "target_compile_options" + ], + "files" : + [ + "CMakeLists.txt" + ], + "nodes" : + [ + { + "file" : 0 + }, + { + "command" : 0, + "file" : 0, + "line" : 102, + "parent" : 0 + }, + { + "command" : 1, + "file" : 0, + "line" : 105, + "parent" : 0 + } + ] + }, + "compileGroups" : + [ + { + "compileCommandFragments" : + [ + { + "fragment" : "-march=native -g" + }, + { + "backtrace" : 2, + "fragment" : "-Ofast" + }, + { + "backtrace" : 2, + "fragment" : "-DNDEBUG" + }, + { + "fragment" : "-std=gnu++17" + } + ], + "language" : "CXX", + "languageStandard" : + { + "backtraces" : + [ + 1 + ], + "standard" : "17" + }, + "sourceIndexes" : + [ + 7, + 9, + 11, + 14, + 21, + 23 + ] + } + ], + "id" : "measure_perf::@6890427a1f51a3e7e1df", + "link" : + { + "commandFragments" : + [ + { + "fragment" : "-march=native -g", + "role" : "flags" + }, + { + "fragment" : "", + "role" : "flags" + } + ], + "language" : "CXX" + }, + "name" : "measure_perf", + "nameOnDisk" : "measure_perf", + "paths" : + { + "build" : ".", + "source" : "." + }, + "sourceGroups" : + [ + { + "name" : "Header Files", + "sourceIndexes" : + [ + 0, + 1, + 2, + 3, + 4, + 5, + 6, + 8, + 10, + 12, + 13, + 15, + 16, + 17, + 18, + 19, + 20, + 22 + ] + }, + { + "name" : "Source Files", + "sourceIndexes" : + [ + 7, + 9, + 11, + 14, + 21, + 23 + ] + } + ], + "sources" : + [ + { + "backtrace" : 1, + "path" : "Bloom_Filter/simd-block.h", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "path" : "Bloom_Filter/simd-block-fixed-fpp.h", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "path" : "Bloom_Filter/Impala512.h", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "path" : "Bloom_Filter/bloom.hpp", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "path" : "hashutil.h", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "path" : "Tests/wrappers.hpp", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "path" : "Tests/smart_tests.hpp", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "compileGroupIndex" : 0, + "path" : "Tests/smart_tests.cpp", + "sourceGroupIndex" : 1 + }, + { + "backtrace" : 1, + "path" : "Prefix-Filter/Shift_op.hpp", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "compileGroupIndex" : 0, + "path" : "Prefix-Filter/Shift_op.cpp", + "sourceGroupIndex" : 1 + }, + { + "backtrace" : 1, + "path" : "Prefix-Filter/min_pd256.hpp", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "compileGroupIndex" : 0, + "path" : "Prefix-Filter/min_pd256.cpp", + "sourceGroupIndex" : 1 + }, + { + "backtrace" : 1, + "path" : "cuckoofilter/src/bitsutil.h", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "path" : "cuckoofilter/src/permencoding.h", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "compileGroupIndex" : 0, + "path" : "cuckoofilter/src/printutil.cc", + "sourceGroupIndex" : 1 + }, + { + "backtrace" : 1, + "path" : "cuckoofilter/src/debug.h", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "path" : "cuckoofilter/src/singletable.h", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "path" : "cuckoofilter/src/packedtable.h", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "path" : "cuckoofilter/src/cuckoofilter.h", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "path" : "cuckoofilter/src/cuckoofilter_stable.h", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "path" : "TC-Shortcut/tc-sym.hpp", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "compileGroupIndex" : 0, + "path" : "TC-Shortcut/tc-sym.cpp", + "sourceGroupIndex" : 1 + }, + { + "backtrace" : 1, + "path" : "TC-Shortcut/TC-shortcut.hpp", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "compileGroupIndex" : 0, + "path" : "main-perf.cpp", + "sourceGroupIndex" : 1 + } + ], + "type" : "EXECUTABLE" +} diff --git a/cmake-build-debug/.cmake/api/v1/reply/target-measure_perf0-Debug-b41767523d8bde5ed7bd.json b/cmake-build-debug/.cmake/api/v1/reply/target-measure_perf0-Debug-b41767523d8bde5ed7bd.json new file mode 100644 index 0000000..609d9d4 --- /dev/null +++ b/cmake-build-debug/.cmake/api/v1/reply/target-measure_perf0-Debug-b41767523d8bde5ed7bd.json @@ -0,0 +1,275 @@ +{ + "artifacts" : + [ + { + "path" : "measure_perf0" + } + ], + "backtrace" : 1, + "backtraceGraph" : + { + "commands" : + [ + "add_executable", + "target_compile_options" + ], + "files" : + [ + "CMakeLists.txt" + ], + "nodes" : + [ + { + "file" : 0 + }, + { + "command" : 0, + "file" : 0, + "line" : 100, + "parent" : 0 + }, + { + "command" : 1, + "file" : 0, + "line" : 103, + "parent" : 0 + } + ] + }, + "compileGroups" : + [ + { + "compileCommandFragments" : + [ + { + "fragment" : "-march=native -g" + }, + { + "backtrace" : 2, + "fragment" : "-O0" + }, + { + "backtrace" : 2, + "fragment" : "-g3" + }, + { + "backtrace" : 2, + "fragment" : "-W" + }, + { + "fragment" : "-std=gnu++17" + } + ], + "language" : "CXX", + "languageStandard" : + { + "backtraces" : + [ + 1 + ], + "standard" : "17" + }, + "sourceIndexes" : + [ + 7, + 9, + 11, + 14, + 21, + 23 + ] + } + ], + "id" : "measure_perf0::@6890427a1f51a3e7e1df", + "link" : + { + "commandFragments" : + [ + { + "fragment" : "-march=native -g", + "role" : "flags" + }, + { + "fragment" : "", + "role" : "flags" + } + ], + "language" : "CXX" + }, + "name" : "measure_perf0", + "nameOnDisk" : "measure_perf0", + "paths" : + { + "build" : ".", + "source" : "." + }, + "sourceGroups" : + [ + { + "name" : "Header Files", + "sourceIndexes" : + [ + 0, + 1, + 2, + 3, + 4, + 5, + 6, + 8, + 10, + 12, + 13, + 15, + 16, + 17, + 18, + 19, + 20, + 22 + ] + }, + { + "name" : "Source Files", + "sourceIndexes" : + [ + 7, + 9, + 11, + 14, + 21, + 23 + ] + } + ], + "sources" : + [ + { + "backtrace" : 1, + "path" : "Bloom_Filter/simd-block.h", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "path" : "Bloom_Filter/simd-block-fixed-fpp.h", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "path" : "Bloom_Filter/Impala512.h", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "path" : "Bloom_Filter/bloom.hpp", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "path" : "hashutil.h", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "path" : "Tests/wrappers.hpp", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "path" : "Tests/smart_tests.hpp", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "compileGroupIndex" : 0, + "path" : "Tests/smart_tests.cpp", + "sourceGroupIndex" : 1 + }, + { + "backtrace" : 1, + "path" : "Prefix-Filter/Shift_op.hpp", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "compileGroupIndex" : 0, + "path" : "Prefix-Filter/Shift_op.cpp", + "sourceGroupIndex" : 1 + }, + { + "backtrace" : 1, + "path" : "Prefix-Filter/min_pd256.hpp", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "compileGroupIndex" : 0, + "path" : "Prefix-Filter/min_pd256.cpp", + "sourceGroupIndex" : 1 + }, + { + "backtrace" : 1, + "path" : "cuckoofilter/src/bitsutil.h", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "path" : "cuckoofilter/src/permencoding.h", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "compileGroupIndex" : 0, + "path" : "cuckoofilter/src/printutil.cc", + "sourceGroupIndex" : 1 + }, + { + "backtrace" : 1, + "path" : "cuckoofilter/src/debug.h", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "path" : "cuckoofilter/src/singletable.h", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "path" : "cuckoofilter/src/packedtable.h", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "path" : "cuckoofilter/src/cuckoofilter.h", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "path" : "cuckoofilter/src/cuckoofilter_stable.h", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "path" : "TC-Shortcut/tc-sym.hpp", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "compileGroupIndex" : 0, + "path" : "TC-Shortcut/tc-sym.cpp", + "sourceGroupIndex" : 1 + }, + { + "backtrace" : 1, + "path" : "TC-Shortcut/TC-shortcut.hpp", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "compileGroupIndex" : 0, + "path" : "main-perf.cpp", + "sourceGroupIndex" : 1 + } + ], + "type" : "EXECUTABLE" +} diff --git a/cmake-build-debug/.cmake/api/v1/reply/target-measure_perf3-Debug-1815e855f242cbd76a5a.json b/cmake-build-debug/.cmake/api/v1/reply/target-measure_perf3-Debug-1815e855f242cbd76a5a.json new file mode 100644 index 0000000..410221f --- /dev/null +++ b/cmake-build-debug/.cmake/api/v1/reply/target-measure_perf3-Debug-1815e855f242cbd76a5a.json @@ -0,0 +1,271 @@ +{ + "artifacts" : + [ + { + "path" : "measure_perf3" + } + ], + "backtrace" : 1, + "backtraceGraph" : + { + "commands" : + [ + "add_executable", + "target_compile_options" + ], + "files" : + [ + "CMakeLists.txt" + ], + "nodes" : + [ + { + "file" : 0 + }, + { + "command" : 0, + "file" : 0, + "line" : 101, + "parent" : 0 + }, + { + "command" : 1, + "file" : 0, + "line" : 104, + "parent" : 0 + } + ] + }, + "compileGroups" : + [ + { + "compileCommandFragments" : + [ + { + "fragment" : "-march=native -g" + }, + { + "backtrace" : 2, + "fragment" : "-O3" + }, + { + "backtrace" : 2, + "fragment" : "-g3" + }, + { + "fragment" : "-std=gnu++17" + } + ], + "language" : "CXX", + "languageStandard" : + { + "backtraces" : + [ + 1 + ], + "standard" : "17" + }, + "sourceIndexes" : + [ + 7, + 9, + 11, + 14, + 21, + 23 + ] + } + ], + "id" : "measure_perf3::@6890427a1f51a3e7e1df", + "link" : + { + "commandFragments" : + [ + { + "fragment" : "-march=native -g", + "role" : "flags" + }, + { + "fragment" : "", + "role" : "flags" + } + ], + "language" : "CXX" + }, + "name" : "measure_perf3", + "nameOnDisk" : "measure_perf3", + "paths" : + { + "build" : ".", + "source" : "." + }, + "sourceGroups" : + [ + { + "name" : "Header Files", + "sourceIndexes" : + [ + 0, + 1, + 2, + 3, + 4, + 5, + 6, + 8, + 10, + 12, + 13, + 15, + 16, + 17, + 18, + 19, + 20, + 22 + ] + }, + { + "name" : "Source Files", + "sourceIndexes" : + [ + 7, + 9, + 11, + 14, + 21, + 23 + ] + } + ], + "sources" : + [ + { + "backtrace" : 1, + "path" : "Bloom_Filter/simd-block.h", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "path" : "Bloom_Filter/simd-block-fixed-fpp.h", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "path" : "Bloom_Filter/Impala512.h", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "path" : "Bloom_Filter/bloom.hpp", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "path" : "hashutil.h", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "path" : "Tests/wrappers.hpp", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "path" : "Tests/smart_tests.hpp", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "compileGroupIndex" : 0, + "path" : "Tests/smart_tests.cpp", + "sourceGroupIndex" : 1 + }, + { + "backtrace" : 1, + "path" : "Prefix-Filter/Shift_op.hpp", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "compileGroupIndex" : 0, + "path" : "Prefix-Filter/Shift_op.cpp", + "sourceGroupIndex" : 1 + }, + { + "backtrace" : 1, + "path" : "Prefix-Filter/min_pd256.hpp", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "compileGroupIndex" : 0, + "path" : "Prefix-Filter/min_pd256.cpp", + "sourceGroupIndex" : 1 + }, + { + "backtrace" : 1, + "path" : "cuckoofilter/src/bitsutil.h", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "path" : "cuckoofilter/src/permencoding.h", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "compileGroupIndex" : 0, + "path" : "cuckoofilter/src/printutil.cc", + "sourceGroupIndex" : 1 + }, + { + "backtrace" : 1, + "path" : "cuckoofilter/src/debug.h", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "path" : "cuckoofilter/src/singletable.h", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "path" : "cuckoofilter/src/packedtable.h", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "path" : "cuckoofilter/src/cuckoofilter.h", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "path" : "cuckoofilter/src/cuckoofilter_stable.h", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "path" : "TC-Shortcut/tc-sym.hpp", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "compileGroupIndex" : 0, + "path" : "TC-Shortcut/tc-sym.cpp", + "sourceGroupIndex" : 1 + }, + { + "backtrace" : 1, + "path" : "TC-Shortcut/TC-shortcut.hpp", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "compileGroupIndex" : 0, + "path" : "main-perf.cpp", + "sourceGroupIndex" : 1 + } + ], + "type" : "EXECUTABLE" +} diff --git a/cmake-build-debug/.cmake/api/v1/reply/toolchains-v1-b0b7064a037a803f7bb5.json b/cmake-build-debug/.cmake/api/v1/reply/toolchains-v1-b0b7064a037a803f7bb5.json new file mode 100644 index 0000000..d4668c5 --- /dev/null +++ b/cmake-build-debug/.cmake/api/v1/reply/toolchains-v1-b0b7064a037a803f7bb5.json @@ -0,0 +1,107 @@ +{ + "kind" : "toolchains", + "toolchains" : + [ + { + "compiler" : + { + "id" : "GNU", + "implicit" : + { + "includeDirectories" : + [ + "/usr/lib/gcc/x86_64-linux-gnu/10/include", + "/usr/local/include", + "/usr/include/x86_64-linux-gnu", + "/usr/include" + ], + "linkDirectories" : + [ + "/usr/lib/gcc/x86_64-linux-gnu/10", + "/usr/lib/x86_64-linux-gnu", + "/usr/lib", + "/lib/x86_64-linux-gnu", + "/lib" + ], + "linkFrameworkDirectories" : [], + "linkLibraries" : + [ + "gcc", + "gcc_s", + "c", + "gcc", + "gcc_s" + ] + }, + "path" : "/usr/bin/gcc-10", + "version" : "10.3.0" + }, + "language" : "C", + "sourceFileExtensions" : + [ + "c", + "m" + ] + }, + { + "compiler" : + { + "id" : "GNU", + "implicit" : + { + "includeDirectories" : + [ + "/usr/include/c++/10", + "/usr/include/x86_64-linux-gnu/c++/10", + "/usr/include/c++/10/backward", + "/usr/lib/gcc/x86_64-linux-gnu/10/include", + "/usr/local/include", + "/usr/include/x86_64-linux-gnu", + "/usr/include" + ], + "linkDirectories" : + [ + "/usr/lib/gcc/x86_64-linux-gnu/10", + "/usr/lib/x86_64-linux-gnu", + "/usr/lib", + "/lib/x86_64-linux-gnu", + "/lib" + ], + "linkFrameworkDirectories" : [], + "linkLibraries" : + [ + "stdc++", + "m", + "gcc_s", + "gcc", + "c", + "gcc_s", + "gcc" + ] + }, + "path" : "/usr/bin/g++-10", + "version" : "10.3.0" + }, + "language" : "CXX", + "sourceFileExtensions" : + [ + "C", + "M", + "c++", + "cc", + "cpp", + "cxx", + "mm", + "mpp", + "CPP", + "ixx", + "cppm" + ] + } + ], + "version" : + { + "major" : 1, + "minor" : 0 + } +} diff --git a/cmake-build-debug/CMakeCache.txt b/cmake-build-debug/CMakeCache.txt new file mode 100644 index 0000000..3a7d020 --- /dev/null +++ b/cmake-build-debug/CMakeCache.txt @@ -0,0 +1,362 @@ +# This is the CMakeCache file. +# For build in directory: /home/tomer/Github/Public-PF/cmake-build-debug +# It was generated by CMake: /snap/clion/184/bin/cmake/linux/bin/cmake +# You can edit this file to change values found and used by cmake. +# If you do not want to change any of the values, simply exit the editor. +# If you do want to change a value, simply edit, save, and exit the editor. +# The syntax for the file is as follows: +# KEY:TYPE=VALUE +# KEY is the name of a variable in the cache. +# TYPE is a hint to GUIs for the type of VALUE, DO NOT EDIT TYPE!. +# VALUE is the current value for the KEY. + +######################## +# EXTERNAL cache entries +######################## + +//Value Computed by CMake +APD_ONLY_BINARY_DIR:STATIC=/home/tomer/Github/Public-PF/cmake-build-debug + +//Value Computed by CMake +APD_ONLY_IS_TOP_LEVEL:STATIC=ON + +//Value Computed by CMake +APD_ONLY_SOURCE_DIR:STATIC=/home/tomer/Github/Public-PF + +//Path to a program. +CMAKE_ADDR2LINE:FILEPATH=/usr/bin/addr2line + +//Path to a program. +CMAKE_AR:FILEPATH=/usr/bin/ar + +//Choose the type of build, options are: None Debug Release RelWithDebInfo +// MinSizeRel ... +CMAKE_BUILD_TYPE:STRING=Debug + +//CXX compiler +CMAKE_CXX_COMPILER:STRING=/usr/bin/g++-10 + +//A wrapper around 'ar' adding the appropriate '--plugin' option +// for the GCC compiler +CMAKE_CXX_COMPILER_AR:FILEPATH=/usr/bin/gcc-ar-10 + +//A wrapper around 'ranlib' adding the appropriate '--plugin' option +// for the GCC compiler +CMAKE_CXX_COMPILER_RANLIB:FILEPATH=/usr/bin/gcc-ranlib-10 + +//Flags used by the CXX compiler during all build types. +CMAKE_CXX_FLAGS:STRING= + +//Flags used by the CXX compiler during DEBUG builds. +CMAKE_CXX_FLAGS_DEBUG:STRING=-g + +//Flags used by the CXX compiler during MINSIZEREL builds. +CMAKE_CXX_FLAGS_MINSIZEREL:STRING=-Os -DNDEBUG + +//Flags used by the CXX compiler during RELEASE builds. +CMAKE_CXX_FLAGS_RELEASE:STRING=-O3 -DNDEBUG + +//Flags used by the CXX compiler during RELWITHDEBINFO builds. +CMAKE_CXX_FLAGS_RELWITHDEBINFO:STRING=-O2 -g -DNDEBUG + +//C compiler +CMAKE_C_COMPILER:STRING=/usr/bin/gcc-10 + +//A wrapper around 'ar' adding the appropriate '--plugin' option +// for the GCC compiler +CMAKE_C_COMPILER_AR:FILEPATH=/usr/bin/gcc-ar-10 + +//A wrapper around 'ranlib' adding the appropriate '--plugin' option +// for the GCC compiler +CMAKE_C_COMPILER_RANLIB:FILEPATH=/usr/bin/gcc-ranlib-10 + +//Flags used by the C compiler during all build types. +CMAKE_C_FLAGS:STRING= + +//Flags used by the C compiler during DEBUG builds. +CMAKE_C_FLAGS_DEBUG:STRING=-g + +//Flags used by the C compiler during MINSIZEREL builds. +CMAKE_C_FLAGS_MINSIZEREL:STRING=-Os -DNDEBUG + +//Flags used by the C compiler during RELEASE builds. +CMAKE_C_FLAGS_RELEASE:STRING=-O3 -DNDEBUG + +//Flags used by the C compiler during RELWITHDEBINFO builds. +CMAKE_C_FLAGS_RELWITHDEBINFO:STRING=-O2 -g -DNDEBUG + +//Path to a program. +CMAKE_DLLTOOL:FILEPATH=CMAKE_DLLTOOL-NOTFOUND + +//Flags used by the linker during all build types. +CMAKE_EXE_LINKER_FLAGS:STRING= + +//Flags used by the linker during DEBUG builds. +CMAKE_EXE_LINKER_FLAGS_DEBUG:STRING= + +//Flags used by the linker during MINSIZEREL builds. +CMAKE_EXE_LINKER_FLAGS_MINSIZEREL:STRING= + +//Flags used by the linker during RELEASE builds. +CMAKE_EXE_LINKER_FLAGS_RELEASE:STRING= + +//Flags used by the linker during RELWITHDEBINFO builds. +CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO:STRING= + +//Enable/Disable output of compile commands during generation. +CMAKE_EXPORT_COMPILE_COMMANDS:BOOL= + +//Install path prefix, prepended onto install directories. +CMAKE_INSTALL_PREFIX:PATH=/usr/local + +//Path to a program. +CMAKE_LINKER:FILEPATH=/usr/bin/ld + +//No help, variable specified on the command line. +CMAKE_MAKE_PROGRAM:UNINITIALIZED=/snap/clion/184/bin/ninja/linux/ninja + +//Flags used by the linker during the creation of modules during +// all build types. +CMAKE_MODULE_LINKER_FLAGS:STRING= + +//Flags used by the linker during the creation of modules during +// DEBUG builds. +CMAKE_MODULE_LINKER_FLAGS_DEBUG:STRING= + +//Flags used by the linker during the creation of modules during +// MINSIZEREL builds. +CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL:STRING= + +//Flags used by the linker during the creation of modules during +// RELEASE builds. +CMAKE_MODULE_LINKER_FLAGS_RELEASE:STRING= + +//Flags used by the linker during the creation of modules during +// RELWITHDEBINFO builds. +CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO:STRING= + +//Path to a program. +CMAKE_NM:FILEPATH=/usr/bin/nm + +//Path to a program. +CMAKE_OBJCOPY:FILEPATH=/usr/bin/objcopy + +//Path to a program. +CMAKE_OBJDUMP:FILEPATH=/usr/bin/objdump + +//Value Computed by CMake +CMAKE_PROJECT_DESCRIPTION:STATIC= + +//Value Computed by CMake +CMAKE_PROJECT_HOMEPAGE_URL:STATIC= + +//Value Computed by CMake +CMAKE_PROJECT_NAME:STATIC=APD_ONLY + +//Path to a program. +CMAKE_RANLIB:FILEPATH=/usr/bin/ranlib + +//Path to a program. +CMAKE_READELF:FILEPATH=/usr/bin/readelf + +//Flags used by the linker during the creation of shared libraries +// during all build types. +CMAKE_SHARED_LINKER_FLAGS:STRING= + +//Flags used by the linker during the creation of shared libraries +// during DEBUG builds. +CMAKE_SHARED_LINKER_FLAGS_DEBUG:STRING= + +//Flags used by the linker during the creation of shared libraries +// during MINSIZEREL builds. +CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL:STRING= + +//Flags used by the linker during the creation of shared libraries +// during RELEASE builds. +CMAKE_SHARED_LINKER_FLAGS_RELEASE:STRING= + +//Flags used by the linker during the creation of shared libraries +// during RELWITHDEBINFO builds. +CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO:STRING= + +//If set, runtime paths are not added when installing shared libraries, +// but are added when building. +CMAKE_SKIP_INSTALL_RPATH:BOOL=NO + +//If set, runtime paths are not added when using shared libraries. +CMAKE_SKIP_RPATH:BOOL=NO + +//Flags used by the linker during the creation of static libraries +// during all build types. +CMAKE_STATIC_LINKER_FLAGS:STRING= + +//Flags used by the linker during the creation of static libraries +// during DEBUG builds. +CMAKE_STATIC_LINKER_FLAGS_DEBUG:STRING= + +//Flags used by the linker during the creation of static libraries +// during MINSIZEREL builds. +CMAKE_STATIC_LINKER_FLAGS_MINSIZEREL:STRING= + +//Flags used by the linker during the creation of static libraries +// during RELEASE builds. +CMAKE_STATIC_LINKER_FLAGS_RELEASE:STRING= + +//Flags used by the linker during the creation of static libraries +// during RELWITHDEBINFO builds. +CMAKE_STATIC_LINKER_FLAGS_RELWITHDEBINFO:STRING= + +//Path to a program. +CMAKE_STRIP:FILEPATH=/usr/bin/strip + +//If this value is on, makefiles will be generated without the +// .SILENT directive, and all commands will be echoed to the console +// during the make. This is useful for debugging only. With Visual +// Studio IDE projects all commands are done without /nologo. +CMAKE_VERBOSE_MAKEFILE:BOOL=FALSE + + +######################## +# INTERNAL cache entries +######################## + +//ADVANCED property for variable: CMAKE_ADDR2LINE +CMAKE_ADDR2LINE-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_AR +CMAKE_AR-ADVANCED:INTERNAL=1 +//This is the directory where this CMakeCache.txt was created +CMAKE_CACHEFILE_DIR:INTERNAL=/home/tomer/Github/Public-PF/cmake-build-debug +//Major version of cmake used to create the current loaded cache +CMAKE_CACHE_MAJOR_VERSION:INTERNAL=3 +//Minor version of cmake used to create the current loaded cache +CMAKE_CACHE_MINOR_VERSION:INTERNAL=21 +//Patch version of cmake used to create the current loaded cache +CMAKE_CACHE_PATCH_VERSION:INTERNAL=1 +//Path to CMake executable. +CMAKE_COMMAND:INTERNAL=/snap/clion/184/bin/cmake/linux/bin/cmake +//Path to cpack program executable. +CMAKE_CPACK_COMMAND:INTERNAL=/snap/clion/184/bin/cmake/linux/bin/cpack +//Path to ctest program executable. +CMAKE_CTEST_COMMAND:INTERNAL=/snap/clion/184/bin/cmake/linux/bin/ctest +//ADVANCED property for variable: CMAKE_CXX_COMPILER +CMAKE_CXX_COMPILER-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_CXX_COMPILER_AR +CMAKE_CXX_COMPILER_AR-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_CXX_COMPILER_RANLIB +CMAKE_CXX_COMPILER_RANLIB-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_CXX_FLAGS +CMAKE_CXX_FLAGS-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_CXX_FLAGS_DEBUG +CMAKE_CXX_FLAGS_DEBUG-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_CXX_FLAGS_MINSIZEREL +CMAKE_CXX_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_CXX_FLAGS_RELEASE +CMAKE_CXX_FLAGS_RELEASE-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_CXX_FLAGS_RELWITHDEBINFO +CMAKE_CXX_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_C_COMPILER +CMAKE_C_COMPILER-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_C_COMPILER_AR +CMAKE_C_COMPILER_AR-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_C_COMPILER_RANLIB +CMAKE_C_COMPILER_RANLIB-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_C_FLAGS +CMAKE_C_FLAGS-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_C_FLAGS_DEBUG +CMAKE_C_FLAGS_DEBUG-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_C_FLAGS_MINSIZEREL +CMAKE_C_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_C_FLAGS_RELEASE +CMAKE_C_FLAGS_RELEASE-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_C_FLAGS_RELWITHDEBINFO +CMAKE_C_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_DLLTOOL +CMAKE_DLLTOOL-ADVANCED:INTERNAL=1 +//Executable file format +CMAKE_EXECUTABLE_FORMAT:INTERNAL=ELF +//ADVANCED property for variable: CMAKE_EXE_LINKER_FLAGS +CMAKE_EXE_LINKER_FLAGS-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_EXE_LINKER_FLAGS_DEBUG +CMAKE_EXE_LINKER_FLAGS_DEBUG-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_EXE_LINKER_FLAGS_MINSIZEREL +CMAKE_EXE_LINKER_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_EXE_LINKER_FLAGS_RELEASE +CMAKE_EXE_LINKER_FLAGS_RELEASE-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO +CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_EXPORT_COMPILE_COMMANDS +CMAKE_EXPORT_COMPILE_COMMANDS-ADVANCED:INTERNAL=1 +//Name of external makefile project generator. +CMAKE_EXTRA_GENERATOR:INTERNAL= +//Name of generator. +CMAKE_GENERATOR:INTERNAL=Ninja +//Generator instance identifier. +CMAKE_GENERATOR_INSTANCE:INTERNAL= +//Name of generator platform. +CMAKE_GENERATOR_PLATFORM:INTERNAL= +//Name of generator toolset. +CMAKE_GENERATOR_TOOLSET:INTERNAL= +//Source directory with the top level CMakeLists.txt file for this +// project +CMAKE_HOME_DIRECTORY:INTERNAL=/home/tomer/Github/Public-PF +//Install .so files without execute permission. +CMAKE_INSTALL_SO_NO_EXE:INTERNAL=1 +//ADVANCED property for variable: CMAKE_LINKER +CMAKE_LINKER-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_MODULE_LINKER_FLAGS +CMAKE_MODULE_LINKER_FLAGS-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_MODULE_LINKER_FLAGS_DEBUG +CMAKE_MODULE_LINKER_FLAGS_DEBUG-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL +CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_MODULE_LINKER_FLAGS_RELEASE +CMAKE_MODULE_LINKER_FLAGS_RELEASE-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO +CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_NM +CMAKE_NM-ADVANCED:INTERNAL=1 +//number of local generators +CMAKE_NUMBER_OF_MAKEFILES:INTERNAL=1 +//ADVANCED property for variable: CMAKE_OBJCOPY +CMAKE_OBJCOPY-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_OBJDUMP +CMAKE_OBJDUMP-ADVANCED:INTERNAL=1 +//Platform information initialized +CMAKE_PLATFORM_INFO_INITIALIZED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_RANLIB +CMAKE_RANLIB-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_READELF +CMAKE_READELF-ADVANCED:INTERNAL=1 +//Path to CMake installation. +CMAKE_ROOT:INTERNAL=/snap/clion/184/bin/cmake/linux/share/cmake-3.21 +//ADVANCED property for variable: CMAKE_SHARED_LINKER_FLAGS +CMAKE_SHARED_LINKER_FLAGS-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_SHARED_LINKER_FLAGS_DEBUG +CMAKE_SHARED_LINKER_FLAGS_DEBUG-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL +CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_SHARED_LINKER_FLAGS_RELEASE +CMAKE_SHARED_LINKER_FLAGS_RELEASE-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO +CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_SKIP_INSTALL_RPATH +CMAKE_SKIP_INSTALL_RPATH-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_SKIP_RPATH +CMAKE_SKIP_RPATH-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_STATIC_LINKER_FLAGS +CMAKE_STATIC_LINKER_FLAGS-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_STATIC_LINKER_FLAGS_DEBUG +CMAKE_STATIC_LINKER_FLAGS_DEBUG-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_STATIC_LINKER_FLAGS_MINSIZEREL +CMAKE_STATIC_LINKER_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_STATIC_LINKER_FLAGS_RELEASE +CMAKE_STATIC_LINKER_FLAGS_RELEASE-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_STATIC_LINKER_FLAGS_RELWITHDEBINFO +CMAKE_STATIC_LINKER_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_STRIP +CMAKE_STRIP-ADVANCED:INTERNAL=1 +//uname command +CMAKE_UNAME:INTERNAL=/usr/bin/uname +//ADVANCED property for variable: CMAKE_VERBOSE_MAKEFILE +CMAKE_VERBOSE_MAKEFILE-ADVANCED:INTERNAL=1 + diff --git a/cmake-build-debug/CMakeFiles/3.21.1/CMakeCCompiler.cmake b/cmake-build-debug/CMakeFiles/3.21.1/CMakeCCompiler.cmake new file mode 100644 index 0000000..774bd56 --- /dev/null +++ b/cmake-build-debug/CMakeFiles/3.21.1/CMakeCCompiler.cmake @@ -0,0 +1,80 @@ +set(CMAKE_C_COMPILER "/usr/bin/gcc-10") +set(CMAKE_C_COMPILER_ARG1 "") +set(CMAKE_C_COMPILER_ID "GNU") +set(CMAKE_C_COMPILER_VERSION "10.3.0") +set(CMAKE_C_COMPILER_VERSION_INTERNAL "") +set(CMAKE_C_COMPILER_WRAPPER "") +set(CMAKE_C_STANDARD_COMPUTED_DEFAULT "17") +set(CMAKE_C_COMPILE_FEATURES "c_std_90;c_function_prototypes;c_std_99;c_restrict;c_variadic_macros;c_std_11;c_static_assert;c_std_17;c_std_23") +set(CMAKE_C90_COMPILE_FEATURES "c_std_90;c_function_prototypes") +set(CMAKE_C99_COMPILE_FEATURES "c_std_99;c_restrict;c_variadic_macros") +set(CMAKE_C11_COMPILE_FEATURES "c_std_11;c_static_assert") +set(CMAKE_C17_COMPILE_FEATURES "c_std_17") +set(CMAKE_C23_COMPILE_FEATURES "c_std_23") + +set(CMAKE_C_PLATFORM_ID "Linux") +set(CMAKE_C_SIMULATE_ID "") +set(CMAKE_C_COMPILER_FRONTEND_VARIANT "") +set(CMAKE_C_SIMULATE_VERSION "") + + + + +set(CMAKE_AR "/usr/bin/ar") +set(CMAKE_C_COMPILER_AR "/usr/bin/gcc-ar-10") +set(CMAKE_RANLIB "/usr/bin/ranlib") +set(CMAKE_C_COMPILER_RANLIB "/usr/bin/gcc-ranlib-10") +set(CMAKE_LINKER "/usr/bin/ld") +set(CMAKE_MT "") +set(CMAKE_COMPILER_IS_GNUCC 1) +set(CMAKE_C_COMPILER_LOADED 1) +set(CMAKE_C_COMPILER_WORKS TRUE) +set(CMAKE_C_ABI_COMPILED TRUE) +set(CMAKE_COMPILER_IS_MINGW ) +set(CMAKE_COMPILER_IS_CYGWIN ) +if(CMAKE_COMPILER_IS_CYGWIN) + set(CYGWIN 1) + set(UNIX 1) +endif() + +set(CMAKE_C_COMPILER_ENV_VAR "CC") + +if(CMAKE_COMPILER_IS_MINGW) + set(MINGW 1) +endif() +set(CMAKE_C_COMPILER_ID_RUN 1) +set(CMAKE_C_SOURCE_FILE_EXTENSIONS c;m) +set(CMAKE_C_IGNORE_EXTENSIONS h;H;o;O;obj;OBJ;def;DEF;rc;RC) +set(CMAKE_C_LINKER_PREFERENCE 10) + +# Save compiler ABI information. +set(CMAKE_C_SIZEOF_DATA_PTR "8") +set(CMAKE_C_COMPILER_ABI "ELF") +set(CMAKE_C_BYTE_ORDER "LITTLE_ENDIAN") +set(CMAKE_C_LIBRARY_ARCHITECTURE "x86_64-linux-gnu") + +if(CMAKE_C_SIZEOF_DATA_PTR) + set(CMAKE_SIZEOF_VOID_P "${CMAKE_C_SIZEOF_DATA_PTR}") +endif() + +if(CMAKE_C_COMPILER_ABI) + set(CMAKE_INTERNAL_PLATFORM_ABI "${CMAKE_C_COMPILER_ABI}") +endif() + +if(CMAKE_C_LIBRARY_ARCHITECTURE) + set(CMAKE_LIBRARY_ARCHITECTURE "x86_64-linux-gnu") +endif() + +set(CMAKE_C_CL_SHOWINCLUDES_PREFIX "") +if(CMAKE_C_CL_SHOWINCLUDES_PREFIX) + set(CMAKE_CL_SHOWINCLUDES_PREFIX "${CMAKE_C_CL_SHOWINCLUDES_PREFIX}") +endif() + + + + + +set(CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES "/usr/lib/gcc/x86_64-linux-gnu/10/include;/usr/local/include;/usr/include/x86_64-linux-gnu;/usr/include") +set(CMAKE_C_IMPLICIT_LINK_LIBRARIES "gcc;gcc_s;c;gcc;gcc_s") +set(CMAKE_C_IMPLICIT_LINK_DIRECTORIES "/usr/lib/gcc/x86_64-linux-gnu/10;/usr/lib/x86_64-linux-gnu;/usr/lib;/lib/x86_64-linux-gnu;/lib") +set(CMAKE_C_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES "") diff --git a/cmake-build-debug/CMakeFiles/3.21.1/CMakeCXXCompiler.cmake b/cmake-build-debug/CMakeFiles/3.21.1/CMakeCXXCompiler.cmake new file mode 100644 index 0000000..8d45c4c --- /dev/null +++ b/cmake-build-debug/CMakeFiles/3.21.1/CMakeCXXCompiler.cmake @@ -0,0 +1,91 @@ +set(CMAKE_CXX_COMPILER "/usr/bin/g++-10") +set(CMAKE_CXX_COMPILER_ARG1 "") +set(CMAKE_CXX_COMPILER_ID "GNU") +set(CMAKE_CXX_COMPILER_VERSION "10.3.0") +set(CMAKE_CXX_COMPILER_VERSION_INTERNAL "") +set(CMAKE_CXX_COMPILER_WRAPPER "") +set(CMAKE_CXX_STANDARD_COMPUTED_DEFAULT "14") +set(CMAKE_CXX_COMPILE_FEATURES "cxx_std_98;cxx_template_template_parameters;cxx_std_11;cxx_alias_templates;cxx_alignas;cxx_alignof;cxx_attributes;cxx_auto_type;cxx_constexpr;cxx_decltype;cxx_decltype_incomplete_return_types;cxx_default_function_template_args;cxx_defaulted_functions;cxx_defaulted_move_initializers;cxx_delegating_constructors;cxx_deleted_functions;cxx_enum_forward_declarations;cxx_explicit_conversions;cxx_extended_friend_declarations;cxx_extern_templates;cxx_final;cxx_func_identifier;cxx_generalized_initializers;cxx_inheriting_constructors;cxx_inline_namespaces;cxx_lambdas;cxx_local_type_template_args;cxx_long_long_type;cxx_noexcept;cxx_nonstatic_member_init;cxx_nullptr;cxx_override;cxx_range_for;cxx_raw_string_literals;cxx_reference_qualified_functions;cxx_right_angle_brackets;cxx_rvalue_references;cxx_sizeof_member;cxx_static_assert;cxx_strong_enums;cxx_thread_local;cxx_trailing_return_types;cxx_unicode_literals;cxx_uniform_initialization;cxx_unrestricted_unions;cxx_user_literals;cxx_variadic_macros;cxx_variadic_templates;cxx_std_14;cxx_aggregate_default_initializers;cxx_attribute_deprecated;cxx_binary_literals;cxx_contextual_conversions;cxx_decltype_auto;cxx_digit_separators;cxx_generic_lambdas;cxx_lambda_init_captures;cxx_relaxed_constexpr;cxx_return_type_deduction;cxx_variable_templates;cxx_std_17;cxx_std_20") +set(CMAKE_CXX98_COMPILE_FEATURES "cxx_std_98;cxx_template_template_parameters") +set(CMAKE_CXX11_COMPILE_FEATURES "cxx_std_11;cxx_alias_templates;cxx_alignas;cxx_alignof;cxx_attributes;cxx_auto_type;cxx_constexpr;cxx_decltype;cxx_decltype_incomplete_return_types;cxx_default_function_template_args;cxx_defaulted_functions;cxx_defaulted_move_initializers;cxx_delegating_constructors;cxx_deleted_functions;cxx_enum_forward_declarations;cxx_explicit_conversions;cxx_extended_friend_declarations;cxx_extern_templates;cxx_final;cxx_func_identifier;cxx_generalized_initializers;cxx_inheriting_constructors;cxx_inline_namespaces;cxx_lambdas;cxx_local_type_template_args;cxx_long_long_type;cxx_noexcept;cxx_nonstatic_member_init;cxx_nullptr;cxx_override;cxx_range_for;cxx_raw_string_literals;cxx_reference_qualified_functions;cxx_right_angle_brackets;cxx_rvalue_references;cxx_sizeof_member;cxx_static_assert;cxx_strong_enums;cxx_thread_local;cxx_trailing_return_types;cxx_unicode_literals;cxx_uniform_initialization;cxx_unrestricted_unions;cxx_user_literals;cxx_variadic_macros;cxx_variadic_templates") +set(CMAKE_CXX14_COMPILE_FEATURES "cxx_std_14;cxx_aggregate_default_initializers;cxx_attribute_deprecated;cxx_binary_literals;cxx_contextual_conversions;cxx_decltype_auto;cxx_digit_separators;cxx_generic_lambdas;cxx_lambda_init_captures;cxx_relaxed_constexpr;cxx_return_type_deduction;cxx_variable_templates") +set(CMAKE_CXX17_COMPILE_FEATURES "cxx_std_17") +set(CMAKE_CXX20_COMPILE_FEATURES "cxx_std_20") +set(CMAKE_CXX23_COMPILE_FEATURES "") + +set(CMAKE_CXX_PLATFORM_ID "Linux") +set(CMAKE_CXX_SIMULATE_ID "") +set(CMAKE_CXX_COMPILER_FRONTEND_VARIANT "") +set(CMAKE_CXX_SIMULATE_VERSION "") + + + + +set(CMAKE_AR "/usr/bin/ar") +set(CMAKE_CXX_COMPILER_AR "/usr/bin/gcc-ar-10") +set(CMAKE_RANLIB "/usr/bin/ranlib") +set(CMAKE_CXX_COMPILER_RANLIB "/usr/bin/gcc-ranlib-10") +set(CMAKE_LINKER "/usr/bin/ld") +set(CMAKE_MT "") +set(CMAKE_COMPILER_IS_GNUCXX 1) +set(CMAKE_CXX_COMPILER_LOADED 1) +set(CMAKE_CXX_COMPILER_WORKS TRUE) +set(CMAKE_CXX_ABI_COMPILED TRUE) +set(CMAKE_COMPILER_IS_MINGW ) +set(CMAKE_COMPILER_IS_CYGWIN ) +if(CMAKE_COMPILER_IS_CYGWIN) + set(CYGWIN 1) + set(UNIX 1) +endif() + +set(CMAKE_CXX_COMPILER_ENV_VAR "CXX") + +if(CMAKE_COMPILER_IS_MINGW) + set(MINGW 1) +endif() +set(CMAKE_CXX_COMPILER_ID_RUN 1) +set(CMAKE_CXX_SOURCE_FILE_EXTENSIONS C;M;c++;cc;cpp;cxx;m;mm;mpp;CPP;ixx;cppm) +set(CMAKE_CXX_IGNORE_EXTENSIONS inl;h;hpp;HPP;H;o;O;obj;OBJ;def;DEF;rc;RC) + +foreach (lang C OBJC OBJCXX) + if (CMAKE_${lang}_COMPILER_ID_RUN) + foreach(extension IN LISTS CMAKE_${lang}_SOURCE_FILE_EXTENSIONS) + list(REMOVE_ITEM CMAKE_CXX_SOURCE_FILE_EXTENSIONS ${extension}) + endforeach() + endif() +endforeach() + +set(CMAKE_CXX_LINKER_PREFERENCE 30) +set(CMAKE_CXX_LINKER_PREFERENCE_PROPAGATES 1) + +# Save compiler ABI information. +set(CMAKE_CXX_SIZEOF_DATA_PTR "8") +set(CMAKE_CXX_COMPILER_ABI "ELF") +set(CMAKE_CXX_BYTE_ORDER "LITTLE_ENDIAN") +set(CMAKE_CXX_LIBRARY_ARCHITECTURE "x86_64-linux-gnu") + +if(CMAKE_CXX_SIZEOF_DATA_PTR) + set(CMAKE_SIZEOF_VOID_P "${CMAKE_CXX_SIZEOF_DATA_PTR}") +endif() + +if(CMAKE_CXX_COMPILER_ABI) + set(CMAKE_INTERNAL_PLATFORM_ABI "${CMAKE_CXX_COMPILER_ABI}") +endif() + +if(CMAKE_CXX_LIBRARY_ARCHITECTURE) + set(CMAKE_LIBRARY_ARCHITECTURE "x86_64-linux-gnu") +endif() + +set(CMAKE_CXX_CL_SHOWINCLUDES_PREFIX "") +if(CMAKE_CXX_CL_SHOWINCLUDES_PREFIX) + set(CMAKE_CL_SHOWINCLUDES_PREFIX "${CMAKE_CXX_CL_SHOWINCLUDES_PREFIX}") +endif() + + + + + +set(CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES "/usr/include/c++/10;/usr/include/x86_64-linux-gnu/c++/10;/usr/include/c++/10/backward;/usr/lib/gcc/x86_64-linux-gnu/10/include;/usr/local/include;/usr/include/x86_64-linux-gnu;/usr/include") +set(CMAKE_CXX_IMPLICIT_LINK_LIBRARIES "stdc++;m;gcc_s;gcc;c;gcc_s;gcc") +set(CMAKE_CXX_IMPLICIT_LINK_DIRECTORIES "/usr/lib/gcc/x86_64-linux-gnu/10;/usr/lib/x86_64-linux-gnu;/usr/lib;/lib/x86_64-linux-gnu;/lib") +set(CMAKE_CXX_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES "") diff --git a/cmake-build-debug/CMakeFiles/3.21.1/CMakeDetermineCompilerABI_C.bin b/cmake-build-debug/CMakeFiles/3.21.1/CMakeDetermineCompilerABI_C.bin new file mode 100755 index 0000000000000000000000000000000000000000..63986fa0e72938f7ac62bb3ff33a932a6e49b65b GIT binary patch literal 16656 zcmeHOZERat89ug?H2reiFB;mi+>H)eMqH;~q-CLY5+~OvAEixLr>?u$@l9gp*ulQu zl8%j{Kqae7iGYbsXj0iEB*dSB5akDBsXEI3P^CzWp)%18D#}*YY-}hUZO!|h`@YV- zH!ektKS=jT_H)j2-j8$NbI$d-zUO=;+STFpcmyY(_>90(IAAhis+ieD8Gx{87R%xL zBVvQ7fpV4P%=)kiP-~`FymqW5-Uo`x(&4xFZjF7>;D=YAQz$q2@fm`rPfxoMQyny%(V7PV)O&b`CYlEpw zJe@kMLlLXAyb;eC+DJT=5uIJJ);4WxaBFaf&|-bvT2jyHL#e!>=lZ(a(%FpO7f+;7 zb7&-+Ax+H`ttcqlV@8o<>46Ah40&7>)}bU#UL=lRL=LRn!}%+b7M{vsKu4V(4M zbNQ7$CXaoE{y1H<@Z2V>yKLck>>xjD;du@qKWE|TR)@5k+z7Z4a3kPGz>R<#0XG6} z1l$PxM-ljY-5u|%6IW{0W7WUkB82+&X~SEZQ72xkJtOr?JDvslozmUU0n{}Jl!wyu zveYhQx#@4Q;`s;F;_K?fpJ(^>bxl^Eg{7}Lxx80G%W1GwT9X5ncc;|JmZu@3PF8;t zVb`3o23+@G9$YUjU94+3f{xD+f_zHK??@nQzNr>x)zfe7QBTkLRL@!U{7qvu7`U4Z z)Rry|)-^!8SRdPaqy?)*;huhVqQ#3@wRp)`rXFjlfx_j@rBdl~628t>-+-rX&mqvY z>HqZ+s6<2kpjUkCidrmO{8jWiHuG5Yiu#l~x#qWih|W)|0(HNb_C&7}yBaU^0@j?W z^46Vl*1T4!X3d)pOVU$^9}6N%MCY6CH3?TpV82Cf#TU!e5b4UR(tU;k<#ivsuO2C>aJG{Z(x5P zJQR5#awzg(L_0G$?-BjsNI;b1q&zZYgWNAS0&WD{2)Ge&Bj85Bjer{gHv(=1+z7Z4 z_&wTZbcfa`lZ0c&M zGzxeE@F~EPfCm7do-LJ50xEBpN;7~{fc5mU4d1z9@*LhLJYxaR`elo1r=Sk`4e;3u zHt-(+(Y{E&$=e9o?eM7wUK0L5hrj-_bxR+qJtFq3+x>}c8|CXw)PDdzg5@v|32hqi zc@6kSk%;;ON4;&!YrHw|3~qq>HhffQvySy0{=hf9F@ODWU(~NmRz>}ro~Um3hmO{$ z{^p5Ao&Ipf-yHFWBK}RSex=o4-|7#v`fKHT%RhknDA;k|`(Ys6$xV*~PGNWeaCGi{>Hq93L*@0VOpW!?vg`${qK zzDayO!o>CO-7ICXe1bMR^0Ul=Dr9+&s}L_y{SuQFj}hX2Q%v=ALVOA`Flx)~;d$LA`Gs-#BH7{lD%*Kj$}f!PlfYMM{|}^mK!g>@ zK;rw*i;(xgp!$M>?0h%B4teB{D98%9ax-CjE7^Y&cn|dZ&+jBb3sjQ7ChJ!%==UYy zz=L;PN58K^$7132eoXQU$Kft%XW=+`7kIB&IFE2E(Mq^Vg?@+lcS8eSk!`hq{Y3H$ z$J?X8uYkBIq{P1;PXHefYs>x4*6s&>rFY@H`xf#nWWgVk9p^ZI0eEt0krv_{@GHD) z1>b+U@&fYEB37cG6Y&P{7>AQ|K0zmiYTyGfZtKHr!Ni}De3-`n7OH-ql38si zolV5kTGGho@>;wwCI+%2qiNmHlfh7B2|Qnt(&D*X9R7;V7`bsVn2V3-TCy-QG7c)1 zk_M87O|-2${*d0*20l`0Jr`+>LE}=H!K^m_$F-J74T0fgDxO(Tl};H(TDR50Kic55 zV_&3O{@1O+X%)NMq|n;$?}>EB+Uzy*SPW2b9!QI-WI=7;C$!G4-quK$*4xpsKia4D zMOxu+bP$w>X$JBI8GwI#d`4c8<*$69>B+beXB+bea>8NTi5v~3%u_cYYd?acCG%Nr zIG#!3@tjyMNF`Glt&rE@`sSO40f%xTpC>c&*pH^c=^lI&fYHHYKNZjN*iR4Hnd05ZoQ`wBIpg~Yi*LcT9D9dqdOx{*;~K|-hg zeZc<%*6iGVeokRz|9lqF+5R}_<1-5D^K%U26#2z##5l7)KYyfv!%Jp;UavCpa}bEg zgf^_{OHjaP64vK+Eh9hQar;@0@o~_{XB;l``j=55XU_H$EhZs@F=c&TCo@iyAp3V- z|97AsuZipNCr~Cre%>Tj`r`&(yA}QBpou5{SaIB&*htt zL0jyf*J}aNXFn`Ym%~Nj0|Ge`FY~N_Pnj_@tZzjgJ66#!84S_H#(9h(;r8(T5C4zh hwp;Z_@rMCYx5GI5HEVIrTv`A5W>aFBL%~rL{{lrlc`pC} literal 0 HcmV?d00001 diff --git a/cmake-build-debug/CMakeFiles/3.21.1/CMakeDetermineCompilerABI_CXX.bin b/cmake-build-debug/CMakeFiles/3.21.1/CMakeDetermineCompilerABI_CXX.bin new file mode 100755 index 0000000000000000000000000000000000000000..54d39f9b52dec45fffd643c61891b8a62d304783 GIT binary patch literal 16672 zcmeHOYit}>6~61W9j8gwn-?)jT2DeMB@}OLCoxVMx4VAM!p07XO-<8e*!7O>g?*Ua z*~Tukq;e@*1s4l}Xn!C@so)0)Df}UScsLk^A_OD|LQ#rvDG>%j>jsJpBw5b6bIy8Z zydkLY2WhUf``!DU*PS!>&d%)I`^m0IcZJ6zxOl}w0$V}9$plF-x1TBiLD4GK!1ujk ztEh%{rQ}R`&;*d0<>d-H))4OnM7uhyl)3Cc%$MRR6w!e*)GVW+CJ_jGRx*34U5B zpH5UvFM`o&H%N9)>?AuzjDh9oH6#9Z;vFWtX+^pbPCRJRf|28W0PJL5NPaiq(|m;D z-RV5|DgTUgI>qi}BG$5ZcQW3POr-PU4dbmX4J~^ExlEv0hQ@wj3>;HEy#oT=%pgZ; zl;>gtwNXCz{>`bjvj@NYkoS9qtK!7kM}Ic|3j4sAsDlOVc}QRz>lg!d%;SF=YBZJs zFY7-^N#YJ)t-vc~WSfCoSBCEgPAS6=-GN^P{Pr^X0`fP6>1q+0HZ&g9h7;*%GVz2C zO%!Q4Bbqg|R5XzmJ&|yGht?cu4(t#-LAcL4g9vAt|iIte$_fX$?e)7Cf)|!Gvnzzi)k%O9`DQBMBFF$PZ zc&;!WmpKd1eL~s1h3Bz@{DOt&Ie`44g{Mm$(r$4x;AX(hfSUm~18xS~47eF^Gw>f} z;4iiJ{X?C+UZb9_`qgeB)KASA6~#;HQ7Z!lGC8TvRXLHa38R`^iB~ac;P_ z9{R=h*xyraC>Hq#2Gq&63aqMyYsPBzbXzqv=64l~#rZgVU97qVPu-s5U~9Ag!$}aL zqXDohJb7I$U712Ev86Lj9q_%>i|)VF%Dh zBfDZh4LRrmK|CNa04L@Oo$A_o3p3->8$b9(Dh(^MAziee8JXvC#3* ziI6rsyc7}R;YdJ~ zae1f1z1@8Wa`4_RGpxnOjO?+-*5g*K-f&-c?0_+$>Di1PKb8%*YdyVP;m+QWkb2TS zHeu*mCJV3ijzz-#{gE!MtG6>8>IDrckH!+mU>yP)c(!;S#CN~={%rb&jBiL7K@hvrvdBeWgEV8#o~G5i13X2JzG|}6^7<}MA0HSk+ ze3Q2Ws(ay62fQSF{%&90`)XI6tT`nf-hANQdv?gzn`r+Sd<5%Z9SZt1;PWc*A4j6g z=YO`MV@-8M79v9!pgs>D75c2ByxZshY(>~t_nf!Or%Y9L`F4J$s?*o_Y_;lZom|o5 z3#NUoAzx$2x3k@+wEODXeg1Y|jeKwU3Yd?9ANRc8+${sVu94R<(qmI;t>S8SARmSVtn)U@PFgJbPHOXd$t~38b&$BO6brAL#OEU{ zEPv~EF@xsEv>J&O1-f1`%+o`^@8WMU4KJqKHGVi zePza@Umn)n>^C=UJtAv$({VHN0+B2%i{p*h~@L^B=PJ1$Vci1Iz`wUR9Z%FG>$%EQ? zL})#czV=W=>+9}5+SRZ1huY!qc2Ja?ZiaGsnW%ri%|?$$jVPNe?b8VcZ5wqo)G{~Y zfUbRKjuy{lw9#lfj=OfkeV`Rjq_uobhr?Ow37!XN$8tGxBX3m=;n;Fxy#)O56)D-kCO zMni)U9T8G}G@2U~f%rrkLYQb|P08bWHkZhxZ4C`%Sv?s=0}+tN8yHI(0>1(y8K@Zg zIDF&a14H19-Qs@zK>A>nYHkJH*+mevDy!MO$p-;RwU%>B-3H2 zSnc^fl2KtrLZ|&B!2b>I;kp0(+``E5d2gb#|532VXBM{S=NiUoii>^3JhMGNk0gM@ zLuPxve`Vz7B2bY9eOSxKpn=aQY|r<(jQqUE{bxPKr@$VcdAQB@!;A_AbM~KTF$ERO zDckdXGvf>?a(w6Ue-Y$(Of1KrL|F*=`IA@~i|dGAf{)c+Av;EP$2Qz%JnOLM`*lXv zyOaIb9QHvnV8q{lYjOJfhQprk{~7uDoP9XQ?|HK4{0oIN37?}T1JT?R--Q}>k?p5R zf$?BT)2uk-{}^bi{Ux$zTyWU)`Dgl^TnW)8TMac!5BU)Jr_uKTu-K3fo(e$BtDsNDdom tV&gnUiu=RYKm31&`);)#!yg7Haffq`YfAARy1f0*TTPAC4g*J1{0kfTd#nHe literal 0 HcmV?d00001 diff --git a/cmake-build-debug/CMakeFiles/3.21.1/CMakeSystem.cmake b/cmake-build-debug/CMakeFiles/3.21.1/CMakeSystem.cmake new file mode 100644 index 0000000..b92daf3 --- /dev/null +++ b/cmake-build-debug/CMakeFiles/3.21.1/CMakeSystem.cmake @@ -0,0 +1,15 @@ +set(CMAKE_HOST_SYSTEM "Linux-5.14.0-1027-oem") +set(CMAKE_HOST_SYSTEM_NAME "Linux") +set(CMAKE_HOST_SYSTEM_VERSION "5.14.0-1027-oem") +set(CMAKE_HOST_SYSTEM_PROCESSOR "x86_64") + + + +set(CMAKE_SYSTEM "Linux-5.14.0-1027-oem") +set(CMAKE_SYSTEM_NAME "Linux") +set(CMAKE_SYSTEM_VERSION "5.14.0-1027-oem") +set(CMAKE_SYSTEM_PROCESSOR "x86_64") + +set(CMAKE_CROSSCOMPILING "FALSE") + +set(CMAKE_SYSTEM_LOADED 1) diff --git a/cmake-build-debug/CMakeFiles/3.21.1/CompilerIdC/CMakeCCompilerId.c b/cmake-build-debug/CMakeFiles/3.21.1/CompilerIdC/CMakeCCompilerId.c new file mode 100644 index 0000000..051f748 --- /dev/null +++ b/cmake-build-debug/CMakeFiles/3.21.1/CompilerIdC/CMakeCCompilerId.c @@ -0,0 +1,807 @@ +#ifdef __cplusplus +# error "A C++ compiler has been selected for C." +#endif + +#if defined(__18CXX) +# define ID_VOID_MAIN +#endif +#if defined(__CLASSIC_C__) +/* cv-qualifiers did not exist in K&R C */ +# define const +# define volatile +#endif + +#if !defined(__has_include) +/* If the compiler does not have __has_include, pretend the answer is + always no. */ +# define __has_include(x) 0 +#endif + + +/* Version number components: V=Version, R=Revision, P=Patch + Version date components: YYYY=Year, MM=Month, DD=Day */ + +#if defined(__INTEL_COMPILER) || defined(__ICC) +# define COMPILER_ID "Intel" +# if defined(_MSC_VER) +# define SIMULATE_ID "MSVC" +# endif +# if defined(__GNUC__) +# define SIMULATE_ID "GNU" +# endif + /* __INTEL_COMPILER = VRP prior to 2021, and then VVVV for 2021 and later, + except that a few beta releases use the old format with V=2021. */ +# if __INTEL_COMPILER < 2021 || __INTEL_COMPILER == 202110 || __INTEL_COMPILER == 202111 +# define COMPILER_VERSION_MAJOR DEC(__INTEL_COMPILER/100) +# define COMPILER_VERSION_MINOR DEC(__INTEL_COMPILER/10 % 10) +# if defined(__INTEL_COMPILER_UPDATE) +# define COMPILER_VERSION_PATCH DEC(__INTEL_COMPILER_UPDATE) +# else +# define COMPILER_VERSION_PATCH DEC(__INTEL_COMPILER % 10) +# endif +# else +# define COMPILER_VERSION_MAJOR DEC(__INTEL_COMPILER) +# define COMPILER_VERSION_MINOR DEC(__INTEL_COMPILER_UPDATE) + /* The third version component from --version is an update index, + but no macro is provided for it. */ +# define COMPILER_VERSION_PATCH DEC(0) +# endif +# if defined(__INTEL_COMPILER_BUILD_DATE) + /* __INTEL_COMPILER_BUILD_DATE = YYYYMMDD */ +# define COMPILER_VERSION_TWEAK DEC(__INTEL_COMPILER_BUILD_DATE) +# endif +# if defined(_MSC_VER) + /* _MSC_VER = VVRR */ +# define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100) +# define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100) +# endif +# if defined(__GNUC__) +# define SIMULATE_VERSION_MAJOR DEC(__GNUC__) +# elif defined(__GNUG__) +# define SIMULATE_VERSION_MAJOR DEC(__GNUG__) +# endif +# if defined(__GNUC_MINOR__) +# define SIMULATE_VERSION_MINOR DEC(__GNUC_MINOR__) +# endif +# if defined(__GNUC_PATCHLEVEL__) +# define SIMULATE_VERSION_PATCH DEC(__GNUC_PATCHLEVEL__) +# endif + +#elif (defined(__clang__) && defined(__INTEL_CLANG_COMPILER)) || defined(__INTEL_LLVM_COMPILER) +# define COMPILER_ID "IntelLLVM" +#if defined(_MSC_VER) +# define SIMULATE_ID "MSVC" +#endif +#if defined(__GNUC__) +# define SIMULATE_ID "GNU" +#endif +/* __INTEL_LLVM_COMPILER = VVVVRP prior to 2021.2.0, VVVVRRPP for 2021.2.0 and + * later. Look for 6 digit vs. 8 digit version number to decide encoding. + * VVVV is no smaller than the current year when a version is released. + */ +#if __INTEL_LLVM_COMPILER < 1000000L +# define COMPILER_VERSION_MAJOR DEC(__INTEL_LLVM_COMPILER/100) +# define COMPILER_VERSION_MINOR DEC(__INTEL_LLVM_COMPILER/10 % 10) +# define COMPILER_VERSION_PATCH DEC(__INTEL_LLVM_COMPILER % 10) +#else +# define COMPILER_VERSION_MAJOR DEC(__INTEL_LLVM_COMPILER/10000) +# define COMPILER_VERSION_MINOR DEC(__INTEL_LLVM_COMPILER/100 % 100) +# define COMPILER_VERSION_PATCH DEC(__INTEL_LLVM_COMPILER % 100) +#endif +#if defined(_MSC_VER) + /* _MSC_VER = VVRR */ +# define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100) +# define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100) +#endif +#if defined(__GNUC__) +# define SIMULATE_VERSION_MAJOR DEC(__GNUC__) +#elif defined(__GNUG__) +# define SIMULATE_VERSION_MAJOR DEC(__GNUG__) +#endif +#if defined(__GNUC_MINOR__) +# define SIMULATE_VERSION_MINOR DEC(__GNUC_MINOR__) +#endif +#if defined(__GNUC_PATCHLEVEL__) +# define SIMULATE_VERSION_PATCH DEC(__GNUC_PATCHLEVEL__) +#endif + +#elif defined(__PATHCC__) +# define COMPILER_ID "PathScale" +# define COMPILER_VERSION_MAJOR DEC(__PATHCC__) +# define COMPILER_VERSION_MINOR DEC(__PATHCC_MINOR__) +# if defined(__PATHCC_PATCHLEVEL__) +# define COMPILER_VERSION_PATCH DEC(__PATHCC_PATCHLEVEL__) +# endif + +#elif defined(__BORLANDC__) && defined(__CODEGEARC_VERSION__) +# define COMPILER_ID "Embarcadero" +# define COMPILER_VERSION_MAJOR HEX(__CODEGEARC_VERSION__>>24 & 0x00FF) +# define COMPILER_VERSION_MINOR HEX(__CODEGEARC_VERSION__>>16 & 0x00FF) +# define COMPILER_VERSION_PATCH DEC(__CODEGEARC_VERSION__ & 0xFFFF) + +#elif defined(__BORLANDC__) +# define COMPILER_ID "Borland" + /* __BORLANDC__ = 0xVRR */ +# define COMPILER_VERSION_MAJOR HEX(__BORLANDC__>>8) +# define COMPILER_VERSION_MINOR HEX(__BORLANDC__ & 0xFF) + +#elif defined(__WATCOMC__) && __WATCOMC__ < 1200 +# define COMPILER_ID "Watcom" + /* __WATCOMC__ = VVRR */ +# define COMPILER_VERSION_MAJOR DEC(__WATCOMC__ / 100) +# define COMPILER_VERSION_MINOR DEC((__WATCOMC__ / 10) % 10) +# if (__WATCOMC__ % 10) > 0 +# define COMPILER_VERSION_PATCH DEC(__WATCOMC__ % 10) +# endif + +#elif defined(__WATCOMC__) +# define COMPILER_ID "OpenWatcom" + /* __WATCOMC__ = VVRP + 1100 */ +# define COMPILER_VERSION_MAJOR DEC((__WATCOMC__ - 1100) / 100) +# define COMPILER_VERSION_MINOR DEC((__WATCOMC__ / 10) % 10) +# if (__WATCOMC__ % 10) > 0 +# define COMPILER_VERSION_PATCH DEC(__WATCOMC__ % 10) +# endif + +#elif defined(__SUNPRO_C) +# define COMPILER_ID "SunPro" +# if __SUNPRO_C >= 0x5100 + /* __SUNPRO_C = 0xVRRP */ +# define COMPILER_VERSION_MAJOR HEX(__SUNPRO_C>>12) +# define COMPILER_VERSION_MINOR HEX(__SUNPRO_C>>4 & 0xFF) +# define COMPILER_VERSION_PATCH HEX(__SUNPRO_C & 0xF) +# else + /* __SUNPRO_CC = 0xVRP */ +# define COMPILER_VERSION_MAJOR HEX(__SUNPRO_C>>8) +# define COMPILER_VERSION_MINOR HEX(__SUNPRO_C>>4 & 0xF) +# define COMPILER_VERSION_PATCH HEX(__SUNPRO_C & 0xF) +# endif + +#elif defined(__HP_cc) +# define COMPILER_ID "HP" + /* __HP_cc = VVRRPP */ +# define COMPILER_VERSION_MAJOR DEC(__HP_cc/10000) +# define COMPILER_VERSION_MINOR DEC(__HP_cc/100 % 100) +# define COMPILER_VERSION_PATCH DEC(__HP_cc % 100) + +#elif defined(__DECC) +# define COMPILER_ID "Compaq" + /* __DECC_VER = VVRRTPPPP */ +# define COMPILER_VERSION_MAJOR DEC(__DECC_VER/10000000) +# define COMPILER_VERSION_MINOR DEC(__DECC_VER/100000 % 100) +# define COMPILER_VERSION_PATCH DEC(__DECC_VER % 10000) + +#elif defined(__IBMC__) && defined(__COMPILER_VER__) +# define COMPILER_ID "zOS" + /* __IBMC__ = VRP */ +# define COMPILER_VERSION_MAJOR DEC(__IBMC__/100) +# define COMPILER_VERSION_MINOR DEC(__IBMC__/10 % 10) +# define COMPILER_VERSION_PATCH DEC(__IBMC__ % 10) + +#elif defined(__ibmxl__) && defined(__clang__) +# define COMPILER_ID "XLClang" +# define COMPILER_VERSION_MAJOR DEC(__ibmxl_version__) +# define COMPILER_VERSION_MINOR DEC(__ibmxl_release__) +# define COMPILER_VERSION_PATCH DEC(__ibmxl_modification__) +# define COMPILER_VERSION_TWEAK DEC(__ibmxl_ptf_fix_level__) + + +#elif defined(__IBMC__) && !defined(__COMPILER_VER__) && __IBMC__ >= 800 +# define COMPILER_ID "XL" + /* __IBMC__ = VRP */ +# define COMPILER_VERSION_MAJOR DEC(__IBMC__/100) +# define COMPILER_VERSION_MINOR DEC(__IBMC__/10 % 10) +# define COMPILER_VERSION_PATCH DEC(__IBMC__ % 10) + +#elif defined(__IBMC__) && !defined(__COMPILER_VER__) && __IBMC__ < 800 +# define COMPILER_ID "VisualAge" + /* __IBMC__ = VRP */ +# define COMPILER_VERSION_MAJOR DEC(__IBMC__/100) +# define COMPILER_VERSION_MINOR DEC(__IBMC__/10 % 10) +# define COMPILER_VERSION_PATCH DEC(__IBMC__ % 10) + +#elif defined(__NVCOMPILER) +# define COMPILER_ID "NVHPC" +# define COMPILER_VERSION_MAJOR DEC(__NVCOMPILER_MAJOR__) +# define COMPILER_VERSION_MINOR DEC(__NVCOMPILER_MINOR__) +# if defined(__NVCOMPILER_PATCHLEVEL__) +# define COMPILER_VERSION_PATCH DEC(__NVCOMPILER_PATCHLEVEL__) +# endif + +#elif defined(__PGI) +# define COMPILER_ID "PGI" +# define COMPILER_VERSION_MAJOR DEC(__PGIC__) +# define COMPILER_VERSION_MINOR DEC(__PGIC_MINOR__) +# if defined(__PGIC_PATCHLEVEL__) +# define COMPILER_VERSION_PATCH DEC(__PGIC_PATCHLEVEL__) +# endif + +#elif defined(_CRAYC) +# define COMPILER_ID "Cray" +# define COMPILER_VERSION_MAJOR DEC(_RELEASE_MAJOR) +# define COMPILER_VERSION_MINOR DEC(_RELEASE_MINOR) + +#elif defined(__TI_COMPILER_VERSION__) +# define COMPILER_ID "TI" + /* __TI_COMPILER_VERSION__ = VVVRRRPPP */ +# define COMPILER_VERSION_MAJOR DEC(__TI_COMPILER_VERSION__/1000000) +# define COMPILER_VERSION_MINOR DEC(__TI_COMPILER_VERSION__/1000 % 1000) +# define COMPILER_VERSION_PATCH DEC(__TI_COMPILER_VERSION__ % 1000) + +#elif defined(__CLANG_FUJITSU) +# define COMPILER_ID "FujitsuClang" +# define COMPILER_VERSION_MAJOR DEC(__FCC_major__) +# define COMPILER_VERSION_MINOR DEC(__FCC_minor__) +# define COMPILER_VERSION_PATCH DEC(__FCC_patchlevel__) +# define COMPILER_VERSION_INTERNAL_STR __clang_version__ + + +#elif defined(__FUJITSU) +# define COMPILER_ID "Fujitsu" +# if defined(__FCC_version__) +# define COMPILER_VERSION __FCC_version__ +# elif defined(__FCC_major__) +# define COMPILER_VERSION_MAJOR DEC(__FCC_major__) +# define COMPILER_VERSION_MINOR DEC(__FCC_minor__) +# define COMPILER_VERSION_PATCH DEC(__FCC_patchlevel__) +# endif +# if defined(__fcc_version) +# define COMPILER_VERSION_INTERNAL DEC(__fcc_version) +# elif defined(__FCC_VERSION) +# define COMPILER_VERSION_INTERNAL DEC(__FCC_VERSION) +# endif + + +#elif defined(__ghs__) +# define COMPILER_ID "GHS" +/* __GHS_VERSION_NUMBER = VVVVRP */ +# ifdef __GHS_VERSION_NUMBER +# define COMPILER_VERSION_MAJOR DEC(__GHS_VERSION_NUMBER / 100) +# define COMPILER_VERSION_MINOR DEC(__GHS_VERSION_NUMBER / 10 % 10) +# define COMPILER_VERSION_PATCH DEC(__GHS_VERSION_NUMBER % 10) +# endif + +#elif defined(__TINYC__) +# define COMPILER_ID "TinyCC" + +#elif defined(__BCC__) +# define COMPILER_ID "Bruce" + +#elif defined(__SCO_VERSION__) +# define COMPILER_ID "SCO" + +#elif defined(__ARMCC_VERSION) && !defined(__clang__) +# define COMPILER_ID "ARMCC" +#if __ARMCC_VERSION >= 1000000 + /* __ARMCC_VERSION = VRRPPPP */ + # define COMPILER_VERSION_MAJOR DEC(__ARMCC_VERSION/1000000) + # define COMPILER_VERSION_MINOR DEC(__ARMCC_VERSION/10000 % 100) + # define COMPILER_VERSION_PATCH DEC(__ARMCC_VERSION % 10000) +#else + /* __ARMCC_VERSION = VRPPPP */ + # define COMPILER_VERSION_MAJOR DEC(__ARMCC_VERSION/100000) + # define COMPILER_VERSION_MINOR DEC(__ARMCC_VERSION/10000 % 10) + # define COMPILER_VERSION_PATCH DEC(__ARMCC_VERSION % 10000) +#endif + + +#elif defined(__clang__) && defined(__apple_build_version__) +# define COMPILER_ID "AppleClang" +# if defined(_MSC_VER) +# define SIMULATE_ID "MSVC" +# endif +# define COMPILER_VERSION_MAJOR DEC(__clang_major__) +# define COMPILER_VERSION_MINOR DEC(__clang_minor__) +# define COMPILER_VERSION_PATCH DEC(__clang_patchlevel__) +# if defined(_MSC_VER) + /* _MSC_VER = VVRR */ +# define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100) +# define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100) +# endif +# define COMPILER_VERSION_TWEAK DEC(__apple_build_version__) + +#elif defined(__clang__) && defined(__ARMCOMPILER_VERSION) +# define COMPILER_ID "ARMClang" + # define COMPILER_VERSION_MAJOR DEC(__ARMCOMPILER_VERSION/1000000) + # define COMPILER_VERSION_MINOR DEC(__ARMCOMPILER_VERSION/10000 % 100) + # define COMPILER_VERSION_PATCH DEC(__ARMCOMPILER_VERSION % 10000) +# define COMPILER_VERSION_INTERNAL DEC(__ARMCOMPILER_VERSION) + +#elif defined(__clang__) && __has_include() +# define COMPILER_ID "ROCMClang" +# if defined(_MSC_VER) +# define SIMULATE_ID "MSVC" +# elif defined(__clang__) +# define SIMULATE_ID "Clang" +# elif defined(__GNUC__) +# define SIMULATE_ID "GNU" +# endif +# if defined(__clang__) && __has_include() +# include +# define COMPILER_VERSION_MAJOR DEC(HIP_VERSION_MAJOR) +# define COMPILER_VERSION_MINOR DEC(HIP_VERSION_MINOR) +# define COMPILER_VERSION_PATCH DEC(HIP_VERSION_PATCH) +# endif + +#elif defined(__clang__) +# define COMPILER_ID "Clang" +# if defined(_MSC_VER) +# define SIMULATE_ID "MSVC" +# endif +# define COMPILER_VERSION_MAJOR DEC(__clang_major__) +# define COMPILER_VERSION_MINOR DEC(__clang_minor__) +# define COMPILER_VERSION_PATCH DEC(__clang_patchlevel__) +# if defined(_MSC_VER) + /* _MSC_VER = VVRR */ +# define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100) +# define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100) +# endif + +#elif defined(__GNUC__) +# define COMPILER_ID "GNU" +# define COMPILER_VERSION_MAJOR DEC(__GNUC__) +# if defined(__GNUC_MINOR__) +# define COMPILER_VERSION_MINOR DEC(__GNUC_MINOR__) +# endif +# if defined(__GNUC_PATCHLEVEL__) +# define COMPILER_VERSION_PATCH DEC(__GNUC_PATCHLEVEL__) +# endif + +#elif defined(_MSC_VER) +# define COMPILER_ID "MSVC" + /* _MSC_VER = VVRR */ +# define COMPILER_VERSION_MAJOR DEC(_MSC_VER / 100) +# define COMPILER_VERSION_MINOR DEC(_MSC_VER % 100) +# if defined(_MSC_FULL_VER) +# if _MSC_VER >= 1400 + /* _MSC_FULL_VER = VVRRPPPPP */ +# define COMPILER_VERSION_PATCH DEC(_MSC_FULL_VER % 100000) +# else + /* _MSC_FULL_VER = VVRRPPPP */ +# define COMPILER_VERSION_PATCH DEC(_MSC_FULL_VER % 10000) +# endif +# endif +# if defined(_MSC_BUILD) +# define COMPILER_VERSION_TWEAK DEC(_MSC_BUILD) +# endif + +#elif defined(__VISUALDSPVERSION__) || defined(__ADSPBLACKFIN__) || defined(__ADSPTS__) || defined(__ADSP21000__) +# define COMPILER_ID "ADSP" +#if defined(__VISUALDSPVERSION__) + /* __VISUALDSPVERSION__ = 0xVVRRPP00 */ +# define COMPILER_VERSION_MAJOR HEX(__VISUALDSPVERSION__>>24) +# define COMPILER_VERSION_MINOR HEX(__VISUALDSPVERSION__>>16 & 0xFF) +# define COMPILER_VERSION_PATCH HEX(__VISUALDSPVERSION__>>8 & 0xFF) +#endif + +#elif defined(__IAR_SYSTEMS_ICC__) || defined(__IAR_SYSTEMS_ICC) +# define COMPILER_ID "IAR" +# if defined(__VER__) && defined(__ICCARM__) +# define COMPILER_VERSION_MAJOR DEC((__VER__) / 1000000) +# define COMPILER_VERSION_MINOR DEC(((__VER__) / 1000) % 1000) +# define COMPILER_VERSION_PATCH DEC((__VER__) % 1000) +# define COMPILER_VERSION_INTERNAL DEC(__IAR_SYSTEMS_ICC__) +# elif defined(__VER__) && (defined(__ICCAVR__) || defined(__ICCRX__) || defined(__ICCRH850__) || defined(__ICCRL78__) || defined(__ICC430__) || defined(__ICCRISCV__) || defined(__ICCV850__) || defined(__ICC8051__) || defined(__ICCSTM8__)) +# define COMPILER_VERSION_MAJOR DEC((__VER__) / 100) +# define COMPILER_VERSION_MINOR DEC((__VER__) - (((__VER__) / 100)*100)) +# define COMPILER_VERSION_PATCH DEC(__SUBVERSION__) +# define COMPILER_VERSION_INTERNAL DEC(__IAR_SYSTEMS_ICC__) +# endif + +#elif defined(__SDCC_VERSION_MAJOR) || defined(SDCC) +# define COMPILER_ID "SDCC" +# if defined(__SDCC_VERSION_MAJOR) +# define COMPILER_VERSION_MAJOR DEC(__SDCC_VERSION_MAJOR) +# define COMPILER_VERSION_MINOR DEC(__SDCC_VERSION_MINOR) +# define COMPILER_VERSION_PATCH DEC(__SDCC_VERSION_PATCH) +# else + /* SDCC = VRP */ +# define COMPILER_VERSION_MAJOR DEC(SDCC/100) +# define COMPILER_VERSION_MINOR DEC(SDCC/10 % 10) +# define COMPILER_VERSION_PATCH DEC(SDCC % 10) +# endif + + +/* These compilers are either not known or too old to define an + identification macro. Try to identify the platform and guess that + it is the native compiler. */ +#elif defined(__hpux) || defined(__hpua) +# define COMPILER_ID "HP" + +#else /* unknown compiler */ +# define COMPILER_ID "" +#endif + +/* Construct the string literal in pieces to prevent the source from + getting matched. Store it in a pointer rather than an array + because some compilers will just produce instructions to fill the + array rather than assigning a pointer to a static array. */ +char const* info_compiler = "INFO" ":" "compiler[" COMPILER_ID "]"; +#ifdef SIMULATE_ID +char const* info_simulate = "INFO" ":" "simulate[" SIMULATE_ID "]"; +#endif + +#ifdef __QNXNTO__ +char const* qnxnto = "INFO" ":" "qnxnto[]"; +#endif + +#if defined(__CRAYXT_COMPUTE_LINUX_TARGET) +char const *info_cray = "INFO" ":" "compiler_wrapper[CrayPrgEnv]"; +#endif + +#define STRINGIFY_HELPER(X) #X +#define STRINGIFY(X) STRINGIFY_HELPER(X) + +/* Identify known platforms by name. */ +#if defined(__linux) || defined(__linux__) || defined(linux) +# define PLATFORM_ID "Linux" + +#elif defined(__MSYS__) +# define PLATFORM_ID "MSYS" + +#elif defined(__CYGWIN__) +# define PLATFORM_ID "Cygwin" + +#elif defined(__MINGW32__) +# define PLATFORM_ID "MinGW" + +#elif defined(__APPLE__) +# define PLATFORM_ID "Darwin" + +#elif defined(_WIN32) || defined(__WIN32__) || defined(WIN32) +# define PLATFORM_ID "Windows" + +#elif defined(__FreeBSD__) || defined(__FreeBSD) +# define PLATFORM_ID "FreeBSD" + +#elif defined(__NetBSD__) || defined(__NetBSD) +# define PLATFORM_ID "NetBSD" + +#elif defined(__OpenBSD__) || defined(__OPENBSD) +# define PLATFORM_ID "OpenBSD" + +#elif defined(__sun) || defined(sun) +# define PLATFORM_ID "SunOS" + +#elif defined(_AIX) || defined(__AIX) || defined(__AIX__) || defined(__aix) || defined(__aix__) +# define PLATFORM_ID "AIX" + +#elif defined(__hpux) || defined(__hpux__) +# define PLATFORM_ID "HP-UX" + +#elif defined(__HAIKU__) +# define PLATFORM_ID "Haiku" + +#elif defined(__BeOS) || defined(__BEOS__) || defined(_BEOS) +# define PLATFORM_ID "BeOS" + +#elif defined(__QNX__) || defined(__QNXNTO__) +# define PLATFORM_ID "QNX" + +#elif defined(__tru64) || defined(_tru64) || defined(__TRU64__) +# define PLATFORM_ID "Tru64" + +#elif defined(__riscos) || defined(__riscos__) +# define PLATFORM_ID "RISCos" + +#elif defined(__sinix) || defined(__sinix__) || defined(__SINIX__) +# define PLATFORM_ID "SINIX" + +#elif defined(__UNIX_SV__) +# define PLATFORM_ID "UNIX_SV" + +#elif defined(__bsdos__) +# define PLATFORM_ID "BSDOS" + +#elif defined(_MPRAS) || defined(MPRAS) +# define PLATFORM_ID "MP-RAS" + +#elif defined(__osf) || defined(__osf__) +# define PLATFORM_ID "OSF1" + +#elif defined(_SCO_SV) || defined(SCO_SV) || defined(sco_sv) +# define PLATFORM_ID "SCO_SV" + +#elif defined(__ultrix) || defined(__ultrix__) || defined(_ULTRIX) +# define PLATFORM_ID "ULTRIX" + +#elif defined(__XENIX__) || defined(_XENIX) || defined(XENIX) +# define PLATFORM_ID "Xenix" + +#elif defined(__WATCOMC__) +# if defined(__LINUX__) +# define PLATFORM_ID "Linux" + +# elif defined(__DOS__) +# define PLATFORM_ID "DOS" + +# elif defined(__OS2__) +# define PLATFORM_ID "OS2" + +# elif defined(__WINDOWS__) +# define PLATFORM_ID "Windows3x" + +# elif defined(__VXWORKS__) +# define PLATFORM_ID "VxWorks" + +# else /* unknown platform */ +# define PLATFORM_ID +# endif + +#elif defined(__INTEGRITY) +# if defined(INT_178B) +# define PLATFORM_ID "Integrity178" + +# else /* regular Integrity */ +# define PLATFORM_ID "Integrity" +# endif + +#else /* unknown platform */ +# define PLATFORM_ID + +#endif + +/* For windows compilers MSVC and Intel we can determine + the architecture of the compiler being used. This is because + the compilers do not have flags that can change the architecture, + but rather depend on which compiler is being used +*/ +#if defined(_WIN32) && defined(_MSC_VER) +# if defined(_M_IA64) +# define ARCHITECTURE_ID "IA64" + +# elif defined(_M_ARM64EC) +# define ARCHITECTURE_ID "ARM64EC" + +# elif defined(_M_X64) || defined(_M_AMD64) +# define ARCHITECTURE_ID "x64" + +# elif defined(_M_IX86) +# define ARCHITECTURE_ID "X86" + +# elif defined(_M_ARM64) +# define ARCHITECTURE_ID "ARM64" + +# elif defined(_M_ARM) +# if _M_ARM == 4 +# define ARCHITECTURE_ID "ARMV4I" +# elif _M_ARM == 5 +# define ARCHITECTURE_ID "ARMV5I" +# else +# define ARCHITECTURE_ID "ARMV" STRINGIFY(_M_ARM) +# endif + +# elif defined(_M_MIPS) +# define ARCHITECTURE_ID "MIPS" + +# elif defined(_M_SH) +# define ARCHITECTURE_ID "SHx" + +# else /* unknown architecture */ +# define ARCHITECTURE_ID "" +# endif + +#elif defined(__WATCOMC__) +# if defined(_M_I86) +# define ARCHITECTURE_ID "I86" + +# elif defined(_M_IX86) +# define ARCHITECTURE_ID "X86" + +# else /* unknown architecture */ +# define ARCHITECTURE_ID "" +# endif + +#elif defined(__IAR_SYSTEMS_ICC__) || defined(__IAR_SYSTEMS_ICC) +# if defined(__ICCARM__) +# define ARCHITECTURE_ID "ARM" + +# elif defined(__ICCRX__) +# define ARCHITECTURE_ID "RX" + +# elif defined(__ICCRH850__) +# define ARCHITECTURE_ID "RH850" + +# elif defined(__ICCRL78__) +# define ARCHITECTURE_ID "RL78" + +# elif defined(__ICCRISCV__) +# define ARCHITECTURE_ID "RISCV" + +# elif defined(__ICCAVR__) +# define ARCHITECTURE_ID "AVR" + +# elif defined(__ICC430__) +# define ARCHITECTURE_ID "MSP430" + +# elif defined(__ICCV850__) +# define ARCHITECTURE_ID "V850" + +# elif defined(__ICC8051__) +# define ARCHITECTURE_ID "8051" + +# elif defined(__ICCSTM8__) +# define ARCHITECTURE_ID "STM8" + +# else /* unknown architecture */ +# define ARCHITECTURE_ID "" +# endif + +#elif defined(__ghs__) +# if defined(__PPC64__) +# define ARCHITECTURE_ID "PPC64" + +# elif defined(__ppc__) +# define ARCHITECTURE_ID "PPC" + +# elif defined(__ARM__) +# define ARCHITECTURE_ID "ARM" + +# elif defined(__x86_64__) +# define ARCHITECTURE_ID "x64" + +# elif defined(__i386__) +# define ARCHITECTURE_ID "X86" + +# else /* unknown architecture */ +# define ARCHITECTURE_ID "" +# endif + +#elif defined(__TI_COMPILER_VERSION__) +# if defined(__TI_ARM__) +# define ARCHITECTURE_ID "ARM" + +# elif defined(__MSP430__) +# define ARCHITECTURE_ID "MSP430" + +# elif defined(__TMS320C28XX__) +# define ARCHITECTURE_ID "TMS320C28x" + +# elif defined(__TMS320C6X__) || defined(_TMS320C6X) +# define ARCHITECTURE_ID "TMS320C6x" + +# else /* unknown architecture */ +# define ARCHITECTURE_ID "" +# endif + +#else +# define ARCHITECTURE_ID +#endif + +/* Convert integer to decimal digit literals. */ +#define DEC(n) \ + ('0' + (((n) / 10000000)%10)), \ + ('0' + (((n) / 1000000)%10)), \ + ('0' + (((n) / 100000)%10)), \ + ('0' + (((n) / 10000)%10)), \ + ('0' + (((n) / 1000)%10)), \ + ('0' + (((n) / 100)%10)), \ + ('0' + (((n) / 10)%10)), \ + ('0' + ((n) % 10)) + +/* Convert integer to hex digit literals. */ +#define HEX(n) \ + ('0' + ((n)>>28 & 0xF)), \ + ('0' + ((n)>>24 & 0xF)), \ + ('0' + ((n)>>20 & 0xF)), \ + ('0' + ((n)>>16 & 0xF)), \ + ('0' + ((n)>>12 & 0xF)), \ + ('0' + ((n)>>8 & 0xF)), \ + ('0' + ((n)>>4 & 0xF)), \ + ('0' + ((n) & 0xF)) + +/* Construct a string literal encoding the version number. */ +#ifdef COMPILER_VERSION +char const* info_version = "INFO" ":" "compiler_version[" COMPILER_VERSION "]"; + +/* Construct a string literal encoding the version number components. */ +#elif defined(COMPILER_VERSION_MAJOR) +char const info_version[] = { + 'I', 'N', 'F', 'O', ':', + 'c','o','m','p','i','l','e','r','_','v','e','r','s','i','o','n','[', + COMPILER_VERSION_MAJOR, +# ifdef COMPILER_VERSION_MINOR + '.', COMPILER_VERSION_MINOR, +# ifdef COMPILER_VERSION_PATCH + '.', COMPILER_VERSION_PATCH, +# ifdef COMPILER_VERSION_TWEAK + '.', COMPILER_VERSION_TWEAK, +# endif +# endif +# endif + ']','\0'}; +#endif + +/* Construct a string literal encoding the internal version number. */ +#ifdef COMPILER_VERSION_INTERNAL +char const info_version_internal[] = { + 'I', 'N', 'F', 'O', ':', + 'c','o','m','p','i','l','e','r','_','v','e','r','s','i','o','n','_', + 'i','n','t','e','r','n','a','l','[', + COMPILER_VERSION_INTERNAL,']','\0'}; +#elif defined(COMPILER_VERSION_INTERNAL_STR) +char const* info_version_internal = "INFO" ":" "compiler_version_internal[" COMPILER_VERSION_INTERNAL_STR "]"; +#endif + +/* Construct a string literal encoding the version number components. */ +#ifdef SIMULATE_VERSION_MAJOR +char const info_simulate_version[] = { + 'I', 'N', 'F', 'O', ':', + 's','i','m','u','l','a','t','e','_','v','e','r','s','i','o','n','[', + SIMULATE_VERSION_MAJOR, +# ifdef SIMULATE_VERSION_MINOR + '.', SIMULATE_VERSION_MINOR, +# ifdef SIMULATE_VERSION_PATCH + '.', SIMULATE_VERSION_PATCH, +# ifdef SIMULATE_VERSION_TWEAK + '.', SIMULATE_VERSION_TWEAK, +# endif +# endif +# endif + ']','\0'}; +#endif + +/* Construct the string literal in pieces to prevent the source from + getting matched. Store it in a pointer rather than an array + because some compilers will just produce instructions to fill the + array rather than assigning a pointer to a static array. */ +char const* info_platform = "INFO" ":" "platform[" PLATFORM_ID "]"; +char const* info_arch = "INFO" ":" "arch[" ARCHITECTURE_ID "]"; + + + +#if !defined(__STDC__) && !defined(__clang__) +# if defined(_MSC_VER) || defined(__ibmxl__) || defined(__IBMC__) +# define C_DIALECT "90" +# else +# define C_DIALECT +# endif +#elif __STDC_VERSION__ > 201710L +# define C_DIALECT "23" +#elif __STDC_VERSION__ >= 201710L +# define C_DIALECT "17" +#elif __STDC_VERSION__ >= 201000L +# define C_DIALECT "11" +#elif __STDC_VERSION__ >= 199901L +# define C_DIALECT "99" +#else +# define C_DIALECT "90" +#endif +const char* info_language_dialect_default = + "INFO" ":" "dialect_default[" C_DIALECT "]"; + +/*--------------------------------------------------------------------------*/ + +#ifdef ID_VOID_MAIN +void main() {} +#else +# if defined(__CLASSIC_C__) +int main(argc, argv) int argc; char *argv[]; +# else +int main(int argc, char* argv[]) +# endif +{ + int require = 0; + require += info_compiler[argc]; + require += info_platform[argc]; + require += info_arch[argc]; +#ifdef COMPILER_VERSION_MAJOR + require += info_version[argc]; +#endif +#ifdef COMPILER_VERSION_INTERNAL + require += info_version_internal[argc]; +#endif +#ifdef SIMULATE_ID + require += info_simulate[argc]; +#endif +#ifdef SIMULATE_VERSION_MAJOR + require += info_simulate_version[argc]; +#endif +#if defined(__CRAYXT_COMPUTE_LINUX_TARGET) + require += info_cray[argc]; +#endif + require += info_language_dialect_default[argc]; + (void)argv; + return require; +} +#endif diff --git a/cmake-build-debug/CMakeFiles/3.21.1/CompilerIdC/a.out b/cmake-build-debug/CMakeFiles/3.21.1/CompilerIdC/a.out new file mode 100755 index 0000000000000000000000000000000000000000..070b54812cef7fab69654aacd7285906fcc19097 GIT binary patch literal 16704 zcmeHOeQX>@6`#Aa6Q@niPU_SqNt>ljC5P6RbG~{_YjS7%oW1Ijl*Fb%uCrbH&i2v! zaPRh7J0d0E&~gffAi~E#NL4|of`C+nf=26!SQR>1FV zVx3q5a1C5xVms-1ugPFqM{+)(sMm~{Ds-I*Lk(tP50RqYVyOikg2YtNeV|?~GN|mN zQSy^1^DFf!s0>MwzZH5O1t2lC>Y*#Mt&%Nf+wC+=^{GTz4~y~^0;W7Phna{@QGHA~ zo){CnLKIIYRZJ@t_nmqNNY6>TNRKJjfocC6M&duI?;+AVsYo-zNgps_!IbO!0O(QE zlEga`ZsvVd-(v01K=Efv;T4DG;=~T8j);bp2-nxBjppXk}mKCF4SO@m0 zU3+>3n3+P1!YJFKk;=$FRNK06_}L>Ww|&s_q`n8!L$ z#=QTJL5}(|(6h-`GZI+jCj_`sg|`N0CD1 zqYtD}b2yXBlBQ;gRuz=~m{H_ddLV)rL+%&FHK}D7-FwJ)9-llel$9o9j>awH7sx%EI8jY@@6bJ_f5oSEjW)c z#OExyd|o2xCN~0Z1l$O?5pW~mM!=1L8-f3u2>iAF_J61o7wgnxwZGmZg!+jo!&^S1 zPW-5DTHa%M+j9V4Dc|)KAoc47%0uY~veYGHx$VtZ>FhzZ^apj~kFyW;#3yUd!PHcp zT%k$Qei|&5SLZ?HZ^zZi_U}PPovi&flKbY2)ll^w%tO`7$`|U_AHj;JiGqAd%5VEP zl8rai(yV&=(oXgCoKN+V z4P&`_tbGX-W;T|~<(UNhyj*)5ls)~RYt#SplfXnny`Wb*d{HeGFT4`HhHk3IR{s=M z>c^rN)i0@@GxeuL{ST)+(QANze-Zra)o|0m5JZdv#*kqu%$s;$N`+`}!k~MEWBKBii)PP@sPOQM_N--qwJ zA2$MS1l$O?5pW~mM!=1L8v!>0ZUo#2xDogtjey7YwQ-@7u|3^;cMRq-qp5T<-v?hQ z`|UC|zV<{iUr6P$eLYhiA*>lRz6Um&-pxKF~&Z z4T0ZcF?kN{6P~dK&)Vfn>y8tSdkjLLk8cJ<*HZa~Zv$kvVi|A=_#3+Y%@5Y!{AAq` zv2)Fi_ifp52eQ%bBXG@JA~^&hp-ls>pMd^n5s3O5p7wUGSmOO8)C|=CbONq0_?tw2 zx4+>t-k87n)4r%*nXHNWTRv6WRzmhSS0v;I)TAB^~0I{Zq9zq!NT(BZF> z-!p#;>LXys{a%NGbdwtaHv(=1+z7Z4a3kPGz>R<#0XG610p8ch`xs#fBoou+EJ*tt zS5P@bn?>J4W!^8jmdd;j68Dv2;(e324#LFzt2fFyEI&(|5qZsWpaxOi<0{0DiGPy` zi^D{5zbU3>lZe$snUI>8qJ4}@iBU%tu^$TEFl+*qiS6Ca@hRr@J~kcPK5r1I4US zRA7M*EBn^AqAa#OwHX%tTQ?H??;Y~N4%TLFFpIbk-bwKObqfr8qkV$+r`z!w@sX-_ zYAgNBF2AJGzwG!@!Tr#V*9mS)@WI}W3>O8@kUTPx$!F5d(% zM68IJ_rYinR>k>gG_Ql>utr=i&m(3IpKD&>7o(1N!hQ>hKkLBXOE^C#O)Em&3mNFO z6@RckOr3Cf;B62;_aq2EABGF-<>xNrPe8^a7RK}QfLHT>vHN;n+F2!ji4HqbH9M!I z%qr)Oj5yq{)6R9k70`30CU5ogAzJ{)_=FWxV>2m+ zCEg^IunDmLVlZzMj3Vqr8Wi)#Lo_3!4dMZj0vrxW*Za`0K2_u&;XnJu>;G64o z(nux(!RiutE+wVu`Mf@^C9_6;Tny#)Oj1h}GnsKvv6M8BG;E@syYBe&A+)X!?TPG;b=o=dEDS*KdR>dEWI^rPC$wGhy&aLbwzs=` zf3!#IiFCxHXjPt|87vf~_wRgWCYjI;omJ)!-GsxoQ#Tq)nI~&N)_%-JOB8b2h@MU0 z5uDgwkV>SoTCtE!h*Wkcr}4Xdt_1zUP?=o*b^zRgLV>D~$9|-8TF(v_^ z!`UAWBOVH>deX;!w#a@{(ms8WFnz%f3_=77;~7IA0BYn-I>NbB7S0@via<7JBm=|Q zVqi3%8%^eoaSJq1Ou?zJRDz&LN37M*hlLa$(F-FYkQmQG6(%+ECWrlyVpPz8mrtg3 zR1g6fvcPEC5cm@q&OydVj=?W>QIO2ZmJB3Es8fz4K%YydzS%oX4bFpcJ(C&)cd#P_ zpb8YKh0oyOd|Avphsp%2e?Gx2ePQ2@V8-(&;IkehAG#N->fh>{nr7*H4W?Y zx`*j;RDy)}h;e3pUazD8!&_#3p1(5XbrXolgf^_{aVX##hV^-#%aqrH>_5vfeG2q( zO~hrM4>MJ$GN=Cpi%G~}Oj)1j%}fr+A(wEvfZVbxbi zk13mDeJ(S7&Y{oqb*3!0nEp2$`e9OFdezZjPJ1sn^m+czl-KWEzq9{-m-IRQLLo__ zC#lGUU@nRmA%`xq{z(#G`ang}%sA`+IlxwZUUx8^b?9^ZGyE&a;2fTYePw;Z=Y5^> zTxR+@=+;~GdHz1v3LqqwGfVSj#@_-4_C2n@GJl4B+nA=P{jmRIVm)rhuK|W4tk3T) zrf5PJ2A(ysKGQj1TJ=Skq=P0ULg0M;4BUVW+T!|oUKb=qu7~C6cDN{f03hb9hxPBS zNSYbew^HsqR?$bvph^Q9$MHRIu|NF$TLu{WZq=W=rGRpnp~WNR@c80G9_?* JVoi>s_!oMpj{5)r literal 0 HcmV?d00001 diff --git a/cmake-build-debug/CMakeFiles/3.21.1/CompilerIdCXX/CMakeCXXCompilerId.cpp b/cmake-build-debug/CMakeFiles/3.21.1/CompilerIdCXX/CMakeCXXCompilerId.cpp new file mode 100644 index 0000000..f675021 --- /dev/null +++ b/cmake-build-debug/CMakeFiles/3.21.1/CompilerIdCXX/CMakeCXXCompilerId.cpp @@ -0,0 +1,795 @@ +/* This source file must have a .cpp extension so that all C++ compilers + recognize the extension without flags. Borland does not know .cxx for + example. */ +#ifndef __cplusplus +# error "A C compiler has been selected for C++." +#endif + +#if !defined(__has_include) +/* If the compiler does not have __has_include, pretend the answer is + always no. */ +# define __has_include(x) 0 +#endif + + +/* Version number components: V=Version, R=Revision, P=Patch + Version date components: YYYY=Year, MM=Month, DD=Day */ + +#if defined(__COMO__) +# define COMPILER_ID "Comeau" + /* __COMO_VERSION__ = VRR */ +# define COMPILER_VERSION_MAJOR DEC(__COMO_VERSION__ / 100) +# define COMPILER_VERSION_MINOR DEC(__COMO_VERSION__ % 100) + +#elif defined(__INTEL_COMPILER) || defined(__ICC) +# define COMPILER_ID "Intel" +# if defined(_MSC_VER) +# define SIMULATE_ID "MSVC" +# endif +# if defined(__GNUC__) +# define SIMULATE_ID "GNU" +# endif + /* __INTEL_COMPILER = VRP prior to 2021, and then VVVV for 2021 and later, + except that a few beta releases use the old format with V=2021. */ +# if __INTEL_COMPILER < 2021 || __INTEL_COMPILER == 202110 || __INTEL_COMPILER == 202111 +# define COMPILER_VERSION_MAJOR DEC(__INTEL_COMPILER/100) +# define COMPILER_VERSION_MINOR DEC(__INTEL_COMPILER/10 % 10) +# if defined(__INTEL_COMPILER_UPDATE) +# define COMPILER_VERSION_PATCH DEC(__INTEL_COMPILER_UPDATE) +# else +# define COMPILER_VERSION_PATCH DEC(__INTEL_COMPILER % 10) +# endif +# else +# define COMPILER_VERSION_MAJOR DEC(__INTEL_COMPILER) +# define COMPILER_VERSION_MINOR DEC(__INTEL_COMPILER_UPDATE) + /* The third version component from --version is an update index, + but no macro is provided for it. */ +# define COMPILER_VERSION_PATCH DEC(0) +# endif +# if defined(__INTEL_COMPILER_BUILD_DATE) + /* __INTEL_COMPILER_BUILD_DATE = YYYYMMDD */ +# define COMPILER_VERSION_TWEAK DEC(__INTEL_COMPILER_BUILD_DATE) +# endif +# if defined(_MSC_VER) + /* _MSC_VER = VVRR */ +# define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100) +# define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100) +# endif +# if defined(__GNUC__) +# define SIMULATE_VERSION_MAJOR DEC(__GNUC__) +# elif defined(__GNUG__) +# define SIMULATE_VERSION_MAJOR DEC(__GNUG__) +# endif +# if defined(__GNUC_MINOR__) +# define SIMULATE_VERSION_MINOR DEC(__GNUC_MINOR__) +# endif +# if defined(__GNUC_PATCHLEVEL__) +# define SIMULATE_VERSION_PATCH DEC(__GNUC_PATCHLEVEL__) +# endif + +#elif (defined(__clang__) && defined(__INTEL_CLANG_COMPILER)) || defined(__INTEL_LLVM_COMPILER) +# define COMPILER_ID "IntelLLVM" +#if defined(_MSC_VER) +# define SIMULATE_ID "MSVC" +#endif +#if defined(__GNUC__) +# define SIMULATE_ID "GNU" +#endif +/* __INTEL_LLVM_COMPILER = VVVVRP prior to 2021.2.0, VVVVRRPP for 2021.2.0 and + * later. Look for 6 digit vs. 8 digit version number to decide encoding. + * VVVV is no smaller than the current year when a version is released. + */ +#if __INTEL_LLVM_COMPILER < 1000000L +# define COMPILER_VERSION_MAJOR DEC(__INTEL_LLVM_COMPILER/100) +# define COMPILER_VERSION_MINOR DEC(__INTEL_LLVM_COMPILER/10 % 10) +# define COMPILER_VERSION_PATCH DEC(__INTEL_LLVM_COMPILER % 10) +#else +# define COMPILER_VERSION_MAJOR DEC(__INTEL_LLVM_COMPILER/10000) +# define COMPILER_VERSION_MINOR DEC(__INTEL_LLVM_COMPILER/100 % 100) +# define COMPILER_VERSION_PATCH DEC(__INTEL_LLVM_COMPILER % 100) +#endif +#if defined(_MSC_VER) + /* _MSC_VER = VVRR */ +# define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100) +# define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100) +#endif +#if defined(__GNUC__) +# define SIMULATE_VERSION_MAJOR DEC(__GNUC__) +#elif defined(__GNUG__) +# define SIMULATE_VERSION_MAJOR DEC(__GNUG__) +#endif +#if defined(__GNUC_MINOR__) +# define SIMULATE_VERSION_MINOR DEC(__GNUC_MINOR__) +#endif +#if defined(__GNUC_PATCHLEVEL__) +# define SIMULATE_VERSION_PATCH DEC(__GNUC_PATCHLEVEL__) +#endif + +#elif defined(__PATHCC__) +# define COMPILER_ID "PathScale" +# define COMPILER_VERSION_MAJOR DEC(__PATHCC__) +# define COMPILER_VERSION_MINOR DEC(__PATHCC_MINOR__) +# if defined(__PATHCC_PATCHLEVEL__) +# define COMPILER_VERSION_PATCH DEC(__PATHCC_PATCHLEVEL__) +# endif + +#elif defined(__BORLANDC__) && defined(__CODEGEARC_VERSION__) +# define COMPILER_ID "Embarcadero" +# define COMPILER_VERSION_MAJOR HEX(__CODEGEARC_VERSION__>>24 & 0x00FF) +# define COMPILER_VERSION_MINOR HEX(__CODEGEARC_VERSION__>>16 & 0x00FF) +# define COMPILER_VERSION_PATCH DEC(__CODEGEARC_VERSION__ & 0xFFFF) + +#elif defined(__BORLANDC__) +# define COMPILER_ID "Borland" + /* __BORLANDC__ = 0xVRR */ +# define COMPILER_VERSION_MAJOR HEX(__BORLANDC__>>8) +# define COMPILER_VERSION_MINOR HEX(__BORLANDC__ & 0xFF) + +#elif defined(__WATCOMC__) && __WATCOMC__ < 1200 +# define COMPILER_ID "Watcom" + /* __WATCOMC__ = VVRR */ +# define COMPILER_VERSION_MAJOR DEC(__WATCOMC__ / 100) +# define COMPILER_VERSION_MINOR DEC((__WATCOMC__ / 10) % 10) +# if (__WATCOMC__ % 10) > 0 +# define COMPILER_VERSION_PATCH DEC(__WATCOMC__ % 10) +# endif + +#elif defined(__WATCOMC__) +# define COMPILER_ID "OpenWatcom" + /* __WATCOMC__ = VVRP + 1100 */ +# define COMPILER_VERSION_MAJOR DEC((__WATCOMC__ - 1100) / 100) +# define COMPILER_VERSION_MINOR DEC((__WATCOMC__ / 10) % 10) +# if (__WATCOMC__ % 10) > 0 +# define COMPILER_VERSION_PATCH DEC(__WATCOMC__ % 10) +# endif + +#elif defined(__SUNPRO_CC) +# define COMPILER_ID "SunPro" +# if __SUNPRO_CC >= 0x5100 + /* __SUNPRO_CC = 0xVRRP */ +# define COMPILER_VERSION_MAJOR HEX(__SUNPRO_CC>>12) +# define COMPILER_VERSION_MINOR HEX(__SUNPRO_CC>>4 & 0xFF) +# define COMPILER_VERSION_PATCH HEX(__SUNPRO_CC & 0xF) +# else + /* __SUNPRO_CC = 0xVRP */ +# define COMPILER_VERSION_MAJOR HEX(__SUNPRO_CC>>8) +# define COMPILER_VERSION_MINOR HEX(__SUNPRO_CC>>4 & 0xF) +# define COMPILER_VERSION_PATCH HEX(__SUNPRO_CC & 0xF) +# endif + +#elif defined(__HP_aCC) +# define COMPILER_ID "HP" + /* __HP_aCC = VVRRPP */ +# define COMPILER_VERSION_MAJOR DEC(__HP_aCC/10000) +# define COMPILER_VERSION_MINOR DEC(__HP_aCC/100 % 100) +# define COMPILER_VERSION_PATCH DEC(__HP_aCC % 100) + +#elif defined(__DECCXX) +# define COMPILER_ID "Compaq" + /* __DECCXX_VER = VVRRTPPPP */ +# define COMPILER_VERSION_MAJOR DEC(__DECCXX_VER/10000000) +# define COMPILER_VERSION_MINOR DEC(__DECCXX_VER/100000 % 100) +# define COMPILER_VERSION_PATCH DEC(__DECCXX_VER % 10000) + +#elif defined(__IBMCPP__) && defined(__COMPILER_VER__) +# define COMPILER_ID "zOS" + /* __IBMCPP__ = VRP */ +# define COMPILER_VERSION_MAJOR DEC(__IBMCPP__/100) +# define COMPILER_VERSION_MINOR DEC(__IBMCPP__/10 % 10) +# define COMPILER_VERSION_PATCH DEC(__IBMCPP__ % 10) + +#elif defined(__ibmxl__) && defined(__clang__) +# define COMPILER_ID "XLClang" +# define COMPILER_VERSION_MAJOR DEC(__ibmxl_version__) +# define COMPILER_VERSION_MINOR DEC(__ibmxl_release__) +# define COMPILER_VERSION_PATCH DEC(__ibmxl_modification__) +# define COMPILER_VERSION_TWEAK DEC(__ibmxl_ptf_fix_level__) + + +#elif defined(__IBMCPP__) && !defined(__COMPILER_VER__) && __IBMCPP__ >= 800 +# define COMPILER_ID "XL" + /* __IBMCPP__ = VRP */ +# define COMPILER_VERSION_MAJOR DEC(__IBMCPP__/100) +# define COMPILER_VERSION_MINOR DEC(__IBMCPP__/10 % 10) +# define COMPILER_VERSION_PATCH DEC(__IBMCPP__ % 10) + +#elif defined(__IBMCPP__) && !defined(__COMPILER_VER__) && __IBMCPP__ < 800 +# define COMPILER_ID "VisualAge" + /* __IBMCPP__ = VRP */ +# define COMPILER_VERSION_MAJOR DEC(__IBMCPP__/100) +# define COMPILER_VERSION_MINOR DEC(__IBMCPP__/10 % 10) +# define COMPILER_VERSION_PATCH DEC(__IBMCPP__ % 10) + +#elif defined(__NVCOMPILER) +# define COMPILER_ID "NVHPC" +# define COMPILER_VERSION_MAJOR DEC(__NVCOMPILER_MAJOR__) +# define COMPILER_VERSION_MINOR DEC(__NVCOMPILER_MINOR__) +# if defined(__NVCOMPILER_PATCHLEVEL__) +# define COMPILER_VERSION_PATCH DEC(__NVCOMPILER_PATCHLEVEL__) +# endif + +#elif defined(__PGI) +# define COMPILER_ID "PGI" +# define COMPILER_VERSION_MAJOR DEC(__PGIC__) +# define COMPILER_VERSION_MINOR DEC(__PGIC_MINOR__) +# if defined(__PGIC_PATCHLEVEL__) +# define COMPILER_VERSION_PATCH DEC(__PGIC_PATCHLEVEL__) +# endif + +#elif defined(_CRAYC) +# define COMPILER_ID "Cray" +# define COMPILER_VERSION_MAJOR DEC(_RELEASE_MAJOR) +# define COMPILER_VERSION_MINOR DEC(_RELEASE_MINOR) + +#elif defined(__TI_COMPILER_VERSION__) +# define COMPILER_ID "TI" + /* __TI_COMPILER_VERSION__ = VVVRRRPPP */ +# define COMPILER_VERSION_MAJOR DEC(__TI_COMPILER_VERSION__/1000000) +# define COMPILER_VERSION_MINOR DEC(__TI_COMPILER_VERSION__/1000 % 1000) +# define COMPILER_VERSION_PATCH DEC(__TI_COMPILER_VERSION__ % 1000) + +#elif defined(__CLANG_FUJITSU) +# define COMPILER_ID "FujitsuClang" +# define COMPILER_VERSION_MAJOR DEC(__FCC_major__) +# define COMPILER_VERSION_MINOR DEC(__FCC_minor__) +# define COMPILER_VERSION_PATCH DEC(__FCC_patchlevel__) +# define COMPILER_VERSION_INTERNAL_STR __clang_version__ + + +#elif defined(__FUJITSU) +# define COMPILER_ID "Fujitsu" +# if defined(__FCC_version__) +# define COMPILER_VERSION __FCC_version__ +# elif defined(__FCC_major__) +# define COMPILER_VERSION_MAJOR DEC(__FCC_major__) +# define COMPILER_VERSION_MINOR DEC(__FCC_minor__) +# define COMPILER_VERSION_PATCH DEC(__FCC_patchlevel__) +# endif +# if defined(__fcc_version) +# define COMPILER_VERSION_INTERNAL DEC(__fcc_version) +# elif defined(__FCC_VERSION) +# define COMPILER_VERSION_INTERNAL DEC(__FCC_VERSION) +# endif + + +#elif defined(__ghs__) +# define COMPILER_ID "GHS" +/* __GHS_VERSION_NUMBER = VVVVRP */ +# ifdef __GHS_VERSION_NUMBER +# define COMPILER_VERSION_MAJOR DEC(__GHS_VERSION_NUMBER / 100) +# define COMPILER_VERSION_MINOR DEC(__GHS_VERSION_NUMBER / 10 % 10) +# define COMPILER_VERSION_PATCH DEC(__GHS_VERSION_NUMBER % 10) +# endif + +#elif defined(__SCO_VERSION__) +# define COMPILER_ID "SCO" + +#elif defined(__ARMCC_VERSION) && !defined(__clang__) +# define COMPILER_ID "ARMCC" +#if __ARMCC_VERSION >= 1000000 + /* __ARMCC_VERSION = VRRPPPP */ + # define COMPILER_VERSION_MAJOR DEC(__ARMCC_VERSION/1000000) + # define COMPILER_VERSION_MINOR DEC(__ARMCC_VERSION/10000 % 100) + # define COMPILER_VERSION_PATCH DEC(__ARMCC_VERSION % 10000) +#else + /* __ARMCC_VERSION = VRPPPP */ + # define COMPILER_VERSION_MAJOR DEC(__ARMCC_VERSION/100000) + # define COMPILER_VERSION_MINOR DEC(__ARMCC_VERSION/10000 % 10) + # define COMPILER_VERSION_PATCH DEC(__ARMCC_VERSION % 10000) +#endif + + +#elif defined(__clang__) && defined(__apple_build_version__) +# define COMPILER_ID "AppleClang" +# if defined(_MSC_VER) +# define SIMULATE_ID "MSVC" +# endif +# define COMPILER_VERSION_MAJOR DEC(__clang_major__) +# define COMPILER_VERSION_MINOR DEC(__clang_minor__) +# define COMPILER_VERSION_PATCH DEC(__clang_patchlevel__) +# if defined(_MSC_VER) + /* _MSC_VER = VVRR */ +# define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100) +# define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100) +# endif +# define COMPILER_VERSION_TWEAK DEC(__apple_build_version__) + +#elif defined(__clang__) && defined(__ARMCOMPILER_VERSION) +# define COMPILER_ID "ARMClang" + # define COMPILER_VERSION_MAJOR DEC(__ARMCOMPILER_VERSION/1000000) + # define COMPILER_VERSION_MINOR DEC(__ARMCOMPILER_VERSION/10000 % 100) + # define COMPILER_VERSION_PATCH DEC(__ARMCOMPILER_VERSION % 10000) +# define COMPILER_VERSION_INTERNAL DEC(__ARMCOMPILER_VERSION) + +#elif defined(__clang__) && __has_include() +# define COMPILER_ID "ROCMClang" +# if defined(_MSC_VER) +# define SIMULATE_ID "MSVC" +# elif defined(__clang__) +# define SIMULATE_ID "Clang" +# elif defined(__GNUC__) +# define SIMULATE_ID "GNU" +# endif +# if defined(__clang__) && __has_include() +# include +# define COMPILER_VERSION_MAJOR DEC(HIP_VERSION_MAJOR) +# define COMPILER_VERSION_MINOR DEC(HIP_VERSION_MINOR) +# define COMPILER_VERSION_PATCH DEC(HIP_VERSION_PATCH) +# endif + +#elif defined(__clang__) +# define COMPILER_ID "Clang" +# if defined(_MSC_VER) +# define SIMULATE_ID "MSVC" +# endif +# define COMPILER_VERSION_MAJOR DEC(__clang_major__) +# define COMPILER_VERSION_MINOR DEC(__clang_minor__) +# define COMPILER_VERSION_PATCH DEC(__clang_patchlevel__) +# if defined(_MSC_VER) + /* _MSC_VER = VVRR */ +# define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100) +# define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100) +# endif + +#elif defined(__GNUC__) || defined(__GNUG__) +# define COMPILER_ID "GNU" +# if defined(__GNUC__) +# define COMPILER_VERSION_MAJOR DEC(__GNUC__) +# else +# define COMPILER_VERSION_MAJOR DEC(__GNUG__) +# endif +# if defined(__GNUC_MINOR__) +# define COMPILER_VERSION_MINOR DEC(__GNUC_MINOR__) +# endif +# if defined(__GNUC_PATCHLEVEL__) +# define COMPILER_VERSION_PATCH DEC(__GNUC_PATCHLEVEL__) +# endif + +#elif defined(_MSC_VER) +# define COMPILER_ID "MSVC" + /* _MSC_VER = VVRR */ +# define COMPILER_VERSION_MAJOR DEC(_MSC_VER / 100) +# define COMPILER_VERSION_MINOR DEC(_MSC_VER % 100) +# if defined(_MSC_FULL_VER) +# if _MSC_VER >= 1400 + /* _MSC_FULL_VER = VVRRPPPPP */ +# define COMPILER_VERSION_PATCH DEC(_MSC_FULL_VER % 100000) +# else + /* _MSC_FULL_VER = VVRRPPPP */ +# define COMPILER_VERSION_PATCH DEC(_MSC_FULL_VER % 10000) +# endif +# endif +# if defined(_MSC_BUILD) +# define COMPILER_VERSION_TWEAK DEC(_MSC_BUILD) +# endif + +#elif defined(__VISUALDSPVERSION__) || defined(__ADSPBLACKFIN__) || defined(__ADSPTS__) || defined(__ADSP21000__) +# define COMPILER_ID "ADSP" +#if defined(__VISUALDSPVERSION__) + /* __VISUALDSPVERSION__ = 0xVVRRPP00 */ +# define COMPILER_VERSION_MAJOR HEX(__VISUALDSPVERSION__>>24) +# define COMPILER_VERSION_MINOR HEX(__VISUALDSPVERSION__>>16 & 0xFF) +# define COMPILER_VERSION_PATCH HEX(__VISUALDSPVERSION__>>8 & 0xFF) +#endif + +#elif defined(__IAR_SYSTEMS_ICC__) || defined(__IAR_SYSTEMS_ICC) +# define COMPILER_ID "IAR" +# if defined(__VER__) && defined(__ICCARM__) +# define COMPILER_VERSION_MAJOR DEC((__VER__) / 1000000) +# define COMPILER_VERSION_MINOR DEC(((__VER__) / 1000) % 1000) +# define COMPILER_VERSION_PATCH DEC((__VER__) % 1000) +# define COMPILER_VERSION_INTERNAL DEC(__IAR_SYSTEMS_ICC__) +# elif defined(__VER__) && (defined(__ICCAVR__) || defined(__ICCRX__) || defined(__ICCRH850__) || defined(__ICCRL78__) || defined(__ICC430__) || defined(__ICCRISCV__) || defined(__ICCV850__) || defined(__ICC8051__) || defined(__ICCSTM8__)) +# define COMPILER_VERSION_MAJOR DEC((__VER__) / 100) +# define COMPILER_VERSION_MINOR DEC((__VER__) - (((__VER__) / 100)*100)) +# define COMPILER_VERSION_PATCH DEC(__SUBVERSION__) +# define COMPILER_VERSION_INTERNAL DEC(__IAR_SYSTEMS_ICC__) +# endif + + +/* These compilers are either not known or too old to define an + identification macro. Try to identify the platform and guess that + it is the native compiler. */ +#elif defined(__hpux) || defined(__hpua) +# define COMPILER_ID "HP" + +#else /* unknown compiler */ +# define COMPILER_ID "" +#endif + +/* Construct the string literal in pieces to prevent the source from + getting matched. Store it in a pointer rather than an array + because some compilers will just produce instructions to fill the + array rather than assigning a pointer to a static array. */ +char const* info_compiler = "INFO" ":" "compiler[" COMPILER_ID "]"; +#ifdef SIMULATE_ID +char const* info_simulate = "INFO" ":" "simulate[" SIMULATE_ID "]"; +#endif + +#ifdef __QNXNTO__ +char const* qnxnto = "INFO" ":" "qnxnto[]"; +#endif + +#if defined(__CRAYXT_COMPUTE_LINUX_TARGET) +char const *info_cray = "INFO" ":" "compiler_wrapper[CrayPrgEnv]"; +#endif + +#define STRINGIFY_HELPER(X) #X +#define STRINGIFY(X) STRINGIFY_HELPER(X) + +/* Identify known platforms by name. */ +#if defined(__linux) || defined(__linux__) || defined(linux) +# define PLATFORM_ID "Linux" + +#elif defined(__MSYS__) +# define PLATFORM_ID "MSYS" + +#elif defined(__CYGWIN__) +# define PLATFORM_ID "Cygwin" + +#elif defined(__MINGW32__) +# define PLATFORM_ID "MinGW" + +#elif defined(__APPLE__) +# define PLATFORM_ID "Darwin" + +#elif defined(_WIN32) || defined(__WIN32__) || defined(WIN32) +# define PLATFORM_ID "Windows" + +#elif defined(__FreeBSD__) || defined(__FreeBSD) +# define PLATFORM_ID "FreeBSD" + +#elif defined(__NetBSD__) || defined(__NetBSD) +# define PLATFORM_ID "NetBSD" + +#elif defined(__OpenBSD__) || defined(__OPENBSD) +# define PLATFORM_ID "OpenBSD" + +#elif defined(__sun) || defined(sun) +# define PLATFORM_ID "SunOS" + +#elif defined(_AIX) || defined(__AIX) || defined(__AIX__) || defined(__aix) || defined(__aix__) +# define PLATFORM_ID "AIX" + +#elif defined(__hpux) || defined(__hpux__) +# define PLATFORM_ID "HP-UX" + +#elif defined(__HAIKU__) +# define PLATFORM_ID "Haiku" + +#elif defined(__BeOS) || defined(__BEOS__) || defined(_BEOS) +# define PLATFORM_ID "BeOS" + +#elif defined(__QNX__) || defined(__QNXNTO__) +# define PLATFORM_ID "QNX" + +#elif defined(__tru64) || defined(_tru64) || defined(__TRU64__) +# define PLATFORM_ID "Tru64" + +#elif defined(__riscos) || defined(__riscos__) +# define PLATFORM_ID "RISCos" + +#elif defined(__sinix) || defined(__sinix__) || defined(__SINIX__) +# define PLATFORM_ID "SINIX" + +#elif defined(__UNIX_SV__) +# define PLATFORM_ID "UNIX_SV" + +#elif defined(__bsdos__) +# define PLATFORM_ID "BSDOS" + +#elif defined(_MPRAS) || defined(MPRAS) +# define PLATFORM_ID "MP-RAS" + +#elif defined(__osf) || defined(__osf__) +# define PLATFORM_ID "OSF1" + +#elif defined(_SCO_SV) || defined(SCO_SV) || defined(sco_sv) +# define PLATFORM_ID "SCO_SV" + +#elif defined(__ultrix) || defined(__ultrix__) || defined(_ULTRIX) +# define PLATFORM_ID "ULTRIX" + +#elif defined(__XENIX__) || defined(_XENIX) || defined(XENIX) +# define PLATFORM_ID "Xenix" + +#elif defined(__WATCOMC__) +# if defined(__LINUX__) +# define PLATFORM_ID "Linux" + +# elif defined(__DOS__) +# define PLATFORM_ID "DOS" + +# elif defined(__OS2__) +# define PLATFORM_ID "OS2" + +# elif defined(__WINDOWS__) +# define PLATFORM_ID "Windows3x" + +# elif defined(__VXWORKS__) +# define PLATFORM_ID "VxWorks" + +# else /* unknown platform */ +# define PLATFORM_ID +# endif + +#elif defined(__INTEGRITY) +# if defined(INT_178B) +# define PLATFORM_ID "Integrity178" + +# else /* regular Integrity */ +# define PLATFORM_ID "Integrity" +# endif + +#else /* unknown platform */ +# define PLATFORM_ID + +#endif + +/* For windows compilers MSVC and Intel we can determine + the architecture of the compiler being used. This is because + the compilers do not have flags that can change the architecture, + but rather depend on which compiler is being used +*/ +#if defined(_WIN32) && defined(_MSC_VER) +# if defined(_M_IA64) +# define ARCHITECTURE_ID "IA64" + +# elif defined(_M_ARM64EC) +# define ARCHITECTURE_ID "ARM64EC" + +# elif defined(_M_X64) || defined(_M_AMD64) +# define ARCHITECTURE_ID "x64" + +# elif defined(_M_IX86) +# define ARCHITECTURE_ID "X86" + +# elif defined(_M_ARM64) +# define ARCHITECTURE_ID "ARM64" + +# elif defined(_M_ARM) +# if _M_ARM == 4 +# define ARCHITECTURE_ID "ARMV4I" +# elif _M_ARM == 5 +# define ARCHITECTURE_ID "ARMV5I" +# else +# define ARCHITECTURE_ID "ARMV" STRINGIFY(_M_ARM) +# endif + +# elif defined(_M_MIPS) +# define ARCHITECTURE_ID "MIPS" + +# elif defined(_M_SH) +# define ARCHITECTURE_ID "SHx" + +# else /* unknown architecture */ +# define ARCHITECTURE_ID "" +# endif + +#elif defined(__WATCOMC__) +# if defined(_M_I86) +# define ARCHITECTURE_ID "I86" + +# elif defined(_M_IX86) +# define ARCHITECTURE_ID "X86" + +# else /* unknown architecture */ +# define ARCHITECTURE_ID "" +# endif + +#elif defined(__IAR_SYSTEMS_ICC__) || defined(__IAR_SYSTEMS_ICC) +# if defined(__ICCARM__) +# define ARCHITECTURE_ID "ARM" + +# elif defined(__ICCRX__) +# define ARCHITECTURE_ID "RX" + +# elif defined(__ICCRH850__) +# define ARCHITECTURE_ID "RH850" + +# elif defined(__ICCRL78__) +# define ARCHITECTURE_ID "RL78" + +# elif defined(__ICCRISCV__) +# define ARCHITECTURE_ID "RISCV" + +# elif defined(__ICCAVR__) +# define ARCHITECTURE_ID "AVR" + +# elif defined(__ICC430__) +# define ARCHITECTURE_ID "MSP430" + +# elif defined(__ICCV850__) +# define ARCHITECTURE_ID "V850" + +# elif defined(__ICC8051__) +# define ARCHITECTURE_ID "8051" + +# elif defined(__ICCSTM8__) +# define ARCHITECTURE_ID "STM8" + +# else /* unknown architecture */ +# define ARCHITECTURE_ID "" +# endif + +#elif defined(__ghs__) +# if defined(__PPC64__) +# define ARCHITECTURE_ID "PPC64" + +# elif defined(__ppc__) +# define ARCHITECTURE_ID "PPC" + +# elif defined(__ARM__) +# define ARCHITECTURE_ID "ARM" + +# elif defined(__x86_64__) +# define ARCHITECTURE_ID "x64" + +# elif defined(__i386__) +# define ARCHITECTURE_ID "X86" + +# else /* unknown architecture */ +# define ARCHITECTURE_ID "" +# endif + +#elif defined(__TI_COMPILER_VERSION__) +# if defined(__TI_ARM__) +# define ARCHITECTURE_ID "ARM" + +# elif defined(__MSP430__) +# define ARCHITECTURE_ID "MSP430" + +# elif defined(__TMS320C28XX__) +# define ARCHITECTURE_ID "TMS320C28x" + +# elif defined(__TMS320C6X__) || defined(_TMS320C6X) +# define ARCHITECTURE_ID "TMS320C6x" + +# else /* unknown architecture */ +# define ARCHITECTURE_ID "" +# endif + +#else +# define ARCHITECTURE_ID +#endif + +/* Convert integer to decimal digit literals. */ +#define DEC(n) \ + ('0' + (((n) / 10000000)%10)), \ + ('0' + (((n) / 1000000)%10)), \ + ('0' + (((n) / 100000)%10)), \ + ('0' + (((n) / 10000)%10)), \ + ('0' + (((n) / 1000)%10)), \ + ('0' + (((n) / 100)%10)), \ + ('0' + (((n) / 10)%10)), \ + ('0' + ((n) % 10)) + +/* Convert integer to hex digit literals. */ +#define HEX(n) \ + ('0' + ((n)>>28 & 0xF)), \ + ('0' + ((n)>>24 & 0xF)), \ + ('0' + ((n)>>20 & 0xF)), \ + ('0' + ((n)>>16 & 0xF)), \ + ('0' + ((n)>>12 & 0xF)), \ + ('0' + ((n)>>8 & 0xF)), \ + ('0' + ((n)>>4 & 0xF)), \ + ('0' + ((n) & 0xF)) + +/* Construct a string literal encoding the version number. */ +#ifdef COMPILER_VERSION +char const* info_version = "INFO" ":" "compiler_version[" COMPILER_VERSION "]"; + +/* Construct a string literal encoding the version number components. */ +#elif defined(COMPILER_VERSION_MAJOR) +char const info_version[] = { + 'I', 'N', 'F', 'O', ':', + 'c','o','m','p','i','l','e','r','_','v','e','r','s','i','o','n','[', + COMPILER_VERSION_MAJOR, +# ifdef COMPILER_VERSION_MINOR + '.', COMPILER_VERSION_MINOR, +# ifdef COMPILER_VERSION_PATCH + '.', COMPILER_VERSION_PATCH, +# ifdef COMPILER_VERSION_TWEAK + '.', COMPILER_VERSION_TWEAK, +# endif +# endif +# endif + ']','\0'}; +#endif + +/* Construct a string literal encoding the internal version number. */ +#ifdef COMPILER_VERSION_INTERNAL +char const info_version_internal[] = { + 'I', 'N', 'F', 'O', ':', + 'c','o','m','p','i','l','e','r','_','v','e','r','s','i','o','n','_', + 'i','n','t','e','r','n','a','l','[', + COMPILER_VERSION_INTERNAL,']','\0'}; +#elif defined(COMPILER_VERSION_INTERNAL_STR) +char const* info_version_internal = "INFO" ":" "compiler_version_internal[" COMPILER_VERSION_INTERNAL_STR "]"; +#endif + +/* Construct a string literal encoding the version number components. */ +#ifdef SIMULATE_VERSION_MAJOR +char const info_simulate_version[] = { + 'I', 'N', 'F', 'O', ':', + 's','i','m','u','l','a','t','e','_','v','e','r','s','i','o','n','[', + SIMULATE_VERSION_MAJOR, +# ifdef SIMULATE_VERSION_MINOR + '.', SIMULATE_VERSION_MINOR, +# ifdef SIMULATE_VERSION_PATCH + '.', SIMULATE_VERSION_PATCH, +# ifdef SIMULATE_VERSION_TWEAK + '.', SIMULATE_VERSION_TWEAK, +# endif +# endif +# endif + ']','\0'}; +#endif + +/* Construct the string literal in pieces to prevent the source from + getting matched. Store it in a pointer rather than an array + because some compilers will just produce instructions to fill the + array rather than assigning a pointer to a static array. */ +char const* info_platform = "INFO" ":" "platform[" PLATFORM_ID "]"; +char const* info_arch = "INFO" ":" "arch[" ARCHITECTURE_ID "]"; + + + +#if defined(__INTEL_COMPILER) && defined(_MSVC_LANG) && _MSVC_LANG < 201403L +# if defined(__INTEL_CXX11_MODE__) +# if defined(__cpp_aggregate_nsdmi) +# define CXX_STD 201402L +# else +# define CXX_STD 201103L +# endif +# else +# define CXX_STD 199711L +# endif +#elif defined(_MSC_VER) && defined(_MSVC_LANG) +# define CXX_STD _MSVC_LANG +#else +# define CXX_STD __cplusplus +#endif + +const char* info_language_dialect_default = "INFO" ":" "dialect_default[" +#if CXX_STD > 202002L + "23" +#elif CXX_STD > 201703L + "20" +#elif CXX_STD >= 201703L + "17" +#elif CXX_STD >= 201402L + "14" +#elif CXX_STD >= 201103L + "11" +#else + "98" +#endif +"]"; + +/*--------------------------------------------------------------------------*/ + +int main(int argc, char* argv[]) +{ + int require = 0; + require += info_compiler[argc]; + require += info_platform[argc]; +#ifdef COMPILER_VERSION_MAJOR + require += info_version[argc]; +#endif +#ifdef COMPILER_VERSION_INTERNAL + require += info_version_internal[argc]; +#endif +#ifdef SIMULATE_ID + require += info_simulate[argc]; +#endif +#ifdef SIMULATE_VERSION_MAJOR + require += info_simulate_version[argc]; +#endif +#if defined(__CRAYXT_COMPUTE_LINUX_TARGET) + require += info_cray[argc]; +#endif + require += info_language_dialect_default[argc]; + (void)argv; + return require; +} diff --git a/cmake-build-debug/CMakeFiles/3.21.1/CompilerIdCXX/a.out b/cmake-build-debug/CMakeFiles/3.21.1/CompilerIdCXX/a.out new file mode 100755 index 0000000000000000000000000000000000000000..ebffe4c4b4c4a09d4d9a5d8233f4d5c932d4faa2 GIT binary patch literal 16712 zcmeHOZ)_Y#6`%9jvC}5!%Rge0wq8OiIkdi^a-a{9sBsMj;?y|l++Xwf@ z-0h`yL_&ho!YLRc5d2P z$h7k~7OgCP1kv7i;X;K)e?a?V2!A1@ACvsKFF&AtKt{N?Nc%AdG^}1MTXt zfbve%3`t5X~z)NrxLOqX5}daOnvAMQwZm% zK1Plw#sq&I6i+8Ark6_dopwWH=fobeW5ha84qi4A@1(v5$nK0H-3TY%Z_-#X+ zQP+~j+XHv=0jlp-{otqgGg5fP_H=4=_s;F$Wa(&U#zD*mcKfGqxa%JP9OjM)aOqmt{1tFQrr3Z5pW~mM!=1L8v!>0ZUo#2xDjw8;6}iW!2d`DJhrcm%Nrf-@7=#Ap36+8(#iZV ze5D+*>)6V*L&o{>N&%SFfm5JZoPnoTa_*%YD*W(L5wnFuF%+&Y!LRnu&*cS}@TDp8nm#?YI=kM}0 z$nTlI1@j^B<9@HhK)T{az>R<#0XG6}1l$O?5pW~mM!<~#M}XHg@;XMC0!d+9#fr4f zaW&;zXtC(KDbMRAH&dS1LE^en6ka!p^B@#1fBj}ThxsRHF(S`dhH8=JHLgPZl*(^2 zX>o)Q*PEg=nIJY0GLV^=qjik+RM0>baXS<`VORtzh5g;d`h;(m&Gv%2G=(p!visJ-Ubj0gZc|9txKke)8-lMb(jux{< zQGp3Q%hh=JGT-2?;GTW6|7C%VHR~Syp!Pd>lPZ;MtcRXPq*{6;?q_A z)K$irU4KPoeA)SW!Q;@*Hwf-eJHJx!II#1#2_A2D9!4)+S9X4tP^$8)MX)OGtL)FP z`)L$>o!WVDqF5O-?G+h|lURW7EUsZoyWgmlGe|_b8xASmyRvDjO@vh4CY1iK< zM99jRX)j#u!Kyspjh1ZiI;<71m6sSZh4-}@;S-aNc)~gi$v@%X-$Oj#CrvLxydM%U zYAfx*`cS&z=Yh9DeBYBK96kX*te5Y*%pZb;M=X!$SAeh9{xeeFFG30=K-x_JAJz4r z0p0`s_)9zyhg9?bywq8@to<(m@4>sQqaXi7`usn@RlFe+%g5C!XsD-3zds9njaYtN zYyo~P#*O}W_M)kCoFmm~V zrWdCKzPU~(jbtJatgeCkQc{|p&+F4#GHc|g#aLd?B(+2_lbHq+OHKn#!=~E3Pyb}H zduXVe-j7EUf%xR4&^{JxYfojza{N9V{PZ3O?~7=W{vHiBuGl>#gx2%X{_wtNx4lH} zkO2x_x@!@YJg7Yfgw_|^-xZE&`+Iv2Mh3Kja91pXUgf@;c%dlI>FsyYBon%!v&qs{ zoKVQN7e_-abH5Gf+Be^5i9$}B(6b5Lm=oO(T8UIvD;AOoAy1v(@N*^DE)1Yq%3lQD&%G$X`I%x<3)WOy21V#0Mube5Qh=B3RT_zW8ZOPKPl-SzcdIDC`@MzeH75h zn>fL#R2DWLO^QG^XCwpT*(AuvCJma96a|(8q;TpU?{vB9NHQ zLKP+&d9#E*k=QaCl;x9Y9SuZ4Mkz3vHUu65<2gte$tgJESOv|T?7Tp7f=1^=0_-_w z+MC1FwBR&2*E6X&Gza@W0C5)q=!Xmpd%pVKIpRD3ZVhlRH-(?;7;K20z-q6M9V5GAd(JaH>9FVLc1G5_mHoFJ_8~H0yzJ;Or@!wy?0Fu* z$n$uv-#LE2Pxc&tp^zpaK7U$8v1TCsBluwx+5U_I84$+%&1~i9tpDdwVzuY_2jfD; z(oAswGyN+_;Ilkk_LX@G@B4M?bDr^!VB2W1=jZsvRvy%JVX; z>qeQQ{=@N)!gkz`-vka-*q+~C%+Ui}2+FL&_Kb^AXtft1(hizPK;%;WOx%P7`r`We zIW92Owffk4h#58K~U(KHimZ$%zER@IM_LzOOUypFL;xIKLTTL~Pu-D>|W e{9^z)=y1;Unx**6S>6844pRf?FII76#lHY9q>c*! literal 0 HcmV?d00001 diff --git a/cmake-build-debug/CMakeFiles/CMakeOutput.log b/cmake-build-debug/CMakeFiles/CMakeOutput.log new file mode 100644 index 0000000..ea5c020 --- /dev/null +++ b/cmake-build-debug/CMakeFiles/CMakeOutput.log @@ -0,0 +1,427 @@ +The system is: Linux - 5.14.0-1027-oem - x86_64 +Compiling the C compiler identification source file "CMakeCCompilerId.c" succeeded. +Compiler: /usr/bin/gcc-10 +Build flags: +Id flags: + +The output was: +0 + + +Compilation of the C compiler identification source "CMakeCCompilerId.c" produced "a.out" + +The C compiler identification is GNU, found in "/home/tomer/Github/Public-PF/cmake-build-debug/CMakeFiles/3.21.1/CompilerIdC/a.out" + +Compiling the CXX compiler identification source file "CMakeCXXCompilerId.cpp" succeeded. +Compiler: /usr/bin/g++-10 +Build flags: +Id flags: + +The output was: +0 + + +Compilation of the CXX compiler identification source "CMakeCXXCompilerId.cpp" produced "a.out" + +The CXX compiler identification is GNU, found in "/home/tomer/Github/Public-PF/cmake-build-debug/CMakeFiles/3.21.1/CompilerIdCXX/a.out" + +Detecting C compiler ABI info compiled with the following output: +Change Dir: /home/tomer/Github/Public-PF/cmake-build-debug/CMakeFiles/CMakeTmp + +Run Build Command(s):/snap/clion/184/bin/ninja/linux/ninja cmTC_f2ba8 && [1/2] Building C object CMakeFiles/cmTC_f2ba8.dir/CMakeCCompilerABI.c.o +Using built-in specs. +COLLECT_GCC=/usr/bin/gcc-10 +OFFLOAD_TARGET_NAMES=nvptx-none:amdgcn-amdhsa:hsa +OFFLOAD_TARGET_DEFAULT=1 +Target: x86_64-linux-gnu +Configured with: ../src/configure -v --with-pkgversion='Ubuntu 10.3.0-1ubuntu1~20.04' --with-bugurl=file:///usr/share/doc/gcc-10/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++,m2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-10 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-bootstrap --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib --enable-libphobos-checking=release --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none=/build/gcc-10-S4I5Pr/gcc-10-10.3.0/debian/tmp-nvptx/usr,amdgcn-amdhsa=/build/gcc-10-S4I5Pr/gcc-10-10.3.0/debian/tmp-gcn/usr,hsa --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu --with-build-config=bootstrap-lto-lean --enable-link-mutex +Thread model: posix +Supported LTO compression algorithms: zlib zstd +gcc version 10.3.0 (Ubuntu 10.3.0-1ubuntu1~20.04) +COLLECT_GCC_OPTIONS='-v' '-o' 'CMakeFiles/cmTC_f2ba8.dir/CMakeCCompilerABI.c.o' '-c' '-mtune=generic' '-march=x86-64' + /usr/lib/gcc/x86_64-linux-gnu/10/cc1 -quiet -v -imultiarch x86_64-linux-gnu /snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/CMakeCCompilerABI.c -quiet -dumpbase CMakeCCompilerABI.c -mtune=generic -march=x86-64 -auxbase-strip CMakeFiles/cmTC_f2ba8.dir/CMakeCCompilerABI.c.o -version -fasynchronous-unwind-tables -fstack-protector-strong -Wformat -Wformat-security -fstack-clash-protection -fcf-protection -o /tmp/ccapqHEJ.s +GNU C17 (Ubuntu 10.3.0-1ubuntu1~20.04) version 10.3.0 (x86_64-linux-gnu) + compiled by GNU C version 10.3.0, GMP version 6.2.0, MPFR version 4.0.2, MPC version 1.1.0, isl version isl-0.22.1-GMP + +GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 +ignoring nonexistent directory "/usr/local/include/x86_64-linux-gnu" +ignoring nonexistent directory "/usr/lib/gcc/x86_64-linux-gnu/10/include-fixed" +ignoring nonexistent directory "/usr/lib/gcc/x86_64-linux-gnu/10/../../../../x86_64-linux-gnu/include" +#include "..." search starts here: +#include <...> search starts here: + /usr/lib/gcc/x86_64-linux-gnu/10/include + /usr/local/include + /usr/include/x86_64-linux-gnu + /usr/include +End of search list. +GNU C17 (Ubuntu 10.3.0-1ubuntu1~20.04) version 10.3.0 (x86_64-linux-gnu) + compiled by GNU C version 10.3.0, GMP version 6.2.0, MPFR version 4.0.2, MPC version 1.1.0, isl version isl-0.22.1-GMP + +GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 +Compiler executable checksum: f2dc2f7bd2244142e4cf7a4d43b693bf +COLLECT_GCC_OPTIONS='-v' '-o' 'CMakeFiles/cmTC_f2ba8.dir/CMakeCCompilerABI.c.o' '-c' '-mtune=generic' '-march=x86-64' + as -v --64 -o CMakeFiles/cmTC_f2ba8.dir/CMakeCCompilerABI.c.o /tmp/ccapqHEJ.s +GNU assembler version 2.34 (x86_64-linux-gnu) using BFD version (GNU Binutils for Ubuntu) 2.34 +COMPILER_PATH=/usr/lib/gcc/x86_64-linux-gnu/10/:/usr/lib/gcc/x86_64-linux-gnu/10/:/usr/lib/gcc/x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/10/:/usr/lib/gcc/x86_64-linux-gnu/ +LIBRARY_PATH=/usr/lib/gcc/x86_64-linux-gnu/10/:/usr/lib/gcc/x86_64-linux-gnu/10/../../../x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/10/../../../../lib/:/lib/x86_64-linux-gnu/:/lib/../lib/:/usr/lib/x86_64-linux-gnu/:/usr/lib/../lib/:/usr/lib/gcc/x86_64-linux-gnu/10/../../../:/lib/:/usr/lib/ +COLLECT_GCC_OPTIONS='-v' '-o' 'CMakeFiles/cmTC_f2ba8.dir/CMakeCCompilerABI.c.o' '-c' '-mtune=generic' '-march=x86-64' +[2/2] Linking C executable cmTC_f2ba8 +Using built-in specs. +COLLECT_GCC=/usr/bin/gcc-10 +COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/10/lto-wrapper +OFFLOAD_TARGET_NAMES=nvptx-none:amdgcn-amdhsa:hsa +OFFLOAD_TARGET_DEFAULT=1 +Target: x86_64-linux-gnu +Configured with: ../src/configure -v --with-pkgversion='Ubuntu 10.3.0-1ubuntu1~20.04' --with-bugurl=file:///usr/share/doc/gcc-10/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++,m2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-10 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-bootstrap --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib --enable-libphobos-checking=release --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none=/build/gcc-10-S4I5Pr/gcc-10-10.3.0/debian/tmp-nvptx/usr,amdgcn-amdhsa=/build/gcc-10-S4I5Pr/gcc-10-10.3.0/debian/tmp-gcn/usr,hsa --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu --with-build-config=bootstrap-lto-lean --enable-link-mutex +Thread model: posix +Supported LTO compression algorithms: zlib zstd +gcc version 10.3.0 (Ubuntu 10.3.0-1ubuntu1~20.04) +COMPILER_PATH=/usr/lib/gcc/x86_64-linux-gnu/10/:/usr/lib/gcc/x86_64-linux-gnu/10/:/usr/lib/gcc/x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/10/:/usr/lib/gcc/x86_64-linux-gnu/ +LIBRARY_PATH=/usr/lib/gcc/x86_64-linux-gnu/10/:/usr/lib/gcc/x86_64-linux-gnu/10/../../../x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/10/../../../../lib/:/lib/x86_64-linux-gnu/:/lib/../lib/:/usr/lib/x86_64-linux-gnu/:/usr/lib/../lib/:/usr/lib/gcc/x86_64-linux-gnu/10/../../../:/lib/:/usr/lib/ +COLLECT_GCC_OPTIONS='-v' '-o' 'cmTC_f2ba8' '-mtune=generic' '-march=x86-64' + /usr/lib/gcc/x86_64-linux-gnu/10/collect2 -plugin /usr/lib/gcc/x86_64-linux-gnu/10/liblto_plugin.so -plugin-opt=/usr/lib/gcc/x86_64-linux-gnu/10/lto-wrapper -plugin-opt=-fresolution=/tmp/cc3bjNUZ.res -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s --build-id --eh-frame-hdr -m elf_x86_64 --hash-style=gnu --as-needed -dynamic-linker /lib64/ld-linux-x86-64.so.2 -pie -z now -z relro -o cmTC_f2ba8 /usr/lib/gcc/x86_64-linux-gnu/10/../../../x86_64-linux-gnu/Scrt1.o /usr/lib/gcc/x86_64-linux-gnu/10/../../../x86_64-linux-gnu/crti.o /usr/lib/gcc/x86_64-linux-gnu/10/crtbeginS.o -L/usr/lib/gcc/x86_64-linux-gnu/10 -L/usr/lib/gcc/x86_64-linux-gnu/10/../../../x86_64-linux-gnu -L/usr/lib/gcc/x86_64-linux-gnu/10/../../../../lib -L/lib/x86_64-linux-gnu -L/lib/../lib -L/usr/lib/x86_64-linux-gnu -L/usr/lib/../lib -L/usr/lib/gcc/x86_64-linux-gnu/10/../../.. CMakeFiles/cmTC_f2ba8.dir/CMakeCCompilerABI.c.o -lgcc --push-state --as-needed -lgcc_s --pop-state -lc -lgcc --push-state --as-needed -lgcc_s --pop-state /usr/lib/gcc/x86_64-linux-gnu/10/crtendS.o /usr/lib/gcc/x86_64-linux-gnu/10/../../../x86_64-linux-gnu/crtn.o +COLLECT_GCC_OPTIONS='-v' '-o' 'cmTC_f2ba8' '-mtune=generic' '-march=x86-64' + + + +Parsed C implicit include dir info from above output: rv=done + found start of include info + found start of implicit include info + add: [/usr/lib/gcc/x86_64-linux-gnu/10/include] + add: [/usr/local/include] + add: [/usr/include/x86_64-linux-gnu] + add: [/usr/include] + end of search list found + collapse include dir [/usr/lib/gcc/x86_64-linux-gnu/10/include] ==> [/usr/lib/gcc/x86_64-linux-gnu/10/include] + collapse include dir [/usr/local/include] ==> [/usr/local/include] + collapse include dir [/usr/include/x86_64-linux-gnu] ==> [/usr/include/x86_64-linux-gnu] + collapse include dir [/usr/include] ==> [/usr/include] + implicit include dirs: [/usr/lib/gcc/x86_64-linux-gnu/10/include;/usr/local/include;/usr/include/x86_64-linux-gnu;/usr/include] + + +Parsed C implicit link information from above output: + link line regex: [^( *|.*[/\])(ld|CMAKE_LINK_STARTFILE-NOTFOUND|([^/\]+-)?ld|collect2)[^/\]*( |$)] + ignore line: [Change Dir: /home/tomer/Github/Public-PF/cmake-build-debug/CMakeFiles/CMakeTmp] + ignore line: [] + ignore line: [Run Build Command(s):/snap/clion/184/bin/ninja/linux/ninja cmTC_f2ba8 && [1/2] Building C object CMakeFiles/cmTC_f2ba8.dir/CMakeCCompilerABI.c.o] + ignore line: [Using built-in specs.] + ignore line: [COLLECT_GCC=/usr/bin/gcc-10] + ignore line: [OFFLOAD_TARGET_NAMES=nvptx-none:amdgcn-amdhsa:hsa] + ignore line: [OFFLOAD_TARGET_DEFAULT=1] + ignore line: [Target: x86_64-linux-gnu] + ignore line: [Configured with: ../src/configure -v --with-pkgversion='Ubuntu 10.3.0-1ubuntu1~20.04' --with-bugurl=file:///usr/share/doc/gcc-10/README.Bugs --enable-languages=c ada c++ go brig d fortran objc obj-c++ m2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-10 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-bootstrap --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib --enable-libphobos-checking=release --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32 m64 mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none=/build/gcc-10-S4I5Pr/gcc-10-10.3.0/debian/tmp-nvptx/usr amdgcn-amdhsa=/build/gcc-10-S4I5Pr/gcc-10-10.3.0/debian/tmp-gcn/usr hsa --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu --with-build-config=bootstrap-lto-lean --enable-link-mutex] + ignore line: [Thread model: posix] + ignore line: [Supported LTO compression algorithms: zlib zstd] + ignore line: [gcc version 10.3.0 (Ubuntu 10.3.0-1ubuntu1~20.04) ] + ignore line: [COLLECT_GCC_OPTIONS='-v' '-o' 'CMakeFiles/cmTC_f2ba8.dir/CMakeCCompilerABI.c.o' '-c' '-mtune=generic' '-march=x86-64'] + ignore line: [ /usr/lib/gcc/x86_64-linux-gnu/10/cc1 -quiet -v -imultiarch x86_64-linux-gnu /snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/CMakeCCompilerABI.c -quiet -dumpbase CMakeCCompilerABI.c -mtune=generic -march=x86-64 -auxbase-strip CMakeFiles/cmTC_f2ba8.dir/CMakeCCompilerABI.c.o -version -fasynchronous-unwind-tables -fstack-protector-strong -Wformat -Wformat-security -fstack-clash-protection -fcf-protection -o /tmp/ccapqHEJ.s] + ignore line: [GNU C17 (Ubuntu 10.3.0-1ubuntu1~20.04) version 10.3.0 (x86_64-linux-gnu)] + ignore line: [ compiled by GNU C version 10.3.0 GMP version 6.2.0 MPFR version 4.0.2 MPC version 1.1.0 isl version isl-0.22.1-GMP] + ignore line: [] + ignore line: [GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072] + ignore line: [ignoring nonexistent directory "/usr/local/include/x86_64-linux-gnu"] + ignore line: [ignoring nonexistent directory "/usr/lib/gcc/x86_64-linux-gnu/10/include-fixed"] + ignore line: [ignoring nonexistent directory "/usr/lib/gcc/x86_64-linux-gnu/10/../../../../x86_64-linux-gnu/include"] + ignore line: [#include "..." search starts here:] + ignore line: [#include <...> search starts here:] + ignore line: [ /usr/lib/gcc/x86_64-linux-gnu/10/include] + ignore line: [ /usr/local/include] + ignore line: [ /usr/include/x86_64-linux-gnu] + ignore line: [ /usr/include] + ignore line: [End of search list.] + ignore line: [GNU C17 (Ubuntu 10.3.0-1ubuntu1~20.04) version 10.3.0 (x86_64-linux-gnu)] + ignore line: [ compiled by GNU C version 10.3.0 GMP version 6.2.0 MPFR version 4.0.2 MPC version 1.1.0 isl version isl-0.22.1-GMP] + ignore line: [] + ignore line: [GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072] + ignore line: [Compiler executable checksum: f2dc2f7bd2244142e4cf7a4d43b693bf] + ignore line: [COLLECT_GCC_OPTIONS='-v' '-o' 'CMakeFiles/cmTC_f2ba8.dir/CMakeCCompilerABI.c.o' '-c' '-mtune=generic' '-march=x86-64'] + ignore line: [ as -v --64 -o CMakeFiles/cmTC_f2ba8.dir/CMakeCCompilerABI.c.o /tmp/ccapqHEJ.s] + ignore line: [GNU assembler version 2.34 (x86_64-linux-gnu) using BFD version (GNU Binutils for Ubuntu) 2.34] + ignore line: [COMPILER_PATH=/usr/lib/gcc/x86_64-linux-gnu/10/:/usr/lib/gcc/x86_64-linux-gnu/10/:/usr/lib/gcc/x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/10/:/usr/lib/gcc/x86_64-linux-gnu/] + ignore line: [LIBRARY_PATH=/usr/lib/gcc/x86_64-linux-gnu/10/:/usr/lib/gcc/x86_64-linux-gnu/10/../../../x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/10/../../../../lib/:/lib/x86_64-linux-gnu/:/lib/../lib/:/usr/lib/x86_64-linux-gnu/:/usr/lib/../lib/:/usr/lib/gcc/x86_64-linux-gnu/10/../../../:/lib/:/usr/lib/] + ignore line: [COLLECT_GCC_OPTIONS='-v' '-o' 'CMakeFiles/cmTC_f2ba8.dir/CMakeCCompilerABI.c.o' '-c' '-mtune=generic' '-march=x86-64'] + ignore line: [[2/2] Linking C executable cmTC_f2ba8] + ignore line: [Using built-in specs.] + ignore line: [COLLECT_GCC=/usr/bin/gcc-10] + ignore line: [COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/10/lto-wrapper] + ignore line: [OFFLOAD_TARGET_NAMES=nvptx-none:amdgcn-amdhsa:hsa] + ignore line: [OFFLOAD_TARGET_DEFAULT=1] + ignore line: [Target: x86_64-linux-gnu] + ignore line: [Configured with: ../src/configure -v --with-pkgversion='Ubuntu 10.3.0-1ubuntu1~20.04' --with-bugurl=file:///usr/share/doc/gcc-10/README.Bugs --enable-languages=c ada c++ go brig d fortran objc obj-c++ m2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-10 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-bootstrap --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib --enable-libphobos-checking=release --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32 m64 mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none=/build/gcc-10-S4I5Pr/gcc-10-10.3.0/debian/tmp-nvptx/usr amdgcn-amdhsa=/build/gcc-10-S4I5Pr/gcc-10-10.3.0/debian/tmp-gcn/usr hsa --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu --with-build-config=bootstrap-lto-lean --enable-link-mutex] + ignore line: [Thread model: posix] + ignore line: [Supported LTO compression algorithms: zlib zstd] + ignore line: [gcc version 10.3.0 (Ubuntu 10.3.0-1ubuntu1~20.04) ] + ignore line: [COMPILER_PATH=/usr/lib/gcc/x86_64-linux-gnu/10/:/usr/lib/gcc/x86_64-linux-gnu/10/:/usr/lib/gcc/x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/10/:/usr/lib/gcc/x86_64-linux-gnu/] + ignore line: [LIBRARY_PATH=/usr/lib/gcc/x86_64-linux-gnu/10/:/usr/lib/gcc/x86_64-linux-gnu/10/../../../x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/10/../../../../lib/:/lib/x86_64-linux-gnu/:/lib/../lib/:/usr/lib/x86_64-linux-gnu/:/usr/lib/../lib/:/usr/lib/gcc/x86_64-linux-gnu/10/../../../:/lib/:/usr/lib/] + ignore line: [COLLECT_GCC_OPTIONS='-v' '-o' 'cmTC_f2ba8' '-mtune=generic' '-march=x86-64'] + link line: [ /usr/lib/gcc/x86_64-linux-gnu/10/collect2 -plugin /usr/lib/gcc/x86_64-linux-gnu/10/liblto_plugin.so -plugin-opt=/usr/lib/gcc/x86_64-linux-gnu/10/lto-wrapper -plugin-opt=-fresolution=/tmp/cc3bjNUZ.res -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s --build-id --eh-frame-hdr -m elf_x86_64 --hash-style=gnu --as-needed -dynamic-linker /lib64/ld-linux-x86-64.so.2 -pie -z now -z relro -o cmTC_f2ba8 /usr/lib/gcc/x86_64-linux-gnu/10/../../../x86_64-linux-gnu/Scrt1.o /usr/lib/gcc/x86_64-linux-gnu/10/../../../x86_64-linux-gnu/crti.o /usr/lib/gcc/x86_64-linux-gnu/10/crtbeginS.o -L/usr/lib/gcc/x86_64-linux-gnu/10 -L/usr/lib/gcc/x86_64-linux-gnu/10/../../../x86_64-linux-gnu -L/usr/lib/gcc/x86_64-linux-gnu/10/../../../../lib -L/lib/x86_64-linux-gnu -L/lib/../lib -L/usr/lib/x86_64-linux-gnu -L/usr/lib/../lib -L/usr/lib/gcc/x86_64-linux-gnu/10/../../.. CMakeFiles/cmTC_f2ba8.dir/CMakeCCompilerABI.c.o -lgcc --push-state --as-needed -lgcc_s --pop-state -lc -lgcc --push-state --as-needed -lgcc_s --pop-state /usr/lib/gcc/x86_64-linux-gnu/10/crtendS.o /usr/lib/gcc/x86_64-linux-gnu/10/../../../x86_64-linux-gnu/crtn.o] + arg [/usr/lib/gcc/x86_64-linux-gnu/10/collect2] ==> ignore + arg [-plugin] ==> ignore + arg [/usr/lib/gcc/x86_64-linux-gnu/10/liblto_plugin.so] ==> ignore + arg [-plugin-opt=/usr/lib/gcc/x86_64-linux-gnu/10/lto-wrapper] ==> ignore + arg [-plugin-opt=-fresolution=/tmp/cc3bjNUZ.res] ==> ignore + arg [-plugin-opt=-pass-through=-lgcc] ==> ignore + arg [-plugin-opt=-pass-through=-lgcc_s] ==> ignore + arg [-plugin-opt=-pass-through=-lc] ==> ignore + arg [-plugin-opt=-pass-through=-lgcc] ==> ignore + arg [-plugin-opt=-pass-through=-lgcc_s] ==> ignore + arg [--build-id] ==> ignore + arg [--eh-frame-hdr] ==> ignore + arg [-m] ==> ignore + arg [elf_x86_64] ==> ignore + arg [--hash-style=gnu] ==> ignore + arg [--as-needed] ==> ignore + arg [-dynamic-linker] ==> ignore + arg [/lib64/ld-linux-x86-64.so.2] ==> ignore + arg [-pie] ==> ignore + arg [-znow] ==> ignore + arg [-zrelro] ==> ignore + arg [-o] ==> ignore + arg [cmTC_f2ba8] ==> ignore + arg [/usr/lib/gcc/x86_64-linux-gnu/10/../../../x86_64-linux-gnu/Scrt1.o] ==> obj [/usr/lib/gcc/x86_64-linux-gnu/10/../../../x86_64-linux-gnu/Scrt1.o] + arg [/usr/lib/gcc/x86_64-linux-gnu/10/../../../x86_64-linux-gnu/crti.o] ==> obj [/usr/lib/gcc/x86_64-linux-gnu/10/../../../x86_64-linux-gnu/crti.o] + arg [/usr/lib/gcc/x86_64-linux-gnu/10/crtbeginS.o] ==> obj [/usr/lib/gcc/x86_64-linux-gnu/10/crtbeginS.o] + arg [-L/usr/lib/gcc/x86_64-linux-gnu/10] ==> dir [/usr/lib/gcc/x86_64-linux-gnu/10] + arg [-L/usr/lib/gcc/x86_64-linux-gnu/10/../../../x86_64-linux-gnu] ==> dir [/usr/lib/gcc/x86_64-linux-gnu/10/../../../x86_64-linux-gnu] + arg [-L/usr/lib/gcc/x86_64-linux-gnu/10/../../../../lib] ==> dir [/usr/lib/gcc/x86_64-linux-gnu/10/../../../../lib] + arg [-L/lib/x86_64-linux-gnu] ==> dir [/lib/x86_64-linux-gnu] + arg [-L/lib/../lib] ==> dir [/lib/../lib] + arg [-L/usr/lib/x86_64-linux-gnu] ==> dir [/usr/lib/x86_64-linux-gnu] + arg [-L/usr/lib/../lib] ==> dir [/usr/lib/../lib] + arg [-L/usr/lib/gcc/x86_64-linux-gnu/10/../../..] ==> dir [/usr/lib/gcc/x86_64-linux-gnu/10/../../..] + arg [CMakeFiles/cmTC_f2ba8.dir/CMakeCCompilerABI.c.o] ==> ignore + arg [-lgcc] ==> lib [gcc] + arg [--push-state] ==> ignore + arg [--as-needed] ==> ignore + arg [-lgcc_s] ==> lib [gcc_s] + arg [--pop-state] ==> ignore + arg [-lc] ==> lib [c] + arg [-lgcc] ==> lib [gcc] + arg [--push-state] ==> ignore + arg [--as-needed] ==> ignore + arg [-lgcc_s] ==> lib [gcc_s] + arg [--pop-state] ==> ignore + arg [/usr/lib/gcc/x86_64-linux-gnu/10/crtendS.o] ==> obj [/usr/lib/gcc/x86_64-linux-gnu/10/crtendS.o] + arg [/usr/lib/gcc/x86_64-linux-gnu/10/../../../x86_64-linux-gnu/crtn.o] ==> obj [/usr/lib/gcc/x86_64-linux-gnu/10/../../../x86_64-linux-gnu/crtn.o] + collapse obj [/usr/lib/gcc/x86_64-linux-gnu/10/../../../x86_64-linux-gnu/Scrt1.o] ==> [/usr/lib/x86_64-linux-gnu/Scrt1.o] + collapse obj [/usr/lib/gcc/x86_64-linux-gnu/10/../../../x86_64-linux-gnu/crti.o] ==> [/usr/lib/x86_64-linux-gnu/crti.o] + collapse obj [/usr/lib/gcc/x86_64-linux-gnu/10/../../../x86_64-linux-gnu/crtn.o] ==> [/usr/lib/x86_64-linux-gnu/crtn.o] + collapse library dir [/usr/lib/gcc/x86_64-linux-gnu/10] ==> [/usr/lib/gcc/x86_64-linux-gnu/10] + collapse library dir [/usr/lib/gcc/x86_64-linux-gnu/10/../../../x86_64-linux-gnu] ==> [/usr/lib/x86_64-linux-gnu] + collapse library dir [/usr/lib/gcc/x86_64-linux-gnu/10/../../../../lib] ==> [/usr/lib] + collapse library dir [/lib/x86_64-linux-gnu] ==> [/lib/x86_64-linux-gnu] + collapse library dir [/lib/../lib] ==> [/lib] + collapse library dir [/usr/lib/x86_64-linux-gnu] ==> [/usr/lib/x86_64-linux-gnu] + collapse library dir [/usr/lib/../lib] ==> [/usr/lib] + collapse library dir [/usr/lib/gcc/x86_64-linux-gnu/10/../../..] ==> [/usr/lib] + implicit libs: [gcc;gcc_s;c;gcc;gcc_s] + implicit objs: [/usr/lib/x86_64-linux-gnu/Scrt1.o;/usr/lib/x86_64-linux-gnu/crti.o;/usr/lib/gcc/x86_64-linux-gnu/10/crtbeginS.o;/usr/lib/gcc/x86_64-linux-gnu/10/crtendS.o;/usr/lib/x86_64-linux-gnu/crtn.o] + implicit dirs: [/usr/lib/gcc/x86_64-linux-gnu/10;/usr/lib/x86_64-linux-gnu;/usr/lib;/lib/x86_64-linux-gnu;/lib] + implicit fwks: [] + + +Detecting CXX compiler ABI info compiled with the following output: +Change Dir: /home/tomer/Github/Public-PF/cmake-build-debug/CMakeFiles/CMakeTmp + +Run Build Command(s):/snap/clion/184/bin/ninja/linux/ninja cmTC_b68b5 && [1/2] Building CXX object CMakeFiles/cmTC_b68b5.dir/CMakeCXXCompilerABI.cpp.o +Using built-in specs. +COLLECT_GCC=/usr/bin/g++-10 +OFFLOAD_TARGET_NAMES=nvptx-none:amdgcn-amdhsa:hsa +OFFLOAD_TARGET_DEFAULT=1 +Target: x86_64-linux-gnu +Configured with: ../src/configure -v --with-pkgversion='Ubuntu 10.3.0-1ubuntu1~20.04' --with-bugurl=file:///usr/share/doc/gcc-10/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++,m2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-10 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-bootstrap --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib --enable-libphobos-checking=release --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none=/build/gcc-10-S4I5Pr/gcc-10-10.3.0/debian/tmp-nvptx/usr,amdgcn-amdhsa=/build/gcc-10-S4I5Pr/gcc-10-10.3.0/debian/tmp-gcn/usr,hsa --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu --with-build-config=bootstrap-lto-lean --enable-link-mutex +Thread model: posix +Supported LTO compression algorithms: zlib zstd +gcc version 10.3.0 (Ubuntu 10.3.0-1ubuntu1~20.04) +COLLECT_GCC_OPTIONS='-v' '-std=gnu++17' '-o' 'CMakeFiles/cmTC_b68b5.dir/CMakeCXXCompilerABI.cpp.o' '-c' '-shared-libgcc' '-mtune=generic' '-march=x86-64' + /usr/lib/gcc/x86_64-linux-gnu/10/cc1plus -quiet -v -imultiarch x86_64-linux-gnu -D_GNU_SOURCE /snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/CMakeCXXCompilerABI.cpp -quiet -dumpbase CMakeCXXCompilerABI.cpp -mtune=generic -march=x86-64 -auxbase-strip CMakeFiles/cmTC_b68b5.dir/CMakeCXXCompilerABI.cpp.o -std=gnu++17 -version -fasynchronous-unwind-tables -fstack-protector-strong -Wformat -Wformat-security -fstack-clash-protection -fcf-protection -o /tmp/ccbVbAEB.s +GNU C++17 (Ubuntu 10.3.0-1ubuntu1~20.04) version 10.3.0 (x86_64-linux-gnu) + compiled by GNU C version 10.3.0, GMP version 6.2.0, MPFR version 4.0.2, MPC version 1.1.0, isl version isl-0.22.1-GMP + +GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 +ignoring duplicate directory "/usr/include/x86_64-linux-gnu/c++/10" +ignoring nonexistent directory "/usr/local/include/x86_64-linux-gnu" +ignoring nonexistent directory "/usr/lib/gcc/x86_64-linux-gnu/10/include-fixed" +ignoring nonexistent directory "/usr/lib/gcc/x86_64-linux-gnu/10/../../../../x86_64-linux-gnu/include" +#include "..." search starts here: +#include <...> search starts here: + /usr/include/c++/10 + /usr/include/x86_64-linux-gnu/c++/10 + /usr/include/c++/10/backward + /usr/lib/gcc/x86_64-linux-gnu/10/include + /usr/local/include + /usr/include/x86_64-linux-gnu + /usr/include +End of search list. +GNU C++17 (Ubuntu 10.3.0-1ubuntu1~20.04) version 10.3.0 (x86_64-linux-gnu) + compiled by GNU C version 10.3.0, GMP version 6.2.0, MPFR version 4.0.2, MPC version 1.1.0, isl version isl-0.22.1-GMP + +GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 +Compiler executable checksum: 169ee3a1708a329c07eaf03cc8dfbe6c +COLLECT_GCC_OPTIONS='-v' '-std=gnu++17' '-o' 'CMakeFiles/cmTC_b68b5.dir/CMakeCXXCompilerABI.cpp.o' '-c' '-shared-libgcc' '-mtune=generic' '-march=x86-64' + as -v --64 -o CMakeFiles/cmTC_b68b5.dir/CMakeCXXCompilerABI.cpp.o /tmp/ccbVbAEB.s +GNU assembler version 2.34 (x86_64-linux-gnu) using BFD version (GNU Binutils for Ubuntu) 2.34 +COMPILER_PATH=/usr/lib/gcc/x86_64-linux-gnu/10/:/usr/lib/gcc/x86_64-linux-gnu/10/:/usr/lib/gcc/x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/10/:/usr/lib/gcc/x86_64-linux-gnu/ +LIBRARY_PATH=/usr/lib/gcc/x86_64-linux-gnu/10/:/usr/lib/gcc/x86_64-linux-gnu/10/../../../x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/10/../../../../lib/:/lib/x86_64-linux-gnu/:/lib/../lib/:/usr/lib/x86_64-linux-gnu/:/usr/lib/../lib/:/usr/lib/gcc/x86_64-linux-gnu/10/../../../:/lib/:/usr/lib/ +COLLECT_GCC_OPTIONS='-v' '-std=gnu++17' '-o' 'CMakeFiles/cmTC_b68b5.dir/CMakeCXXCompilerABI.cpp.o' '-c' '-shared-libgcc' '-mtune=generic' '-march=x86-64' +[2/2] Linking CXX executable cmTC_b68b5 +Using built-in specs. +COLLECT_GCC=/usr/bin/g++-10 +COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/10/lto-wrapper +OFFLOAD_TARGET_NAMES=nvptx-none:amdgcn-amdhsa:hsa +OFFLOAD_TARGET_DEFAULT=1 +Target: x86_64-linux-gnu +Configured with: ../src/configure -v --with-pkgversion='Ubuntu 10.3.0-1ubuntu1~20.04' --with-bugurl=file:///usr/share/doc/gcc-10/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++,m2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-10 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-bootstrap --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib --enable-libphobos-checking=release --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none=/build/gcc-10-S4I5Pr/gcc-10-10.3.0/debian/tmp-nvptx/usr,amdgcn-amdhsa=/build/gcc-10-S4I5Pr/gcc-10-10.3.0/debian/tmp-gcn/usr,hsa --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu --with-build-config=bootstrap-lto-lean --enable-link-mutex +Thread model: posix +Supported LTO compression algorithms: zlib zstd +gcc version 10.3.0 (Ubuntu 10.3.0-1ubuntu1~20.04) +COMPILER_PATH=/usr/lib/gcc/x86_64-linux-gnu/10/:/usr/lib/gcc/x86_64-linux-gnu/10/:/usr/lib/gcc/x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/10/:/usr/lib/gcc/x86_64-linux-gnu/ +LIBRARY_PATH=/usr/lib/gcc/x86_64-linux-gnu/10/:/usr/lib/gcc/x86_64-linux-gnu/10/../../../x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/10/../../../../lib/:/lib/x86_64-linux-gnu/:/lib/../lib/:/usr/lib/x86_64-linux-gnu/:/usr/lib/../lib/:/usr/lib/gcc/x86_64-linux-gnu/10/../../../:/lib/:/usr/lib/ +COLLECT_GCC_OPTIONS='-v' '-o' 'cmTC_b68b5' '-shared-libgcc' '-mtune=generic' '-march=x86-64' + /usr/lib/gcc/x86_64-linux-gnu/10/collect2 -plugin /usr/lib/gcc/x86_64-linux-gnu/10/liblto_plugin.so -plugin-opt=/usr/lib/gcc/x86_64-linux-gnu/10/lto-wrapper -plugin-opt=-fresolution=/tmp/ccmp9yeW.res -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc --build-id --eh-frame-hdr -m elf_x86_64 --hash-style=gnu --as-needed -dynamic-linker /lib64/ld-linux-x86-64.so.2 -pie -z now -z relro -o cmTC_b68b5 /usr/lib/gcc/x86_64-linux-gnu/10/../../../x86_64-linux-gnu/Scrt1.o /usr/lib/gcc/x86_64-linux-gnu/10/../../../x86_64-linux-gnu/crti.o /usr/lib/gcc/x86_64-linux-gnu/10/crtbeginS.o -L/usr/lib/gcc/x86_64-linux-gnu/10 -L/usr/lib/gcc/x86_64-linux-gnu/10/../../../x86_64-linux-gnu -L/usr/lib/gcc/x86_64-linux-gnu/10/../../../../lib -L/lib/x86_64-linux-gnu -L/lib/../lib -L/usr/lib/x86_64-linux-gnu -L/usr/lib/../lib -L/usr/lib/gcc/x86_64-linux-gnu/10/../../.. CMakeFiles/cmTC_b68b5.dir/CMakeCXXCompilerABI.cpp.o -lstdc++ -lm -lgcc_s -lgcc -lc -lgcc_s -lgcc /usr/lib/gcc/x86_64-linux-gnu/10/crtendS.o /usr/lib/gcc/x86_64-linux-gnu/10/../../../x86_64-linux-gnu/crtn.o +COLLECT_GCC_OPTIONS='-v' '-o' 'cmTC_b68b5' '-shared-libgcc' '-mtune=generic' '-march=x86-64' + + + +Parsed CXX implicit include dir info from above output: rv=done + found start of include info + found start of implicit include info + add: [/usr/include/c++/10] + add: [/usr/include/x86_64-linux-gnu/c++/10] + add: [/usr/include/c++/10/backward] + add: [/usr/lib/gcc/x86_64-linux-gnu/10/include] + add: [/usr/local/include] + add: [/usr/include/x86_64-linux-gnu] + add: [/usr/include] + end of search list found + collapse include dir [/usr/include/c++/10] ==> [/usr/include/c++/10] + collapse include dir [/usr/include/x86_64-linux-gnu/c++/10] ==> [/usr/include/x86_64-linux-gnu/c++/10] + collapse include dir [/usr/include/c++/10/backward] ==> [/usr/include/c++/10/backward] + collapse include dir [/usr/lib/gcc/x86_64-linux-gnu/10/include] ==> [/usr/lib/gcc/x86_64-linux-gnu/10/include] + collapse include dir [/usr/local/include] ==> [/usr/local/include] + collapse include dir [/usr/include/x86_64-linux-gnu] ==> [/usr/include/x86_64-linux-gnu] + collapse include dir [/usr/include] ==> [/usr/include] + implicit include dirs: [/usr/include/c++/10;/usr/include/x86_64-linux-gnu/c++/10;/usr/include/c++/10/backward;/usr/lib/gcc/x86_64-linux-gnu/10/include;/usr/local/include;/usr/include/x86_64-linux-gnu;/usr/include] + + +Parsed CXX implicit link information from above output: + link line regex: [^( *|.*[/\])(ld|CMAKE_LINK_STARTFILE-NOTFOUND|([^/\]+-)?ld|collect2)[^/\]*( |$)] + ignore line: [Change Dir: /home/tomer/Github/Public-PF/cmake-build-debug/CMakeFiles/CMakeTmp] + ignore line: [] + ignore line: [Run Build Command(s):/snap/clion/184/bin/ninja/linux/ninja cmTC_b68b5 && [1/2] Building CXX object CMakeFiles/cmTC_b68b5.dir/CMakeCXXCompilerABI.cpp.o] + ignore line: [Using built-in specs.] + ignore line: [COLLECT_GCC=/usr/bin/g++-10] + ignore line: [OFFLOAD_TARGET_NAMES=nvptx-none:amdgcn-amdhsa:hsa] + ignore line: [OFFLOAD_TARGET_DEFAULT=1] + ignore line: [Target: x86_64-linux-gnu] + ignore line: [Configured with: ../src/configure -v --with-pkgversion='Ubuntu 10.3.0-1ubuntu1~20.04' --with-bugurl=file:///usr/share/doc/gcc-10/README.Bugs --enable-languages=c ada c++ go brig d fortran objc obj-c++ m2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-10 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-bootstrap --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib --enable-libphobos-checking=release --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32 m64 mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none=/build/gcc-10-S4I5Pr/gcc-10-10.3.0/debian/tmp-nvptx/usr amdgcn-amdhsa=/build/gcc-10-S4I5Pr/gcc-10-10.3.0/debian/tmp-gcn/usr hsa --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu --with-build-config=bootstrap-lto-lean --enable-link-mutex] + ignore line: [Thread model: posix] + ignore line: [Supported LTO compression algorithms: zlib zstd] + ignore line: [gcc version 10.3.0 (Ubuntu 10.3.0-1ubuntu1~20.04) ] + ignore line: [COLLECT_GCC_OPTIONS='-v' '-std=gnu++17' '-o' 'CMakeFiles/cmTC_b68b5.dir/CMakeCXXCompilerABI.cpp.o' '-c' '-shared-libgcc' '-mtune=generic' '-march=x86-64'] + ignore line: [ /usr/lib/gcc/x86_64-linux-gnu/10/cc1plus -quiet -v -imultiarch x86_64-linux-gnu -D_GNU_SOURCE /snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/CMakeCXXCompilerABI.cpp -quiet -dumpbase CMakeCXXCompilerABI.cpp -mtune=generic -march=x86-64 -auxbase-strip CMakeFiles/cmTC_b68b5.dir/CMakeCXXCompilerABI.cpp.o -std=gnu++17 -version -fasynchronous-unwind-tables -fstack-protector-strong -Wformat -Wformat-security -fstack-clash-protection -fcf-protection -o /tmp/ccbVbAEB.s] + ignore line: [GNU C++17 (Ubuntu 10.3.0-1ubuntu1~20.04) version 10.3.0 (x86_64-linux-gnu)] + ignore line: [ compiled by GNU C version 10.3.0 GMP version 6.2.0 MPFR version 4.0.2 MPC version 1.1.0 isl version isl-0.22.1-GMP] + ignore line: [] + ignore line: [GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072] + ignore line: [ignoring duplicate directory "/usr/include/x86_64-linux-gnu/c++/10"] + ignore line: [ignoring nonexistent directory "/usr/local/include/x86_64-linux-gnu"] + ignore line: [ignoring nonexistent directory "/usr/lib/gcc/x86_64-linux-gnu/10/include-fixed"] + ignore line: [ignoring nonexistent directory "/usr/lib/gcc/x86_64-linux-gnu/10/../../../../x86_64-linux-gnu/include"] + ignore line: [#include "..." search starts here:] + ignore line: [#include <...> search starts here:] + ignore line: [ /usr/include/c++/10] + ignore line: [ /usr/include/x86_64-linux-gnu/c++/10] + ignore line: [ /usr/include/c++/10/backward] + ignore line: [ /usr/lib/gcc/x86_64-linux-gnu/10/include] + ignore line: [ /usr/local/include] + ignore line: [ /usr/include/x86_64-linux-gnu] + ignore line: [ /usr/include] + ignore line: [End of search list.] + ignore line: [GNU C++17 (Ubuntu 10.3.0-1ubuntu1~20.04) version 10.3.0 (x86_64-linux-gnu)] + ignore line: [ compiled by GNU C version 10.3.0 GMP version 6.2.0 MPFR version 4.0.2 MPC version 1.1.0 isl version isl-0.22.1-GMP] + ignore line: [] + ignore line: [GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072] + ignore line: [Compiler executable checksum: 169ee3a1708a329c07eaf03cc8dfbe6c] + ignore line: [COLLECT_GCC_OPTIONS='-v' '-std=gnu++17' '-o' 'CMakeFiles/cmTC_b68b5.dir/CMakeCXXCompilerABI.cpp.o' '-c' '-shared-libgcc' '-mtune=generic' '-march=x86-64'] + ignore line: [ as -v --64 -o CMakeFiles/cmTC_b68b5.dir/CMakeCXXCompilerABI.cpp.o /tmp/ccbVbAEB.s] + ignore line: [GNU assembler version 2.34 (x86_64-linux-gnu) using BFD version (GNU Binutils for Ubuntu) 2.34] + ignore line: [COMPILER_PATH=/usr/lib/gcc/x86_64-linux-gnu/10/:/usr/lib/gcc/x86_64-linux-gnu/10/:/usr/lib/gcc/x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/10/:/usr/lib/gcc/x86_64-linux-gnu/] + ignore line: [LIBRARY_PATH=/usr/lib/gcc/x86_64-linux-gnu/10/:/usr/lib/gcc/x86_64-linux-gnu/10/../../../x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/10/../../../../lib/:/lib/x86_64-linux-gnu/:/lib/../lib/:/usr/lib/x86_64-linux-gnu/:/usr/lib/../lib/:/usr/lib/gcc/x86_64-linux-gnu/10/../../../:/lib/:/usr/lib/] + ignore line: [COLLECT_GCC_OPTIONS='-v' '-std=gnu++17' '-o' 'CMakeFiles/cmTC_b68b5.dir/CMakeCXXCompilerABI.cpp.o' '-c' '-shared-libgcc' '-mtune=generic' '-march=x86-64'] + ignore line: [[2/2] Linking CXX executable cmTC_b68b5] + ignore line: [Using built-in specs.] + ignore line: [COLLECT_GCC=/usr/bin/g++-10] + ignore line: [COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/10/lto-wrapper] + ignore line: [OFFLOAD_TARGET_NAMES=nvptx-none:amdgcn-amdhsa:hsa] + ignore line: [OFFLOAD_TARGET_DEFAULT=1] + ignore line: [Target: x86_64-linux-gnu] + ignore line: [Configured with: ../src/configure -v --with-pkgversion='Ubuntu 10.3.0-1ubuntu1~20.04' --with-bugurl=file:///usr/share/doc/gcc-10/README.Bugs --enable-languages=c ada c++ go brig d fortran objc obj-c++ m2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-10 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-bootstrap --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib --enable-libphobos-checking=release --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32 m64 mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none=/build/gcc-10-S4I5Pr/gcc-10-10.3.0/debian/tmp-nvptx/usr amdgcn-amdhsa=/build/gcc-10-S4I5Pr/gcc-10-10.3.0/debian/tmp-gcn/usr hsa --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu --with-build-config=bootstrap-lto-lean --enable-link-mutex] + ignore line: [Thread model: posix] + ignore line: [Supported LTO compression algorithms: zlib zstd] + ignore line: [gcc version 10.3.0 (Ubuntu 10.3.0-1ubuntu1~20.04) ] + ignore line: [COMPILER_PATH=/usr/lib/gcc/x86_64-linux-gnu/10/:/usr/lib/gcc/x86_64-linux-gnu/10/:/usr/lib/gcc/x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/10/:/usr/lib/gcc/x86_64-linux-gnu/] + ignore line: [LIBRARY_PATH=/usr/lib/gcc/x86_64-linux-gnu/10/:/usr/lib/gcc/x86_64-linux-gnu/10/../../../x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/10/../../../../lib/:/lib/x86_64-linux-gnu/:/lib/../lib/:/usr/lib/x86_64-linux-gnu/:/usr/lib/../lib/:/usr/lib/gcc/x86_64-linux-gnu/10/../../../:/lib/:/usr/lib/] + ignore line: [COLLECT_GCC_OPTIONS='-v' '-o' 'cmTC_b68b5' '-shared-libgcc' '-mtune=generic' '-march=x86-64'] + link line: [ /usr/lib/gcc/x86_64-linux-gnu/10/collect2 -plugin /usr/lib/gcc/x86_64-linux-gnu/10/liblto_plugin.so -plugin-opt=/usr/lib/gcc/x86_64-linux-gnu/10/lto-wrapper -plugin-opt=-fresolution=/tmp/ccmp9yeW.res -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc --build-id --eh-frame-hdr -m elf_x86_64 --hash-style=gnu --as-needed -dynamic-linker /lib64/ld-linux-x86-64.so.2 -pie -z now -z relro -o cmTC_b68b5 /usr/lib/gcc/x86_64-linux-gnu/10/../../../x86_64-linux-gnu/Scrt1.o /usr/lib/gcc/x86_64-linux-gnu/10/../../../x86_64-linux-gnu/crti.o /usr/lib/gcc/x86_64-linux-gnu/10/crtbeginS.o -L/usr/lib/gcc/x86_64-linux-gnu/10 -L/usr/lib/gcc/x86_64-linux-gnu/10/../../../x86_64-linux-gnu -L/usr/lib/gcc/x86_64-linux-gnu/10/../../../../lib -L/lib/x86_64-linux-gnu -L/lib/../lib -L/usr/lib/x86_64-linux-gnu -L/usr/lib/../lib -L/usr/lib/gcc/x86_64-linux-gnu/10/../../.. CMakeFiles/cmTC_b68b5.dir/CMakeCXXCompilerABI.cpp.o -lstdc++ -lm -lgcc_s -lgcc -lc -lgcc_s -lgcc /usr/lib/gcc/x86_64-linux-gnu/10/crtendS.o /usr/lib/gcc/x86_64-linux-gnu/10/../../../x86_64-linux-gnu/crtn.o] + arg [/usr/lib/gcc/x86_64-linux-gnu/10/collect2] ==> ignore + arg [-plugin] ==> ignore + arg [/usr/lib/gcc/x86_64-linux-gnu/10/liblto_plugin.so] ==> ignore + arg [-plugin-opt=/usr/lib/gcc/x86_64-linux-gnu/10/lto-wrapper] ==> ignore + arg [-plugin-opt=-fresolution=/tmp/ccmp9yeW.res] ==> ignore + arg [-plugin-opt=-pass-through=-lgcc_s] ==> ignore + arg [-plugin-opt=-pass-through=-lgcc] ==> ignore + arg [-plugin-opt=-pass-through=-lc] ==> ignore + arg [-plugin-opt=-pass-through=-lgcc_s] ==> ignore + arg [-plugin-opt=-pass-through=-lgcc] ==> ignore + arg [--build-id] ==> ignore + arg [--eh-frame-hdr] ==> ignore + arg [-m] ==> ignore + arg [elf_x86_64] ==> ignore + arg [--hash-style=gnu] ==> ignore + arg [--as-needed] ==> ignore + arg [-dynamic-linker] ==> ignore + arg [/lib64/ld-linux-x86-64.so.2] ==> ignore + arg [-pie] ==> ignore + arg [-znow] ==> ignore + arg [-zrelro] ==> ignore + arg [-o] ==> ignore + arg [cmTC_b68b5] ==> ignore + arg [/usr/lib/gcc/x86_64-linux-gnu/10/../../../x86_64-linux-gnu/Scrt1.o] ==> obj [/usr/lib/gcc/x86_64-linux-gnu/10/../../../x86_64-linux-gnu/Scrt1.o] + arg [/usr/lib/gcc/x86_64-linux-gnu/10/../../../x86_64-linux-gnu/crti.o] ==> obj [/usr/lib/gcc/x86_64-linux-gnu/10/../../../x86_64-linux-gnu/crti.o] + arg [/usr/lib/gcc/x86_64-linux-gnu/10/crtbeginS.o] ==> obj [/usr/lib/gcc/x86_64-linux-gnu/10/crtbeginS.o] + arg [-L/usr/lib/gcc/x86_64-linux-gnu/10] ==> dir [/usr/lib/gcc/x86_64-linux-gnu/10] + arg [-L/usr/lib/gcc/x86_64-linux-gnu/10/../../../x86_64-linux-gnu] ==> dir [/usr/lib/gcc/x86_64-linux-gnu/10/../../../x86_64-linux-gnu] + arg [-L/usr/lib/gcc/x86_64-linux-gnu/10/../../../../lib] ==> dir [/usr/lib/gcc/x86_64-linux-gnu/10/../../../../lib] + arg [-L/lib/x86_64-linux-gnu] ==> dir [/lib/x86_64-linux-gnu] + arg [-L/lib/../lib] ==> dir [/lib/../lib] + arg [-L/usr/lib/x86_64-linux-gnu] ==> dir [/usr/lib/x86_64-linux-gnu] + arg [-L/usr/lib/../lib] ==> dir [/usr/lib/../lib] + arg [-L/usr/lib/gcc/x86_64-linux-gnu/10/../../..] ==> dir [/usr/lib/gcc/x86_64-linux-gnu/10/../../..] + arg [CMakeFiles/cmTC_b68b5.dir/CMakeCXXCompilerABI.cpp.o] ==> ignore + arg [-lstdc++] ==> lib [stdc++] + arg [-lm] ==> lib [m] + arg [-lgcc_s] ==> lib [gcc_s] + arg [-lgcc] ==> lib [gcc] + arg [-lc] ==> lib [c] + arg [-lgcc_s] ==> lib [gcc_s] + arg [-lgcc] ==> lib [gcc] + arg [/usr/lib/gcc/x86_64-linux-gnu/10/crtendS.o] ==> obj [/usr/lib/gcc/x86_64-linux-gnu/10/crtendS.o] + arg [/usr/lib/gcc/x86_64-linux-gnu/10/../../../x86_64-linux-gnu/crtn.o] ==> obj [/usr/lib/gcc/x86_64-linux-gnu/10/../../../x86_64-linux-gnu/crtn.o] + collapse obj [/usr/lib/gcc/x86_64-linux-gnu/10/../../../x86_64-linux-gnu/Scrt1.o] ==> [/usr/lib/x86_64-linux-gnu/Scrt1.o] + collapse obj [/usr/lib/gcc/x86_64-linux-gnu/10/../../../x86_64-linux-gnu/crti.o] ==> [/usr/lib/x86_64-linux-gnu/crti.o] + collapse obj [/usr/lib/gcc/x86_64-linux-gnu/10/../../../x86_64-linux-gnu/crtn.o] ==> [/usr/lib/x86_64-linux-gnu/crtn.o] + collapse library dir [/usr/lib/gcc/x86_64-linux-gnu/10] ==> [/usr/lib/gcc/x86_64-linux-gnu/10] + collapse library dir [/usr/lib/gcc/x86_64-linux-gnu/10/../../../x86_64-linux-gnu] ==> [/usr/lib/x86_64-linux-gnu] + collapse library dir [/usr/lib/gcc/x86_64-linux-gnu/10/../../../../lib] ==> [/usr/lib] + collapse library dir [/lib/x86_64-linux-gnu] ==> [/lib/x86_64-linux-gnu] + collapse library dir [/lib/../lib] ==> [/lib] + collapse library dir [/usr/lib/x86_64-linux-gnu] ==> [/usr/lib/x86_64-linux-gnu] + collapse library dir [/usr/lib/../lib] ==> [/usr/lib] + collapse library dir [/usr/lib/gcc/x86_64-linux-gnu/10/../../..] ==> [/usr/lib] + implicit libs: [stdc++;m;gcc_s;gcc;c;gcc_s;gcc] + implicit objs: [/usr/lib/x86_64-linux-gnu/Scrt1.o;/usr/lib/x86_64-linux-gnu/crti.o;/usr/lib/gcc/x86_64-linux-gnu/10/crtbeginS.o;/usr/lib/gcc/x86_64-linux-gnu/10/crtendS.o;/usr/lib/x86_64-linux-gnu/crtn.o] + implicit dirs: [/usr/lib/gcc/x86_64-linux-gnu/10;/usr/lib/x86_64-linux-gnu;/usr/lib;/lib/x86_64-linux-gnu;/lib] + implicit fwks: [] + + diff --git a/cmake-build-debug/CMakeFiles/TargetDirectories.txt b/cmake-build-debug/CMakeFiles/TargetDirectories.txt new file mode 100644 index 0000000..e3e7f66 --- /dev/null +++ b/cmake-build-debug/CMakeFiles/TargetDirectories.txt @@ -0,0 +1,13 @@ +/home/tomer/Github/Public-PF/cmake-build-debug/CMakeFiles/rebuild_cache.dir +/home/tomer/Github/Public-PF/cmake-build-debug/CMakeFiles/edit_cache.dir +/home/tomer/Github/Public-PF/cmake-build-debug/CMakeFiles/example.dir +/home/tomer/Github/Public-PF/cmake-build-debug/CMakeFiles/measure_fpp0.dir +/home/tomer/Github/Public-PF/cmake-build-debug/CMakeFiles/measure_perf.dir +/home/tomer/Github/Public-PF/cmake-build-debug/CMakeFiles/measure_built3.dir +/home/tomer/Github/Public-PF/cmake-build-debug/CMakeFiles/measure_built0.dir +/home/tomer/Github/Public-PF/cmake-build-debug/CMakeFiles/measure_built.dir +/home/tomer/Github/Public-PF/cmake-build-debug/CMakeFiles/measure_perf3.dir +/home/tomer/Github/Public-PF/cmake-build-debug/CMakeFiles/measure_fpp3.dir +/home/tomer/Github/Public-PF/cmake-build-debug/CMakeFiles/measure_perf0.dir +/home/tomer/Github/Public-PF/cmake-build-debug/CMakeFiles/measure_fpp.dir +/home/tomer/Github/Public-PF/cmake-build-debug/CMakeFiles/example0.dir diff --git a/cmake-build-debug/CMakeFiles/clion-environment.txt b/cmake-build-debug/CMakeFiles/clion-environment.txt new file mode 100644 index 0000000000000000000000000000000000000000..933709aaf3509738015c2e8a2d7167fc7b6b0eea GIT binary patch literal 169 zcmWH^&(8@?EwNHC)H6`f$jMJm%+d5OD9OyvE4EVL;({@CU7UR#ydKt9PjM!8{p~V8f2?qT3iHH Vot~VmYiNK_5)pw-k+wEa5dhd&G_?Q# literal 0 HcmV?d00001 diff --git a/cmake-build-debug/CMakeFiles/clion-log.txt b/cmake-build-debug/CMakeFiles/clion-log.txt new file mode 100644 index 0000000..a85568b --- /dev/null +++ b/cmake-build-debug/CMakeFiles/clion-log.txt @@ -0,0 +1,16 @@ +/snap/clion/184/bin/cmake/linux/bin/cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_MAKE_PROGRAM=/snap/clion/184/bin/ninja/linux/ninja -DCMAKE_C_COMPILER=/usr/bin/gcc-10 -DCMAKE_CXX_COMPILER=/usr/bin/g++-10 -G Ninja /home/tomer/Github/Public-PF +-- The C compiler identification is GNU 10.3.0 +-- The CXX compiler identification is GNU 10.3.0 +-- Detecting C compiler ABI info +-- Detecting C compiler ABI info - done +-- Check for working C compiler: /usr/bin/gcc-10 - skipped +-- Detecting C compile features +-- Detecting C compile features - done +-- Detecting CXX compiler ABI info +-- Detecting CXX compiler ABI info - done +-- Check for working CXX compiler: /usr/bin/g++-10 - skipped +-- Detecting CXX compile features +-- Detecting CXX compile features - done +-- Configuring done +-- Generating done +-- Build files have been written to: /home/tomer/Github/Public-PF/cmake-build-debug diff --git a/cmake-build-debug/CMakeFiles/cmake.check_cache b/cmake-build-debug/CMakeFiles/cmake.check_cache new file mode 100644 index 0000000..3dccd73 --- /dev/null +++ b/cmake-build-debug/CMakeFiles/cmake.check_cache @@ -0,0 +1 @@ +# This file is generated by cmake for dependency checking of the CMakeCache.txt file diff --git a/cmake-build-debug/CMakeFiles/rules.ninja b/cmake-build-debug/CMakeFiles/rules.ninja new file mode 100644 index 0000000..8353e99 --- /dev/null +++ b/cmake-build-debug/CMakeFiles/rules.ninja @@ -0,0 +1,254 @@ +# CMAKE generated file: DO NOT EDIT! +# Generated by "Ninja" Generator, CMake Version 3.21 + +# This file contains all the rules used to get the outputs files +# built from the input files. +# It is included in the main 'build.ninja'. + +# ============================================================================= +# Project: APD_ONLY +# Configurations: Debug +# ============================================================================= +# ============================================================================= + +############################################# +# Rule for running custom commands. + +rule CUSTOM_COMMAND + command = $COMMAND + description = $DESC + + +############################################# +# Rule for compiling CXX files. + +rule CXX_COMPILER__example_Debug + depfile = $DEP_FILE + deps = gcc + command = /usr/bin/g++-10 $DEFINES $INCLUDES $FLAGS -MD -MT $out -MF $DEP_FILE -o $out -c $in + description = Building CXX object $out + + +############################################# +# Rule for linking CXX executable. + +rule CXX_EXECUTABLE_LINKER__example_Debug + command = $PRE_LINK && /usr/bin/g++-10 $FLAGS $LINK_FLAGS $in -o $TARGET_FILE $LINK_PATH $LINK_LIBRARIES && $POST_BUILD + description = Linking CXX executable $TARGET_FILE + restat = $RESTAT + + +############################################# +# Rule for compiling CXX files. + +rule CXX_COMPILER__measure_fpp0_Debug + depfile = $DEP_FILE + deps = gcc + command = /usr/bin/g++-10 $DEFINES $INCLUDES $FLAGS -MD -MT $out -MF $DEP_FILE -o $out -c $in + description = Building CXX object $out + + +############################################# +# Rule for linking CXX executable. + +rule CXX_EXECUTABLE_LINKER__measure_fpp0_Debug + command = $PRE_LINK && /usr/bin/g++-10 $FLAGS $LINK_FLAGS $in -o $TARGET_FILE $LINK_PATH $LINK_LIBRARIES && $POST_BUILD + description = Linking CXX executable $TARGET_FILE + restat = $RESTAT + + +############################################# +# Rule for compiling CXX files. + +rule CXX_COMPILER__measure_perf_Debug + depfile = $DEP_FILE + deps = gcc + command = /usr/bin/g++-10 $DEFINES $INCLUDES $FLAGS -MD -MT $out -MF $DEP_FILE -o $out -c $in + description = Building CXX object $out + + +############################################# +# Rule for linking CXX executable. + +rule CXX_EXECUTABLE_LINKER__measure_perf_Debug + command = $PRE_LINK && /usr/bin/g++-10 $FLAGS $LINK_FLAGS $in -o $TARGET_FILE $LINK_PATH $LINK_LIBRARIES && $POST_BUILD + description = Linking CXX executable $TARGET_FILE + restat = $RESTAT + + +############################################# +# Rule for compiling CXX files. + +rule CXX_COMPILER__measure_built3_Debug + depfile = $DEP_FILE + deps = gcc + command = /usr/bin/g++-10 $DEFINES $INCLUDES $FLAGS -MD -MT $out -MF $DEP_FILE -o $out -c $in + description = Building CXX object $out + + +############################################# +# Rule for linking CXX executable. + +rule CXX_EXECUTABLE_LINKER__measure_built3_Debug + command = $PRE_LINK && /usr/bin/g++-10 $FLAGS $LINK_FLAGS $in -o $TARGET_FILE $LINK_PATH $LINK_LIBRARIES && $POST_BUILD + description = Linking CXX executable $TARGET_FILE + restat = $RESTAT + + +############################################# +# Rule for compiling CXX files. + +rule CXX_COMPILER__measure_built0_Debug + depfile = $DEP_FILE + deps = gcc + command = /usr/bin/g++-10 $DEFINES $INCLUDES $FLAGS -MD -MT $out -MF $DEP_FILE -o $out -c $in + description = Building CXX object $out + + +############################################# +# Rule for linking CXX executable. + +rule CXX_EXECUTABLE_LINKER__measure_built0_Debug + command = $PRE_LINK && /usr/bin/g++-10 $FLAGS $LINK_FLAGS $in -o $TARGET_FILE $LINK_PATH $LINK_LIBRARIES && $POST_BUILD + description = Linking CXX executable $TARGET_FILE + restat = $RESTAT + + +############################################# +# Rule for compiling CXX files. + +rule CXX_COMPILER__measure_built_Debug + depfile = $DEP_FILE + deps = gcc + command = /usr/bin/g++-10 $DEFINES $INCLUDES $FLAGS -MD -MT $out -MF $DEP_FILE -o $out -c $in + description = Building CXX object $out + + +############################################# +# Rule for linking CXX executable. + +rule CXX_EXECUTABLE_LINKER__measure_built_Debug + command = $PRE_LINK && /usr/bin/g++-10 $FLAGS $LINK_FLAGS $in -o $TARGET_FILE $LINK_PATH $LINK_LIBRARIES && $POST_BUILD + description = Linking CXX executable $TARGET_FILE + restat = $RESTAT + + +############################################# +# Rule for compiling CXX files. + +rule CXX_COMPILER__measure_perf3_Debug + depfile = $DEP_FILE + deps = gcc + command = /usr/bin/g++-10 $DEFINES $INCLUDES $FLAGS -MD -MT $out -MF $DEP_FILE -o $out -c $in + description = Building CXX object $out + + +############################################# +# Rule for linking CXX executable. + +rule CXX_EXECUTABLE_LINKER__measure_perf3_Debug + command = $PRE_LINK && /usr/bin/g++-10 $FLAGS $LINK_FLAGS $in -o $TARGET_FILE $LINK_PATH $LINK_LIBRARIES && $POST_BUILD + description = Linking CXX executable $TARGET_FILE + restat = $RESTAT + + +############################################# +# Rule for compiling CXX files. + +rule CXX_COMPILER__measure_fpp3_Debug + depfile = $DEP_FILE + deps = gcc + command = /usr/bin/g++-10 $DEFINES $INCLUDES $FLAGS -MD -MT $out -MF $DEP_FILE -o $out -c $in + description = Building CXX object $out + + +############################################# +# Rule for linking CXX executable. + +rule CXX_EXECUTABLE_LINKER__measure_fpp3_Debug + command = $PRE_LINK && /usr/bin/g++-10 $FLAGS $LINK_FLAGS $in -o $TARGET_FILE $LINK_PATH $LINK_LIBRARIES && $POST_BUILD + description = Linking CXX executable $TARGET_FILE + restat = $RESTAT + + +############################################# +# Rule for compiling CXX files. + +rule CXX_COMPILER__measure_perf0_Debug + depfile = $DEP_FILE + deps = gcc + command = /usr/bin/g++-10 $DEFINES $INCLUDES $FLAGS -MD -MT $out -MF $DEP_FILE -o $out -c $in + description = Building CXX object $out + + +############################################# +# Rule for linking CXX executable. + +rule CXX_EXECUTABLE_LINKER__measure_perf0_Debug + command = $PRE_LINK && /usr/bin/g++-10 $FLAGS $LINK_FLAGS $in -o $TARGET_FILE $LINK_PATH $LINK_LIBRARIES && $POST_BUILD + description = Linking CXX executable $TARGET_FILE + restat = $RESTAT + + +############################################# +# Rule for compiling CXX files. + +rule CXX_COMPILER__measure_fpp_Debug + depfile = $DEP_FILE + deps = gcc + command = /usr/bin/g++-10 $DEFINES $INCLUDES $FLAGS -MD -MT $out -MF $DEP_FILE -o $out -c $in + description = Building CXX object $out + + +############################################# +# Rule for linking CXX executable. + +rule CXX_EXECUTABLE_LINKER__measure_fpp_Debug + command = $PRE_LINK && /usr/bin/g++-10 $FLAGS $LINK_FLAGS $in -o $TARGET_FILE $LINK_PATH $LINK_LIBRARIES && $POST_BUILD + description = Linking CXX executable $TARGET_FILE + restat = $RESTAT + + +############################################# +# Rule for compiling CXX files. + +rule CXX_COMPILER__example0_Debug + depfile = $DEP_FILE + deps = gcc + command = /usr/bin/g++-10 $DEFINES $INCLUDES $FLAGS -MD -MT $out -MF $DEP_FILE -o $out -c $in + description = Building CXX object $out + + +############################################# +# Rule for linking CXX executable. + +rule CXX_EXECUTABLE_LINKER__example0_Debug + command = $PRE_LINK && /usr/bin/g++-10 $FLAGS $LINK_FLAGS $in -o $TARGET_FILE $LINK_PATH $LINK_LIBRARIES && $POST_BUILD + description = Linking CXX executable $TARGET_FILE + restat = $RESTAT + + +############################################# +# Rule for re-running cmake. + +rule RERUN_CMAKE + command = /snap/clion/184/bin/cmake/linux/bin/cmake --regenerate-during-build -S/home/tomer/Github/Public-PF -B/home/tomer/Github/Public-PF/cmake-build-debug + description = Re-running CMake... + generator = 1 + + +############################################# +# Rule for cleaning all built files. + +rule CLEAN + command = /snap/clion/184/bin/ninja/linux/ninja $FILE_ARG -t clean $TARGETS + description = Cleaning all built files... + + +############################################# +# Rule for printing all primary targets available. + +rule HELP + command = /snap/clion/184/bin/ninja/linux/ninja -t targets + description = All primary targets available: + diff --git a/cmake-build-debug/Testing/Temporary/LastTest.log b/cmake-build-debug/Testing/Temporary/LastTest.log new file mode 100644 index 0000000..1ac3170 --- /dev/null +++ b/cmake-build-debug/Testing/Temporary/LastTest.log @@ -0,0 +1,3 @@ +Start testing: Mar 18 12:15 IST +---------------------------------------------------------- +End testing: Mar 18 12:15 IST diff --git a/cmake-build-debug/build.ninja b/cmake-build-debug/build.ninja new file mode 100644 index 0000000..91d6b79 --- /dev/null +++ b/cmake-build-debug/build.ninja @@ -0,0 +1,925 @@ +# CMAKE generated file: DO NOT EDIT! +# Generated by "Ninja" Generator, CMake Version 3.21 + +# This file contains all the build statements describing the +# compilation DAG. + +# ============================================================================= +# Write statements declared in CMakeLists.txt: +# +# Which is the root file. +# ============================================================================= + +# ============================================================================= +# Project: APD_ONLY +# Configurations: Debug +# ============================================================================= + +############################################# +# Minimal version of Ninja required by this file + +ninja_required_version = 1.5 + + +############################################# +# Set configuration variable for custom commands. + +CONFIGURATION = Debug +# ============================================================================= +# Include auxiliary files. + + +############################################# +# Include rules file. + +include CMakeFiles/rules.ninja + +# ============================================================================= + +############################################# +# Logical path to working directory; prefix for absolute paths. + +cmake_ninja_workdir = /home/tomer/Github/Public-PF/cmake-build-debug/ + +############################################# +# Utility command for rebuild_cache + +build CMakeFiles/rebuild_cache.util: CUSTOM_COMMAND + COMMAND = cd /home/tomer/Github/Public-PF/cmake-build-debug && /snap/clion/184/bin/cmake/linux/bin/cmake --regenerate-during-build -S/home/tomer/Github/Public-PF -B/home/tomer/Github/Public-PF/cmake-build-debug + DESC = Running CMake to regenerate build system... + pool = console + restat = 1 + +build rebuild_cache: phony CMakeFiles/rebuild_cache.util + + +############################################# +# Utility command for edit_cache + +build CMakeFiles/edit_cache.util: CUSTOM_COMMAND + COMMAND = cd /home/tomer/Github/Public-PF/cmake-build-debug && /snap/clion/184/bin/cmake/linux/bin/cmake -E echo No\ interactive\ CMake\ dialog\ available. + DESC = No interactive CMake dialog available... + restat = 1 + +build edit_cache: phony CMakeFiles/edit_cache.util + +# ============================================================================= +# Object build statements for EXECUTABLE target example + + +############################################# +# Order-only phony target for example + +build cmake_object_order_depends_target_example: phony || CMakeFiles/example.dir + +build CMakeFiles/example.dir/Tests/smart_tests.cpp.o: CXX_COMPILER__example_Debug /home/tomer/Github/Public-PF/Tests/smart_tests.cpp || cmake_object_order_depends_target_example + DEP_FILE = CMakeFiles/example.dir/Tests/smart_tests.cpp.o.d + FLAGS = -march=native -g -Ofast -DNDEBUG -std=gnu++17 + OBJECT_DIR = CMakeFiles/example.dir + OBJECT_FILE_DIR = CMakeFiles/example.dir/Tests + TARGET_COMPILE_PDB = CMakeFiles/example.dir/ + TARGET_PDB = example.pdb + +build CMakeFiles/example.dir/Prefix-Filter/Shift_op.cpp.o: CXX_COMPILER__example_Debug /home/tomer/Github/Public-PF/Prefix-Filter/Shift_op.cpp || cmake_object_order_depends_target_example + DEP_FILE = CMakeFiles/example.dir/Prefix-Filter/Shift_op.cpp.o.d + FLAGS = -march=native -g -Ofast -DNDEBUG -std=gnu++17 + OBJECT_DIR = CMakeFiles/example.dir + OBJECT_FILE_DIR = CMakeFiles/example.dir/Prefix-Filter + TARGET_COMPILE_PDB = CMakeFiles/example.dir/ + TARGET_PDB = example.pdb + +build CMakeFiles/example.dir/Prefix-Filter/min_pd256.cpp.o: CXX_COMPILER__example_Debug /home/tomer/Github/Public-PF/Prefix-Filter/min_pd256.cpp || cmake_object_order_depends_target_example + DEP_FILE = CMakeFiles/example.dir/Prefix-Filter/min_pd256.cpp.o.d + FLAGS = -march=native -g -Ofast -DNDEBUG -std=gnu++17 + OBJECT_DIR = CMakeFiles/example.dir + OBJECT_FILE_DIR = CMakeFiles/example.dir/Prefix-Filter + TARGET_COMPILE_PDB = CMakeFiles/example.dir/ + TARGET_PDB = example.pdb + +build CMakeFiles/example.dir/cuckoofilter/src/printutil.cc.o: CXX_COMPILER__example_Debug /home/tomer/Github/Public-PF/cuckoofilter/src/printutil.cc || cmake_object_order_depends_target_example + DEP_FILE = CMakeFiles/example.dir/cuckoofilter/src/printutil.cc.o.d + FLAGS = -march=native -g -Ofast -DNDEBUG -std=gnu++17 + OBJECT_DIR = CMakeFiles/example.dir + OBJECT_FILE_DIR = CMakeFiles/example.dir/cuckoofilter/src + TARGET_COMPILE_PDB = CMakeFiles/example.dir/ + TARGET_PDB = example.pdb + +build CMakeFiles/example.dir/TC-Shortcut/tc-sym.cpp.o: CXX_COMPILER__example_Debug /home/tomer/Github/Public-PF/TC-Shortcut/tc-sym.cpp || cmake_object_order_depends_target_example + DEP_FILE = CMakeFiles/example.dir/TC-Shortcut/tc-sym.cpp.o.d + FLAGS = -march=native -g -Ofast -DNDEBUG -std=gnu++17 + OBJECT_DIR = CMakeFiles/example.dir + OBJECT_FILE_DIR = CMakeFiles/example.dir/TC-Shortcut + TARGET_COMPILE_PDB = CMakeFiles/example.dir/ + TARGET_PDB = example.pdb + +build CMakeFiles/example.dir/example.cpp.o: CXX_COMPILER__example_Debug /home/tomer/Github/Public-PF/example.cpp || cmake_object_order_depends_target_example + DEP_FILE = CMakeFiles/example.dir/example.cpp.o.d + FLAGS = -march=native -g -Ofast -DNDEBUG -std=gnu++17 + OBJECT_DIR = CMakeFiles/example.dir + OBJECT_FILE_DIR = CMakeFiles/example.dir + TARGET_COMPILE_PDB = CMakeFiles/example.dir/ + TARGET_PDB = example.pdb + + +# ============================================================================= +# Link build statements for EXECUTABLE target example + + +############################################# +# Link the executable example + +build example: CXX_EXECUTABLE_LINKER__example_Debug CMakeFiles/example.dir/Tests/smart_tests.cpp.o CMakeFiles/example.dir/Prefix-Filter/Shift_op.cpp.o CMakeFiles/example.dir/Prefix-Filter/min_pd256.cpp.o CMakeFiles/example.dir/cuckoofilter/src/printutil.cc.o CMakeFiles/example.dir/TC-Shortcut/tc-sym.cpp.o CMakeFiles/example.dir/example.cpp.o + FLAGS = -march=native -g + OBJECT_DIR = CMakeFiles/example.dir + POST_BUILD = : + PRE_LINK = : + TARGET_COMPILE_PDB = CMakeFiles/example.dir/ + TARGET_FILE = example + TARGET_PDB = example.pdb + +# ============================================================================= +# Object build statements for EXECUTABLE target measure_fpp0 + + +############################################# +# Order-only phony target for measure_fpp0 + +build cmake_object_order_depends_target_measure_fpp0: phony || CMakeFiles/measure_fpp0.dir + +build CMakeFiles/measure_fpp0.dir/Tests/smart_tests.cpp.o: CXX_COMPILER__measure_fpp0_Debug /home/tomer/Github/Public-PF/Tests/smart_tests.cpp || cmake_object_order_depends_target_measure_fpp0 + DEP_FILE = CMakeFiles/measure_fpp0.dir/Tests/smart_tests.cpp.o.d + FLAGS = -march=native -g -O0 -g3 -W -std=gnu++17 + OBJECT_DIR = CMakeFiles/measure_fpp0.dir + OBJECT_FILE_DIR = CMakeFiles/measure_fpp0.dir/Tests + TARGET_COMPILE_PDB = CMakeFiles/measure_fpp0.dir/ + TARGET_PDB = measure_fpp0.pdb + +build CMakeFiles/measure_fpp0.dir/Prefix-Filter/Shift_op.cpp.o: CXX_COMPILER__measure_fpp0_Debug /home/tomer/Github/Public-PF/Prefix-Filter/Shift_op.cpp || cmake_object_order_depends_target_measure_fpp0 + DEP_FILE = CMakeFiles/measure_fpp0.dir/Prefix-Filter/Shift_op.cpp.o.d + FLAGS = -march=native -g -O0 -g3 -W -std=gnu++17 + OBJECT_DIR = CMakeFiles/measure_fpp0.dir + OBJECT_FILE_DIR = CMakeFiles/measure_fpp0.dir/Prefix-Filter + TARGET_COMPILE_PDB = CMakeFiles/measure_fpp0.dir/ + TARGET_PDB = measure_fpp0.pdb + +build CMakeFiles/measure_fpp0.dir/Prefix-Filter/min_pd256.cpp.o: CXX_COMPILER__measure_fpp0_Debug /home/tomer/Github/Public-PF/Prefix-Filter/min_pd256.cpp || cmake_object_order_depends_target_measure_fpp0 + DEP_FILE = CMakeFiles/measure_fpp0.dir/Prefix-Filter/min_pd256.cpp.o.d + FLAGS = -march=native -g -O0 -g3 -W -std=gnu++17 + OBJECT_DIR = CMakeFiles/measure_fpp0.dir + OBJECT_FILE_DIR = CMakeFiles/measure_fpp0.dir/Prefix-Filter + TARGET_COMPILE_PDB = CMakeFiles/measure_fpp0.dir/ + TARGET_PDB = measure_fpp0.pdb + +build CMakeFiles/measure_fpp0.dir/cuckoofilter/src/printutil.cc.o: CXX_COMPILER__measure_fpp0_Debug /home/tomer/Github/Public-PF/cuckoofilter/src/printutil.cc || cmake_object_order_depends_target_measure_fpp0 + DEP_FILE = CMakeFiles/measure_fpp0.dir/cuckoofilter/src/printutil.cc.o.d + FLAGS = -march=native -g -O0 -g3 -W -std=gnu++17 + OBJECT_DIR = CMakeFiles/measure_fpp0.dir + OBJECT_FILE_DIR = CMakeFiles/measure_fpp0.dir/cuckoofilter/src + TARGET_COMPILE_PDB = CMakeFiles/measure_fpp0.dir/ + TARGET_PDB = measure_fpp0.pdb + +build CMakeFiles/measure_fpp0.dir/TC-Shortcut/tc-sym.cpp.o: CXX_COMPILER__measure_fpp0_Debug /home/tomer/Github/Public-PF/TC-Shortcut/tc-sym.cpp || cmake_object_order_depends_target_measure_fpp0 + DEP_FILE = CMakeFiles/measure_fpp0.dir/TC-Shortcut/tc-sym.cpp.o.d + FLAGS = -march=native -g -O0 -g3 -W -std=gnu++17 + OBJECT_DIR = CMakeFiles/measure_fpp0.dir + OBJECT_FILE_DIR = CMakeFiles/measure_fpp0.dir/TC-Shortcut + TARGET_COMPILE_PDB = CMakeFiles/measure_fpp0.dir/ + TARGET_PDB = measure_fpp0.pdb + +build CMakeFiles/measure_fpp0.dir/main-fpp.cpp.o: CXX_COMPILER__measure_fpp0_Debug /home/tomer/Github/Public-PF/main-fpp.cpp || cmake_object_order_depends_target_measure_fpp0 + DEP_FILE = CMakeFiles/measure_fpp0.dir/main-fpp.cpp.o.d + FLAGS = -march=native -g -O0 -g3 -W -std=gnu++17 + OBJECT_DIR = CMakeFiles/measure_fpp0.dir + OBJECT_FILE_DIR = CMakeFiles/measure_fpp0.dir + TARGET_COMPILE_PDB = CMakeFiles/measure_fpp0.dir/ + TARGET_PDB = measure_fpp0.pdb + + +# ============================================================================= +# Link build statements for EXECUTABLE target measure_fpp0 + + +############################################# +# Link the executable measure_fpp0 + +build measure_fpp0: CXX_EXECUTABLE_LINKER__measure_fpp0_Debug CMakeFiles/measure_fpp0.dir/Tests/smart_tests.cpp.o CMakeFiles/measure_fpp0.dir/Prefix-Filter/Shift_op.cpp.o CMakeFiles/measure_fpp0.dir/Prefix-Filter/min_pd256.cpp.o CMakeFiles/measure_fpp0.dir/cuckoofilter/src/printutil.cc.o CMakeFiles/measure_fpp0.dir/TC-Shortcut/tc-sym.cpp.o CMakeFiles/measure_fpp0.dir/main-fpp.cpp.o + FLAGS = -march=native -g + OBJECT_DIR = CMakeFiles/measure_fpp0.dir + POST_BUILD = : + PRE_LINK = : + TARGET_COMPILE_PDB = CMakeFiles/measure_fpp0.dir/ + TARGET_FILE = measure_fpp0 + TARGET_PDB = measure_fpp0.pdb + +# ============================================================================= +# Object build statements for EXECUTABLE target measure_perf + + +############################################# +# Order-only phony target for measure_perf + +build cmake_object_order_depends_target_measure_perf: phony || CMakeFiles/measure_perf.dir + +build CMakeFiles/measure_perf.dir/Tests/smart_tests.cpp.o: CXX_COMPILER__measure_perf_Debug /home/tomer/Github/Public-PF/Tests/smart_tests.cpp || cmake_object_order_depends_target_measure_perf + DEP_FILE = CMakeFiles/measure_perf.dir/Tests/smart_tests.cpp.o.d + FLAGS = -march=native -g -Ofast -DNDEBUG -std=gnu++17 + OBJECT_DIR = CMakeFiles/measure_perf.dir + OBJECT_FILE_DIR = CMakeFiles/measure_perf.dir/Tests + TARGET_COMPILE_PDB = CMakeFiles/measure_perf.dir/ + TARGET_PDB = measure_perf.pdb + +build CMakeFiles/measure_perf.dir/Prefix-Filter/Shift_op.cpp.o: CXX_COMPILER__measure_perf_Debug /home/tomer/Github/Public-PF/Prefix-Filter/Shift_op.cpp || cmake_object_order_depends_target_measure_perf + DEP_FILE = CMakeFiles/measure_perf.dir/Prefix-Filter/Shift_op.cpp.o.d + FLAGS = -march=native -g -Ofast -DNDEBUG -std=gnu++17 + OBJECT_DIR = CMakeFiles/measure_perf.dir + OBJECT_FILE_DIR = CMakeFiles/measure_perf.dir/Prefix-Filter + TARGET_COMPILE_PDB = CMakeFiles/measure_perf.dir/ + TARGET_PDB = measure_perf.pdb + +build CMakeFiles/measure_perf.dir/Prefix-Filter/min_pd256.cpp.o: CXX_COMPILER__measure_perf_Debug /home/tomer/Github/Public-PF/Prefix-Filter/min_pd256.cpp || cmake_object_order_depends_target_measure_perf + DEP_FILE = CMakeFiles/measure_perf.dir/Prefix-Filter/min_pd256.cpp.o.d + FLAGS = -march=native -g -Ofast -DNDEBUG -std=gnu++17 + OBJECT_DIR = CMakeFiles/measure_perf.dir + OBJECT_FILE_DIR = CMakeFiles/measure_perf.dir/Prefix-Filter + TARGET_COMPILE_PDB = CMakeFiles/measure_perf.dir/ + TARGET_PDB = measure_perf.pdb + +build CMakeFiles/measure_perf.dir/cuckoofilter/src/printutil.cc.o: CXX_COMPILER__measure_perf_Debug /home/tomer/Github/Public-PF/cuckoofilter/src/printutil.cc || cmake_object_order_depends_target_measure_perf + DEP_FILE = CMakeFiles/measure_perf.dir/cuckoofilter/src/printutil.cc.o.d + FLAGS = -march=native -g -Ofast -DNDEBUG -std=gnu++17 + OBJECT_DIR = CMakeFiles/measure_perf.dir + OBJECT_FILE_DIR = CMakeFiles/measure_perf.dir/cuckoofilter/src + TARGET_COMPILE_PDB = CMakeFiles/measure_perf.dir/ + TARGET_PDB = measure_perf.pdb + +build CMakeFiles/measure_perf.dir/TC-Shortcut/tc-sym.cpp.o: CXX_COMPILER__measure_perf_Debug /home/tomer/Github/Public-PF/TC-Shortcut/tc-sym.cpp || cmake_object_order_depends_target_measure_perf + DEP_FILE = CMakeFiles/measure_perf.dir/TC-Shortcut/tc-sym.cpp.o.d + FLAGS = -march=native -g -Ofast -DNDEBUG -std=gnu++17 + OBJECT_DIR = CMakeFiles/measure_perf.dir + OBJECT_FILE_DIR = CMakeFiles/measure_perf.dir/TC-Shortcut + TARGET_COMPILE_PDB = CMakeFiles/measure_perf.dir/ + TARGET_PDB = measure_perf.pdb + +build CMakeFiles/measure_perf.dir/main-perf.cpp.o: CXX_COMPILER__measure_perf_Debug /home/tomer/Github/Public-PF/main-perf.cpp || cmake_object_order_depends_target_measure_perf + DEP_FILE = CMakeFiles/measure_perf.dir/main-perf.cpp.o.d + FLAGS = -march=native -g -Ofast -DNDEBUG -std=gnu++17 + OBJECT_DIR = CMakeFiles/measure_perf.dir + OBJECT_FILE_DIR = CMakeFiles/measure_perf.dir + TARGET_COMPILE_PDB = CMakeFiles/measure_perf.dir/ + TARGET_PDB = measure_perf.pdb + + +# ============================================================================= +# Link build statements for EXECUTABLE target measure_perf + + +############################################# +# Link the executable measure_perf + +build measure_perf: CXX_EXECUTABLE_LINKER__measure_perf_Debug CMakeFiles/measure_perf.dir/Tests/smart_tests.cpp.o CMakeFiles/measure_perf.dir/Prefix-Filter/Shift_op.cpp.o CMakeFiles/measure_perf.dir/Prefix-Filter/min_pd256.cpp.o CMakeFiles/measure_perf.dir/cuckoofilter/src/printutil.cc.o CMakeFiles/measure_perf.dir/TC-Shortcut/tc-sym.cpp.o CMakeFiles/measure_perf.dir/main-perf.cpp.o + FLAGS = -march=native -g + OBJECT_DIR = CMakeFiles/measure_perf.dir + POST_BUILD = : + PRE_LINK = : + TARGET_COMPILE_PDB = CMakeFiles/measure_perf.dir/ + TARGET_FILE = measure_perf + TARGET_PDB = measure_perf.pdb + +# ============================================================================= +# Object build statements for EXECUTABLE target measure_built3 + + +############################################# +# Order-only phony target for measure_built3 + +build cmake_object_order_depends_target_measure_built3: phony || CMakeFiles/measure_built3.dir + +build CMakeFiles/measure_built3.dir/Tests/smart_tests.cpp.o: CXX_COMPILER__measure_built3_Debug /home/tomer/Github/Public-PF/Tests/smart_tests.cpp || cmake_object_order_depends_target_measure_built3 + DEP_FILE = CMakeFiles/measure_built3.dir/Tests/smart_tests.cpp.o.d + FLAGS = -march=native -g -O3 -g3 -std=gnu++17 + OBJECT_DIR = CMakeFiles/measure_built3.dir + OBJECT_FILE_DIR = CMakeFiles/measure_built3.dir/Tests + TARGET_COMPILE_PDB = CMakeFiles/measure_built3.dir/ + TARGET_PDB = measure_built3.pdb + +build CMakeFiles/measure_built3.dir/Prefix-Filter/Shift_op.cpp.o: CXX_COMPILER__measure_built3_Debug /home/tomer/Github/Public-PF/Prefix-Filter/Shift_op.cpp || cmake_object_order_depends_target_measure_built3 + DEP_FILE = CMakeFiles/measure_built3.dir/Prefix-Filter/Shift_op.cpp.o.d + FLAGS = -march=native -g -O3 -g3 -std=gnu++17 + OBJECT_DIR = CMakeFiles/measure_built3.dir + OBJECT_FILE_DIR = CMakeFiles/measure_built3.dir/Prefix-Filter + TARGET_COMPILE_PDB = CMakeFiles/measure_built3.dir/ + TARGET_PDB = measure_built3.pdb + +build CMakeFiles/measure_built3.dir/Prefix-Filter/min_pd256.cpp.o: CXX_COMPILER__measure_built3_Debug /home/tomer/Github/Public-PF/Prefix-Filter/min_pd256.cpp || cmake_object_order_depends_target_measure_built3 + DEP_FILE = CMakeFiles/measure_built3.dir/Prefix-Filter/min_pd256.cpp.o.d + FLAGS = -march=native -g -O3 -g3 -std=gnu++17 + OBJECT_DIR = CMakeFiles/measure_built3.dir + OBJECT_FILE_DIR = CMakeFiles/measure_built3.dir/Prefix-Filter + TARGET_COMPILE_PDB = CMakeFiles/measure_built3.dir/ + TARGET_PDB = measure_built3.pdb + +build CMakeFiles/measure_built3.dir/cuckoofilter/src/printutil.cc.o: CXX_COMPILER__measure_built3_Debug /home/tomer/Github/Public-PF/cuckoofilter/src/printutil.cc || cmake_object_order_depends_target_measure_built3 + DEP_FILE = CMakeFiles/measure_built3.dir/cuckoofilter/src/printutil.cc.o.d + FLAGS = -march=native -g -O3 -g3 -std=gnu++17 + OBJECT_DIR = CMakeFiles/measure_built3.dir + OBJECT_FILE_DIR = CMakeFiles/measure_built3.dir/cuckoofilter/src + TARGET_COMPILE_PDB = CMakeFiles/measure_built3.dir/ + TARGET_PDB = measure_built3.pdb + +build CMakeFiles/measure_built3.dir/TC-Shortcut/tc-sym.cpp.o: CXX_COMPILER__measure_built3_Debug /home/tomer/Github/Public-PF/TC-Shortcut/tc-sym.cpp || cmake_object_order_depends_target_measure_built3 + DEP_FILE = CMakeFiles/measure_built3.dir/TC-Shortcut/tc-sym.cpp.o.d + FLAGS = -march=native -g -O3 -g3 -std=gnu++17 + OBJECT_DIR = CMakeFiles/measure_built3.dir + OBJECT_FILE_DIR = CMakeFiles/measure_built3.dir/TC-Shortcut + TARGET_COMPILE_PDB = CMakeFiles/measure_built3.dir/ + TARGET_PDB = measure_built3.pdb + +build CMakeFiles/measure_built3.dir/main-built.cpp.o: CXX_COMPILER__measure_built3_Debug /home/tomer/Github/Public-PF/main-built.cpp || cmake_object_order_depends_target_measure_built3 + DEP_FILE = CMakeFiles/measure_built3.dir/main-built.cpp.o.d + FLAGS = -march=native -g -O3 -g3 -std=gnu++17 + OBJECT_DIR = CMakeFiles/measure_built3.dir + OBJECT_FILE_DIR = CMakeFiles/measure_built3.dir + TARGET_COMPILE_PDB = CMakeFiles/measure_built3.dir/ + TARGET_PDB = measure_built3.pdb + + +# ============================================================================= +# Link build statements for EXECUTABLE target measure_built3 + + +############################################# +# Link the executable measure_built3 + +build measure_built3: CXX_EXECUTABLE_LINKER__measure_built3_Debug CMakeFiles/measure_built3.dir/Tests/smart_tests.cpp.o CMakeFiles/measure_built3.dir/Prefix-Filter/Shift_op.cpp.o CMakeFiles/measure_built3.dir/Prefix-Filter/min_pd256.cpp.o CMakeFiles/measure_built3.dir/cuckoofilter/src/printutil.cc.o CMakeFiles/measure_built3.dir/TC-Shortcut/tc-sym.cpp.o CMakeFiles/measure_built3.dir/main-built.cpp.o + FLAGS = -march=native -g + OBJECT_DIR = CMakeFiles/measure_built3.dir + POST_BUILD = : + PRE_LINK = : + TARGET_COMPILE_PDB = CMakeFiles/measure_built3.dir/ + TARGET_FILE = measure_built3 + TARGET_PDB = measure_built3.pdb + +# ============================================================================= +# Object build statements for EXECUTABLE target measure_built0 + + +############################################# +# Order-only phony target for measure_built0 + +build cmake_object_order_depends_target_measure_built0: phony || CMakeFiles/measure_built0.dir + +build CMakeFiles/measure_built0.dir/Tests/smart_tests.cpp.o: CXX_COMPILER__measure_built0_Debug /home/tomer/Github/Public-PF/Tests/smart_tests.cpp || cmake_object_order_depends_target_measure_built0 + DEP_FILE = CMakeFiles/measure_built0.dir/Tests/smart_tests.cpp.o.d + FLAGS = -march=native -g -O0 -g3 -W -std=gnu++17 + OBJECT_DIR = CMakeFiles/measure_built0.dir + OBJECT_FILE_DIR = CMakeFiles/measure_built0.dir/Tests + TARGET_COMPILE_PDB = CMakeFiles/measure_built0.dir/ + TARGET_PDB = measure_built0.pdb + +build CMakeFiles/measure_built0.dir/Prefix-Filter/Shift_op.cpp.o: CXX_COMPILER__measure_built0_Debug /home/tomer/Github/Public-PF/Prefix-Filter/Shift_op.cpp || cmake_object_order_depends_target_measure_built0 + DEP_FILE = CMakeFiles/measure_built0.dir/Prefix-Filter/Shift_op.cpp.o.d + FLAGS = -march=native -g -O0 -g3 -W -std=gnu++17 + OBJECT_DIR = CMakeFiles/measure_built0.dir + OBJECT_FILE_DIR = CMakeFiles/measure_built0.dir/Prefix-Filter + TARGET_COMPILE_PDB = CMakeFiles/measure_built0.dir/ + TARGET_PDB = measure_built0.pdb + +build CMakeFiles/measure_built0.dir/Prefix-Filter/min_pd256.cpp.o: CXX_COMPILER__measure_built0_Debug /home/tomer/Github/Public-PF/Prefix-Filter/min_pd256.cpp || cmake_object_order_depends_target_measure_built0 + DEP_FILE = CMakeFiles/measure_built0.dir/Prefix-Filter/min_pd256.cpp.o.d + FLAGS = -march=native -g -O0 -g3 -W -std=gnu++17 + OBJECT_DIR = CMakeFiles/measure_built0.dir + OBJECT_FILE_DIR = CMakeFiles/measure_built0.dir/Prefix-Filter + TARGET_COMPILE_PDB = CMakeFiles/measure_built0.dir/ + TARGET_PDB = measure_built0.pdb + +build CMakeFiles/measure_built0.dir/cuckoofilter/src/printutil.cc.o: CXX_COMPILER__measure_built0_Debug /home/tomer/Github/Public-PF/cuckoofilter/src/printutil.cc || cmake_object_order_depends_target_measure_built0 + DEP_FILE = CMakeFiles/measure_built0.dir/cuckoofilter/src/printutil.cc.o.d + FLAGS = -march=native -g -O0 -g3 -W -std=gnu++17 + OBJECT_DIR = CMakeFiles/measure_built0.dir + OBJECT_FILE_DIR = CMakeFiles/measure_built0.dir/cuckoofilter/src + TARGET_COMPILE_PDB = CMakeFiles/measure_built0.dir/ + TARGET_PDB = measure_built0.pdb + +build CMakeFiles/measure_built0.dir/TC-Shortcut/tc-sym.cpp.o: CXX_COMPILER__measure_built0_Debug /home/tomer/Github/Public-PF/TC-Shortcut/tc-sym.cpp || cmake_object_order_depends_target_measure_built0 + DEP_FILE = CMakeFiles/measure_built0.dir/TC-Shortcut/tc-sym.cpp.o.d + FLAGS = -march=native -g -O0 -g3 -W -std=gnu++17 + OBJECT_DIR = CMakeFiles/measure_built0.dir + OBJECT_FILE_DIR = CMakeFiles/measure_built0.dir/TC-Shortcut + TARGET_COMPILE_PDB = CMakeFiles/measure_built0.dir/ + TARGET_PDB = measure_built0.pdb + +build CMakeFiles/measure_built0.dir/main-built.cpp.o: CXX_COMPILER__measure_built0_Debug /home/tomer/Github/Public-PF/main-built.cpp || cmake_object_order_depends_target_measure_built0 + DEP_FILE = CMakeFiles/measure_built0.dir/main-built.cpp.o.d + FLAGS = -march=native -g -O0 -g3 -W -std=gnu++17 + OBJECT_DIR = CMakeFiles/measure_built0.dir + OBJECT_FILE_DIR = CMakeFiles/measure_built0.dir + TARGET_COMPILE_PDB = CMakeFiles/measure_built0.dir/ + TARGET_PDB = measure_built0.pdb + + +# ============================================================================= +# Link build statements for EXECUTABLE target measure_built0 + + +############################################# +# Link the executable measure_built0 + +build measure_built0: CXX_EXECUTABLE_LINKER__measure_built0_Debug CMakeFiles/measure_built0.dir/Tests/smart_tests.cpp.o CMakeFiles/measure_built0.dir/Prefix-Filter/Shift_op.cpp.o CMakeFiles/measure_built0.dir/Prefix-Filter/min_pd256.cpp.o CMakeFiles/measure_built0.dir/cuckoofilter/src/printutil.cc.o CMakeFiles/measure_built0.dir/TC-Shortcut/tc-sym.cpp.o CMakeFiles/measure_built0.dir/main-built.cpp.o + FLAGS = -march=native -g + OBJECT_DIR = CMakeFiles/measure_built0.dir + POST_BUILD = : + PRE_LINK = : + TARGET_COMPILE_PDB = CMakeFiles/measure_built0.dir/ + TARGET_FILE = measure_built0 + TARGET_PDB = measure_built0.pdb + +# ============================================================================= +# Object build statements for EXECUTABLE target measure_built + + +############################################# +# Order-only phony target for measure_built + +build cmake_object_order_depends_target_measure_built: phony || CMakeFiles/measure_built.dir + +build CMakeFiles/measure_built.dir/Tests/smart_tests.cpp.o: CXX_COMPILER__measure_built_Debug /home/tomer/Github/Public-PF/Tests/smart_tests.cpp || cmake_object_order_depends_target_measure_built + DEP_FILE = CMakeFiles/measure_built.dir/Tests/smart_tests.cpp.o.d + FLAGS = -march=native -g -Ofast -DNDEBUG -std=gnu++17 + OBJECT_DIR = CMakeFiles/measure_built.dir + OBJECT_FILE_DIR = CMakeFiles/measure_built.dir/Tests + TARGET_COMPILE_PDB = CMakeFiles/measure_built.dir/ + TARGET_PDB = measure_built.pdb + +build CMakeFiles/measure_built.dir/Prefix-Filter/Shift_op.cpp.o: CXX_COMPILER__measure_built_Debug /home/tomer/Github/Public-PF/Prefix-Filter/Shift_op.cpp || cmake_object_order_depends_target_measure_built + DEP_FILE = CMakeFiles/measure_built.dir/Prefix-Filter/Shift_op.cpp.o.d + FLAGS = -march=native -g -Ofast -DNDEBUG -std=gnu++17 + OBJECT_DIR = CMakeFiles/measure_built.dir + OBJECT_FILE_DIR = CMakeFiles/measure_built.dir/Prefix-Filter + TARGET_COMPILE_PDB = CMakeFiles/measure_built.dir/ + TARGET_PDB = measure_built.pdb + +build CMakeFiles/measure_built.dir/Prefix-Filter/min_pd256.cpp.o: CXX_COMPILER__measure_built_Debug /home/tomer/Github/Public-PF/Prefix-Filter/min_pd256.cpp || cmake_object_order_depends_target_measure_built + DEP_FILE = CMakeFiles/measure_built.dir/Prefix-Filter/min_pd256.cpp.o.d + FLAGS = -march=native -g -Ofast -DNDEBUG -std=gnu++17 + OBJECT_DIR = CMakeFiles/measure_built.dir + OBJECT_FILE_DIR = CMakeFiles/measure_built.dir/Prefix-Filter + TARGET_COMPILE_PDB = CMakeFiles/measure_built.dir/ + TARGET_PDB = measure_built.pdb + +build CMakeFiles/measure_built.dir/cuckoofilter/src/printutil.cc.o: CXX_COMPILER__measure_built_Debug /home/tomer/Github/Public-PF/cuckoofilter/src/printutil.cc || cmake_object_order_depends_target_measure_built + DEP_FILE = CMakeFiles/measure_built.dir/cuckoofilter/src/printutil.cc.o.d + FLAGS = -march=native -g -Ofast -DNDEBUG -std=gnu++17 + OBJECT_DIR = CMakeFiles/measure_built.dir + OBJECT_FILE_DIR = CMakeFiles/measure_built.dir/cuckoofilter/src + TARGET_COMPILE_PDB = CMakeFiles/measure_built.dir/ + TARGET_PDB = measure_built.pdb + +build CMakeFiles/measure_built.dir/TC-Shortcut/tc-sym.cpp.o: CXX_COMPILER__measure_built_Debug /home/tomer/Github/Public-PF/TC-Shortcut/tc-sym.cpp || cmake_object_order_depends_target_measure_built + DEP_FILE = CMakeFiles/measure_built.dir/TC-Shortcut/tc-sym.cpp.o.d + FLAGS = -march=native -g -Ofast -DNDEBUG -std=gnu++17 + OBJECT_DIR = CMakeFiles/measure_built.dir + OBJECT_FILE_DIR = CMakeFiles/measure_built.dir/TC-Shortcut + TARGET_COMPILE_PDB = CMakeFiles/measure_built.dir/ + TARGET_PDB = measure_built.pdb + +build CMakeFiles/measure_built.dir/main-built.cpp.o: CXX_COMPILER__measure_built_Debug /home/tomer/Github/Public-PF/main-built.cpp || cmake_object_order_depends_target_measure_built + DEP_FILE = CMakeFiles/measure_built.dir/main-built.cpp.o.d + FLAGS = -march=native -g -Ofast -DNDEBUG -std=gnu++17 + OBJECT_DIR = CMakeFiles/measure_built.dir + OBJECT_FILE_DIR = CMakeFiles/measure_built.dir + TARGET_COMPILE_PDB = CMakeFiles/measure_built.dir/ + TARGET_PDB = measure_built.pdb + + +# ============================================================================= +# Link build statements for EXECUTABLE target measure_built + + +############################################# +# Link the executable measure_built + +build measure_built: CXX_EXECUTABLE_LINKER__measure_built_Debug CMakeFiles/measure_built.dir/Tests/smart_tests.cpp.o CMakeFiles/measure_built.dir/Prefix-Filter/Shift_op.cpp.o CMakeFiles/measure_built.dir/Prefix-Filter/min_pd256.cpp.o CMakeFiles/measure_built.dir/cuckoofilter/src/printutil.cc.o CMakeFiles/measure_built.dir/TC-Shortcut/tc-sym.cpp.o CMakeFiles/measure_built.dir/main-built.cpp.o + FLAGS = -march=native -g + OBJECT_DIR = CMakeFiles/measure_built.dir + POST_BUILD = : + PRE_LINK = : + TARGET_COMPILE_PDB = CMakeFiles/measure_built.dir/ + TARGET_FILE = measure_built + TARGET_PDB = measure_built.pdb + +# ============================================================================= +# Object build statements for EXECUTABLE target measure_perf3 + + +############################################# +# Order-only phony target for measure_perf3 + +build cmake_object_order_depends_target_measure_perf3: phony || CMakeFiles/measure_perf3.dir + +build CMakeFiles/measure_perf3.dir/Tests/smart_tests.cpp.o: CXX_COMPILER__measure_perf3_Debug /home/tomer/Github/Public-PF/Tests/smart_tests.cpp || cmake_object_order_depends_target_measure_perf3 + DEP_FILE = CMakeFiles/measure_perf3.dir/Tests/smart_tests.cpp.o.d + FLAGS = -march=native -g -O3 -g3 -std=gnu++17 + OBJECT_DIR = CMakeFiles/measure_perf3.dir + OBJECT_FILE_DIR = CMakeFiles/measure_perf3.dir/Tests + TARGET_COMPILE_PDB = CMakeFiles/measure_perf3.dir/ + TARGET_PDB = measure_perf3.pdb + +build CMakeFiles/measure_perf3.dir/Prefix-Filter/Shift_op.cpp.o: CXX_COMPILER__measure_perf3_Debug /home/tomer/Github/Public-PF/Prefix-Filter/Shift_op.cpp || cmake_object_order_depends_target_measure_perf3 + DEP_FILE = CMakeFiles/measure_perf3.dir/Prefix-Filter/Shift_op.cpp.o.d + FLAGS = -march=native -g -O3 -g3 -std=gnu++17 + OBJECT_DIR = CMakeFiles/measure_perf3.dir + OBJECT_FILE_DIR = CMakeFiles/measure_perf3.dir/Prefix-Filter + TARGET_COMPILE_PDB = CMakeFiles/measure_perf3.dir/ + TARGET_PDB = measure_perf3.pdb + +build CMakeFiles/measure_perf3.dir/Prefix-Filter/min_pd256.cpp.o: CXX_COMPILER__measure_perf3_Debug /home/tomer/Github/Public-PF/Prefix-Filter/min_pd256.cpp || cmake_object_order_depends_target_measure_perf3 + DEP_FILE = CMakeFiles/measure_perf3.dir/Prefix-Filter/min_pd256.cpp.o.d + FLAGS = -march=native -g -O3 -g3 -std=gnu++17 + OBJECT_DIR = CMakeFiles/measure_perf3.dir + OBJECT_FILE_DIR = CMakeFiles/measure_perf3.dir/Prefix-Filter + TARGET_COMPILE_PDB = CMakeFiles/measure_perf3.dir/ + TARGET_PDB = measure_perf3.pdb + +build CMakeFiles/measure_perf3.dir/cuckoofilter/src/printutil.cc.o: CXX_COMPILER__measure_perf3_Debug /home/tomer/Github/Public-PF/cuckoofilter/src/printutil.cc || cmake_object_order_depends_target_measure_perf3 + DEP_FILE = CMakeFiles/measure_perf3.dir/cuckoofilter/src/printutil.cc.o.d + FLAGS = -march=native -g -O3 -g3 -std=gnu++17 + OBJECT_DIR = CMakeFiles/measure_perf3.dir + OBJECT_FILE_DIR = CMakeFiles/measure_perf3.dir/cuckoofilter/src + TARGET_COMPILE_PDB = CMakeFiles/measure_perf3.dir/ + TARGET_PDB = measure_perf3.pdb + +build CMakeFiles/measure_perf3.dir/TC-Shortcut/tc-sym.cpp.o: CXX_COMPILER__measure_perf3_Debug /home/tomer/Github/Public-PF/TC-Shortcut/tc-sym.cpp || cmake_object_order_depends_target_measure_perf3 + DEP_FILE = CMakeFiles/measure_perf3.dir/TC-Shortcut/tc-sym.cpp.o.d + FLAGS = -march=native -g -O3 -g3 -std=gnu++17 + OBJECT_DIR = CMakeFiles/measure_perf3.dir + OBJECT_FILE_DIR = CMakeFiles/measure_perf3.dir/TC-Shortcut + TARGET_COMPILE_PDB = CMakeFiles/measure_perf3.dir/ + TARGET_PDB = measure_perf3.pdb + +build CMakeFiles/measure_perf3.dir/main-perf.cpp.o: CXX_COMPILER__measure_perf3_Debug /home/tomer/Github/Public-PF/main-perf.cpp || cmake_object_order_depends_target_measure_perf3 + DEP_FILE = CMakeFiles/measure_perf3.dir/main-perf.cpp.o.d + FLAGS = -march=native -g -O3 -g3 -std=gnu++17 + OBJECT_DIR = CMakeFiles/measure_perf3.dir + OBJECT_FILE_DIR = CMakeFiles/measure_perf3.dir + TARGET_COMPILE_PDB = CMakeFiles/measure_perf3.dir/ + TARGET_PDB = measure_perf3.pdb + + +# ============================================================================= +# Link build statements for EXECUTABLE target measure_perf3 + + +############################################# +# Link the executable measure_perf3 + +build measure_perf3: CXX_EXECUTABLE_LINKER__measure_perf3_Debug CMakeFiles/measure_perf3.dir/Tests/smart_tests.cpp.o CMakeFiles/measure_perf3.dir/Prefix-Filter/Shift_op.cpp.o CMakeFiles/measure_perf3.dir/Prefix-Filter/min_pd256.cpp.o CMakeFiles/measure_perf3.dir/cuckoofilter/src/printutil.cc.o CMakeFiles/measure_perf3.dir/TC-Shortcut/tc-sym.cpp.o CMakeFiles/measure_perf3.dir/main-perf.cpp.o + FLAGS = -march=native -g + OBJECT_DIR = CMakeFiles/measure_perf3.dir + POST_BUILD = : + PRE_LINK = : + TARGET_COMPILE_PDB = CMakeFiles/measure_perf3.dir/ + TARGET_FILE = measure_perf3 + TARGET_PDB = measure_perf3.pdb + +# ============================================================================= +# Object build statements for EXECUTABLE target measure_fpp3 + + +############################################# +# Order-only phony target for measure_fpp3 + +build cmake_object_order_depends_target_measure_fpp3: phony || CMakeFiles/measure_fpp3.dir + +build CMakeFiles/measure_fpp3.dir/Tests/smart_tests.cpp.o: CXX_COMPILER__measure_fpp3_Debug /home/tomer/Github/Public-PF/Tests/smart_tests.cpp || cmake_object_order_depends_target_measure_fpp3 + DEP_FILE = CMakeFiles/measure_fpp3.dir/Tests/smart_tests.cpp.o.d + FLAGS = -march=native -g -O3 -g3 -std=gnu++17 + OBJECT_DIR = CMakeFiles/measure_fpp3.dir + OBJECT_FILE_DIR = CMakeFiles/measure_fpp3.dir/Tests + TARGET_COMPILE_PDB = CMakeFiles/measure_fpp3.dir/ + TARGET_PDB = measure_fpp3.pdb + +build CMakeFiles/measure_fpp3.dir/Prefix-Filter/Shift_op.cpp.o: CXX_COMPILER__measure_fpp3_Debug /home/tomer/Github/Public-PF/Prefix-Filter/Shift_op.cpp || cmake_object_order_depends_target_measure_fpp3 + DEP_FILE = CMakeFiles/measure_fpp3.dir/Prefix-Filter/Shift_op.cpp.o.d + FLAGS = -march=native -g -O3 -g3 -std=gnu++17 + OBJECT_DIR = CMakeFiles/measure_fpp3.dir + OBJECT_FILE_DIR = CMakeFiles/measure_fpp3.dir/Prefix-Filter + TARGET_COMPILE_PDB = CMakeFiles/measure_fpp3.dir/ + TARGET_PDB = measure_fpp3.pdb + +build CMakeFiles/measure_fpp3.dir/Prefix-Filter/min_pd256.cpp.o: CXX_COMPILER__measure_fpp3_Debug /home/tomer/Github/Public-PF/Prefix-Filter/min_pd256.cpp || cmake_object_order_depends_target_measure_fpp3 + DEP_FILE = CMakeFiles/measure_fpp3.dir/Prefix-Filter/min_pd256.cpp.o.d + FLAGS = -march=native -g -O3 -g3 -std=gnu++17 + OBJECT_DIR = CMakeFiles/measure_fpp3.dir + OBJECT_FILE_DIR = CMakeFiles/measure_fpp3.dir/Prefix-Filter + TARGET_COMPILE_PDB = CMakeFiles/measure_fpp3.dir/ + TARGET_PDB = measure_fpp3.pdb + +build CMakeFiles/measure_fpp3.dir/cuckoofilter/src/printutil.cc.o: CXX_COMPILER__measure_fpp3_Debug /home/tomer/Github/Public-PF/cuckoofilter/src/printutil.cc || cmake_object_order_depends_target_measure_fpp3 + DEP_FILE = CMakeFiles/measure_fpp3.dir/cuckoofilter/src/printutil.cc.o.d + FLAGS = -march=native -g -O3 -g3 -std=gnu++17 + OBJECT_DIR = CMakeFiles/measure_fpp3.dir + OBJECT_FILE_DIR = CMakeFiles/measure_fpp3.dir/cuckoofilter/src + TARGET_COMPILE_PDB = CMakeFiles/measure_fpp3.dir/ + TARGET_PDB = measure_fpp3.pdb + +build CMakeFiles/measure_fpp3.dir/TC-Shortcut/tc-sym.cpp.o: CXX_COMPILER__measure_fpp3_Debug /home/tomer/Github/Public-PF/TC-Shortcut/tc-sym.cpp || cmake_object_order_depends_target_measure_fpp3 + DEP_FILE = CMakeFiles/measure_fpp3.dir/TC-Shortcut/tc-sym.cpp.o.d + FLAGS = -march=native -g -O3 -g3 -std=gnu++17 + OBJECT_DIR = CMakeFiles/measure_fpp3.dir + OBJECT_FILE_DIR = CMakeFiles/measure_fpp3.dir/TC-Shortcut + TARGET_COMPILE_PDB = CMakeFiles/measure_fpp3.dir/ + TARGET_PDB = measure_fpp3.pdb + +build CMakeFiles/measure_fpp3.dir/main-fpp.cpp.o: CXX_COMPILER__measure_fpp3_Debug /home/tomer/Github/Public-PF/main-fpp.cpp || cmake_object_order_depends_target_measure_fpp3 + DEP_FILE = CMakeFiles/measure_fpp3.dir/main-fpp.cpp.o.d + FLAGS = -march=native -g -O3 -g3 -std=gnu++17 + OBJECT_DIR = CMakeFiles/measure_fpp3.dir + OBJECT_FILE_DIR = CMakeFiles/measure_fpp3.dir + TARGET_COMPILE_PDB = CMakeFiles/measure_fpp3.dir/ + TARGET_PDB = measure_fpp3.pdb + + +# ============================================================================= +# Link build statements for EXECUTABLE target measure_fpp3 + + +############################################# +# Link the executable measure_fpp3 + +build measure_fpp3: CXX_EXECUTABLE_LINKER__measure_fpp3_Debug CMakeFiles/measure_fpp3.dir/Tests/smart_tests.cpp.o CMakeFiles/measure_fpp3.dir/Prefix-Filter/Shift_op.cpp.o CMakeFiles/measure_fpp3.dir/Prefix-Filter/min_pd256.cpp.o CMakeFiles/measure_fpp3.dir/cuckoofilter/src/printutil.cc.o CMakeFiles/measure_fpp3.dir/TC-Shortcut/tc-sym.cpp.o CMakeFiles/measure_fpp3.dir/main-fpp.cpp.o + FLAGS = -march=native -g + OBJECT_DIR = CMakeFiles/measure_fpp3.dir + POST_BUILD = : + PRE_LINK = : + TARGET_COMPILE_PDB = CMakeFiles/measure_fpp3.dir/ + TARGET_FILE = measure_fpp3 + TARGET_PDB = measure_fpp3.pdb + +# ============================================================================= +# Object build statements for EXECUTABLE target measure_perf0 + + +############################################# +# Order-only phony target for measure_perf0 + +build cmake_object_order_depends_target_measure_perf0: phony || CMakeFiles/measure_perf0.dir + +build CMakeFiles/measure_perf0.dir/Tests/smart_tests.cpp.o: CXX_COMPILER__measure_perf0_Debug /home/tomer/Github/Public-PF/Tests/smart_tests.cpp || cmake_object_order_depends_target_measure_perf0 + DEP_FILE = CMakeFiles/measure_perf0.dir/Tests/smart_tests.cpp.o.d + FLAGS = -march=native -g -O0 -g3 -W -std=gnu++17 + OBJECT_DIR = CMakeFiles/measure_perf0.dir + OBJECT_FILE_DIR = CMakeFiles/measure_perf0.dir/Tests + TARGET_COMPILE_PDB = CMakeFiles/measure_perf0.dir/ + TARGET_PDB = measure_perf0.pdb + +build CMakeFiles/measure_perf0.dir/Prefix-Filter/Shift_op.cpp.o: CXX_COMPILER__measure_perf0_Debug /home/tomer/Github/Public-PF/Prefix-Filter/Shift_op.cpp || cmake_object_order_depends_target_measure_perf0 + DEP_FILE = CMakeFiles/measure_perf0.dir/Prefix-Filter/Shift_op.cpp.o.d + FLAGS = -march=native -g -O0 -g3 -W -std=gnu++17 + OBJECT_DIR = CMakeFiles/measure_perf0.dir + OBJECT_FILE_DIR = CMakeFiles/measure_perf0.dir/Prefix-Filter + TARGET_COMPILE_PDB = CMakeFiles/measure_perf0.dir/ + TARGET_PDB = measure_perf0.pdb + +build CMakeFiles/measure_perf0.dir/Prefix-Filter/min_pd256.cpp.o: CXX_COMPILER__measure_perf0_Debug /home/tomer/Github/Public-PF/Prefix-Filter/min_pd256.cpp || cmake_object_order_depends_target_measure_perf0 + DEP_FILE = CMakeFiles/measure_perf0.dir/Prefix-Filter/min_pd256.cpp.o.d + FLAGS = -march=native -g -O0 -g3 -W -std=gnu++17 + OBJECT_DIR = CMakeFiles/measure_perf0.dir + OBJECT_FILE_DIR = CMakeFiles/measure_perf0.dir/Prefix-Filter + TARGET_COMPILE_PDB = CMakeFiles/measure_perf0.dir/ + TARGET_PDB = measure_perf0.pdb + +build CMakeFiles/measure_perf0.dir/cuckoofilter/src/printutil.cc.o: CXX_COMPILER__measure_perf0_Debug /home/tomer/Github/Public-PF/cuckoofilter/src/printutil.cc || cmake_object_order_depends_target_measure_perf0 + DEP_FILE = CMakeFiles/measure_perf0.dir/cuckoofilter/src/printutil.cc.o.d + FLAGS = -march=native -g -O0 -g3 -W -std=gnu++17 + OBJECT_DIR = CMakeFiles/measure_perf0.dir + OBJECT_FILE_DIR = CMakeFiles/measure_perf0.dir/cuckoofilter/src + TARGET_COMPILE_PDB = CMakeFiles/measure_perf0.dir/ + TARGET_PDB = measure_perf0.pdb + +build CMakeFiles/measure_perf0.dir/TC-Shortcut/tc-sym.cpp.o: CXX_COMPILER__measure_perf0_Debug /home/tomer/Github/Public-PF/TC-Shortcut/tc-sym.cpp || cmake_object_order_depends_target_measure_perf0 + DEP_FILE = CMakeFiles/measure_perf0.dir/TC-Shortcut/tc-sym.cpp.o.d + FLAGS = -march=native -g -O0 -g3 -W -std=gnu++17 + OBJECT_DIR = CMakeFiles/measure_perf0.dir + OBJECT_FILE_DIR = CMakeFiles/measure_perf0.dir/TC-Shortcut + TARGET_COMPILE_PDB = CMakeFiles/measure_perf0.dir/ + TARGET_PDB = measure_perf0.pdb + +build CMakeFiles/measure_perf0.dir/main-perf.cpp.o: CXX_COMPILER__measure_perf0_Debug /home/tomer/Github/Public-PF/main-perf.cpp || cmake_object_order_depends_target_measure_perf0 + DEP_FILE = CMakeFiles/measure_perf0.dir/main-perf.cpp.o.d + FLAGS = -march=native -g -O0 -g3 -W -std=gnu++17 + OBJECT_DIR = CMakeFiles/measure_perf0.dir + OBJECT_FILE_DIR = CMakeFiles/measure_perf0.dir + TARGET_COMPILE_PDB = CMakeFiles/measure_perf0.dir/ + TARGET_PDB = measure_perf0.pdb + + +# ============================================================================= +# Link build statements for EXECUTABLE target measure_perf0 + + +############################################# +# Link the executable measure_perf0 + +build measure_perf0: CXX_EXECUTABLE_LINKER__measure_perf0_Debug CMakeFiles/measure_perf0.dir/Tests/smart_tests.cpp.o CMakeFiles/measure_perf0.dir/Prefix-Filter/Shift_op.cpp.o CMakeFiles/measure_perf0.dir/Prefix-Filter/min_pd256.cpp.o CMakeFiles/measure_perf0.dir/cuckoofilter/src/printutil.cc.o CMakeFiles/measure_perf0.dir/TC-Shortcut/tc-sym.cpp.o CMakeFiles/measure_perf0.dir/main-perf.cpp.o + FLAGS = -march=native -g + OBJECT_DIR = CMakeFiles/measure_perf0.dir + POST_BUILD = : + PRE_LINK = : + TARGET_COMPILE_PDB = CMakeFiles/measure_perf0.dir/ + TARGET_FILE = measure_perf0 + TARGET_PDB = measure_perf0.pdb + +# ============================================================================= +# Object build statements for EXECUTABLE target measure_fpp + + +############################################# +# Order-only phony target for measure_fpp + +build cmake_object_order_depends_target_measure_fpp: phony || CMakeFiles/measure_fpp.dir + +build CMakeFiles/measure_fpp.dir/Tests/smart_tests.cpp.o: CXX_COMPILER__measure_fpp_Debug /home/tomer/Github/Public-PF/Tests/smart_tests.cpp || cmake_object_order_depends_target_measure_fpp + DEP_FILE = CMakeFiles/measure_fpp.dir/Tests/smart_tests.cpp.o.d + FLAGS = -march=native -g -Ofast -DNDEBUG -std=gnu++17 + OBJECT_DIR = CMakeFiles/measure_fpp.dir + OBJECT_FILE_DIR = CMakeFiles/measure_fpp.dir/Tests + TARGET_COMPILE_PDB = CMakeFiles/measure_fpp.dir/ + TARGET_PDB = measure_fpp.pdb + +build CMakeFiles/measure_fpp.dir/Prefix-Filter/Shift_op.cpp.o: CXX_COMPILER__measure_fpp_Debug /home/tomer/Github/Public-PF/Prefix-Filter/Shift_op.cpp || cmake_object_order_depends_target_measure_fpp + DEP_FILE = CMakeFiles/measure_fpp.dir/Prefix-Filter/Shift_op.cpp.o.d + FLAGS = -march=native -g -Ofast -DNDEBUG -std=gnu++17 + OBJECT_DIR = CMakeFiles/measure_fpp.dir + OBJECT_FILE_DIR = CMakeFiles/measure_fpp.dir/Prefix-Filter + TARGET_COMPILE_PDB = CMakeFiles/measure_fpp.dir/ + TARGET_PDB = measure_fpp.pdb + +build CMakeFiles/measure_fpp.dir/Prefix-Filter/min_pd256.cpp.o: CXX_COMPILER__measure_fpp_Debug /home/tomer/Github/Public-PF/Prefix-Filter/min_pd256.cpp || cmake_object_order_depends_target_measure_fpp + DEP_FILE = CMakeFiles/measure_fpp.dir/Prefix-Filter/min_pd256.cpp.o.d + FLAGS = -march=native -g -Ofast -DNDEBUG -std=gnu++17 + OBJECT_DIR = CMakeFiles/measure_fpp.dir + OBJECT_FILE_DIR = CMakeFiles/measure_fpp.dir/Prefix-Filter + TARGET_COMPILE_PDB = CMakeFiles/measure_fpp.dir/ + TARGET_PDB = measure_fpp.pdb + +build CMakeFiles/measure_fpp.dir/cuckoofilter/src/printutil.cc.o: CXX_COMPILER__measure_fpp_Debug /home/tomer/Github/Public-PF/cuckoofilter/src/printutil.cc || cmake_object_order_depends_target_measure_fpp + DEP_FILE = CMakeFiles/measure_fpp.dir/cuckoofilter/src/printutil.cc.o.d + FLAGS = -march=native -g -Ofast -DNDEBUG -std=gnu++17 + OBJECT_DIR = CMakeFiles/measure_fpp.dir + OBJECT_FILE_DIR = CMakeFiles/measure_fpp.dir/cuckoofilter/src + TARGET_COMPILE_PDB = CMakeFiles/measure_fpp.dir/ + TARGET_PDB = measure_fpp.pdb + +build CMakeFiles/measure_fpp.dir/TC-Shortcut/tc-sym.cpp.o: CXX_COMPILER__measure_fpp_Debug /home/tomer/Github/Public-PF/TC-Shortcut/tc-sym.cpp || cmake_object_order_depends_target_measure_fpp + DEP_FILE = CMakeFiles/measure_fpp.dir/TC-Shortcut/tc-sym.cpp.o.d + FLAGS = -march=native -g -Ofast -DNDEBUG -std=gnu++17 + OBJECT_DIR = CMakeFiles/measure_fpp.dir + OBJECT_FILE_DIR = CMakeFiles/measure_fpp.dir/TC-Shortcut + TARGET_COMPILE_PDB = CMakeFiles/measure_fpp.dir/ + TARGET_PDB = measure_fpp.pdb + +build CMakeFiles/measure_fpp.dir/main-fpp.cpp.o: CXX_COMPILER__measure_fpp_Debug /home/tomer/Github/Public-PF/main-fpp.cpp || cmake_object_order_depends_target_measure_fpp + DEP_FILE = CMakeFiles/measure_fpp.dir/main-fpp.cpp.o.d + FLAGS = -march=native -g -Ofast -DNDEBUG -std=gnu++17 + OBJECT_DIR = CMakeFiles/measure_fpp.dir + OBJECT_FILE_DIR = CMakeFiles/measure_fpp.dir + TARGET_COMPILE_PDB = CMakeFiles/measure_fpp.dir/ + TARGET_PDB = measure_fpp.pdb + + +# ============================================================================= +# Link build statements for EXECUTABLE target measure_fpp + + +############################################# +# Link the executable measure_fpp + +build measure_fpp: CXX_EXECUTABLE_LINKER__measure_fpp_Debug CMakeFiles/measure_fpp.dir/Tests/smart_tests.cpp.o CMakeFiles/measure_fpp.dir/Prefix-Filter/Shift_op.cpp.o CMakeFiles/measure_fpp.dir/Prefix-Filter/min_pd256.cpp.o CMakeFiles/measure_fpp.dir/cuckoofilter/src/printutil.cc.o CMakeFiles/measure_fpp.dir/TC-Shortcut/tc-sym.cpp.o CMakeFiles/measure_fpp.dir/main-fpp.cpp.o + FLAGS = -march=native -g + OBJECT_DIR = CMakeFiles/measure_fpp.dir + POST_BUILD = : + PRE_LINK = : + TARGET_COMPILE_PDB = CMakeFiles/measure_fpp.dir/ + TARGET_FILE = measure_fpp + TARGET_PDB = measure_fpp.pdb + +# ============================================================================= +# Object build statements for EXECUTABLE target example0 + + +############################################# +# Order-only phony target for example0 + +build cmake_object_order_depends_target_example0: phony || CMakeFiles/example0.dir + +build CMakeFiles/example0.dir/Tests/smart_tests.cpp.o: CXX_COMPILER__example0_Debug /home/tomer/Github/Public-PF/Tests/smart_tests.cpp || cmake_object_order_depends_target_example0 + DEP_FILE = CMakeFiles/example0.dir/Tests/smart_tests.cpp.o.d + FLAGS = -march=native -g -O0 -g3 -W -std=gnu++17 + OBJECT_DIR = CMakeFiles/example0.dir + OBJECT_FILE_DIR = CMakeFiles/example0.dir/Tests + TARGET_COMPILE_PDB = CMakeFiles/example0.dir/ + TARGET_PDB = example0.pdb + +build CMakeFiles/example0.dir/Prefix-Filter/Shift_op.cpp.o: CXX_COMPILER__example0_Debug /home/tomer/Github/Public-PF/Prefix-Filter/Shift_op.cpp || cmake_object_order_depends_target_example0 + DEP_FILE = CMakeFiles/example0.dir/Prefix-Filter/Shift_op.cpp.o.d + FLAGS = -march=native -g -O0 -g3 -W -std=gnu++17 + OBJECT_DIR = CMakeFiles/example0.dir + OBJECT_FILE_DIR = CMakeFiles/example0.dir/Prefix-Filter + TARGET_COMPILE_PDB = CMakeFiles/example0.dir/ + TARGET_PDB = example0.pdb + +build CMakeFiles/example0.dir/Prefix-Filter/min_pd256.cpp.o: CXX_COMPILER__example0_Debug /home/tomer/Github/Public-PF/Prefix-Filter/min_pd256.cpp || cmake_object_order_depends_target_example0 + DEP_FILE = CMakeFiles/example0.dir/Prefix-Filter/min_pd256.cpp.o.d + FLAGS = -march=native -g -O0 -g3 -W -std=gnu++17 + OBJECT_DIR = CMakeFiles/example0.dir + OBJECT_FILE_DIR = CMakeFiles/example0.dir/Prefix-Filter + TARGET_COMPILE_PDB = CMakeFiles/example0.dir/ + TARGET_PDB = example0.pdb + +build CMakeFiles/example0.dir/cuckoofilter/src/printutil.cc.o: CXX_COMPILER__example0_Debug /home/tomer/Github/Public-PF/cuckoofilter/src/printutil.cc || cmake_object_order_depends_target_example0 + DEP_FILE = CMakeFiles/example0.dir/cuckoofilter/src/printutil.cc.o.d + FLAGS = -march=native -g -O0 -g3 -W -std=gnu++17 + OBJECT_DIR = CMakeFiles/example0.dir + OBJECT_FILE_DIR = CMakeFiles/example0.dir/cuckoofilter/src + TARGET_COMPILE_PDB = CMakeFiles/example0.dir/ + TARGET_PDB = example0.pdb + +build CMakeFiles/example0.dir/TC-Shortcut/tc-sym.cpp.o: CXX_COMPILER__example0_Debug /home/tomer/Github/Public-PF/TC-Shortcut/tc-sym.cpp || cmake_object_order_depends_target_example0 + DEP_FILE = CMakeFiles/example0.dir/TC-Shortcut/tc-sym.cpp.o.d + FLAGS = -march=native -g -O0 -g3 -W -std=gnu++17 + OBJECT_DIR = CMakeFiles/example0.dir + OBJECT_FILE_DIR = CMakeFiles/example0.dir/TC-Shortcut + TARGET_COMPILE_PDB = CMakeFiles/example0.dir/ + TARGET_PDB = example0.pdb + +build CMakeFiles/example0.dir/example.cpp.o: CXX_COMPILER__example0_Debug /home/tomer/Github/Public-PF/example.cpp || cmake_object_order_depends_target_example0 + DEP_FILE = CMakeFiles/example0.dir/example.cpp.o.d + FLAGS = -march=native -g -O0 -g3 -W -std=gnu++17 + OBJECT_DIR = CMakeFiles/example0.dir + OBJECT_FILE_DIR = CMakeFiles/example0.dir + TARGET_COMPILE_PDB = CMakeFiles/example0.dir/ + TARGET_PDB = example0.pdb + + +# ============================================================================= +# Link build statements for EXECUTABLE target example0 + + +############################################# +# Link the executable example0 + +build example0: CXX_EXECUTABLE_LINKER__example0_Debug CMakeFiles/example0.dir/Tests/smart_tests.cpp.o CMakeFiles/example0.dir/Prefix-Filter/Shift_op.cpp.o CMakeFiles/example0.dir/Prefix-Filter/min_pd256.cpp.o CMakeFiles/example0.dir/cuckoofilter/src/printutil.cc.o CMakeFiles/example0.dir/TC-Shortcut/tc-sym.cpp.o CMakeFiles/example0.dir/example.cpp.o + FLAGS = -march=native -g + OBJECT_DIR = CMakeFiles/example0.dir + POST_BUILD = : + PRE_LINK = : + TARGET_COMPILE_PDB = CMakeFiles/example0.dir/ + TARGET_FILE = example0 + TARGET_PDB = example0.pdb + +# ============================================================================= +# Target aliases. + +# ============================================================================= +# Folder targets. + +# ============================================================================= + +############################################# +# Folder: /home/tomer/Github/Public-PF/cmake-build-debug + +build all: phony example measure_fpp0 measure_perf measure_built3 measure_built0 measure_built measure_perf3 measure_fpp3 measure_perf0 measure_fpp example0 + +# ============================================================================= +# Built-in targets + + +############################################# +# Re-run CMake if any of its inputs changed. + +build build.ninja: RERUN_CMAKE | ../CMakeLists.txt /snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/CMakeCCompiler.cmake.in /snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/CMakeCCompilerABI.c /snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/CMakeCInformation.cmake /snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/CMakeCXXCompiler.cmake.in /snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/CMakeCXXCompilerABI.cpp /snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/CMakeCXXInformation.cmake /snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/CMakeCommonLanguageInclude.cmake /snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/CMakeCompilerIdDetection.cmake /snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/CMakeDetermineCCompiler.cmake /snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/CMakeDetermineCXXCompiler.cmake /snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/CMakeDetermineCompileFeatures.cmake /snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/CMakeDetermineCompiler.cmake /snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/CMakeDetermineCompilerABI.cmake /snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/CMakeDetermineCompilerId.cmake /snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/CMakeDetermineSystem.cmake /snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/CMakeFindBinUtils.cmake /snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/CMakeGenericSystem.cmake /snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/CMakeInitializeConfigs.cmake /snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/CMakeLanguageInformation.cmake /snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/CMakeParseImplicitIncludeInfo.cmake /snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/CMakeParseImplicitLinkInfo.cmake /snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/CMakeParseLibraryArchitecture.cmake /snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/CMakeSystem.cmake.in /snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/CMakeSystemSpecificInformation.cmake /snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/CMakeSystemSpecificInitialize.cmake /snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/CMakeTestCCompiler.cmake /snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/CMakeTestCXXCompiler.cmake /snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/CMakeTestCompilerCommon.cmake /snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/ADSP-DetermineCompiler.cmake /snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/ARMCC-DetermineCompiler.cmake /snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/ARMClang-DetermineCompiler.cmake /snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/AppleClang-DetermineCompiler.cmake /snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/Borland-DetermineCompiler.cmake /snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/Bruce-C-DetermineCompiler.cmake /snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/CMakeCommonCompilerMacros.cmake /snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/Clang-DetermineCompiler.cmake /snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/Clang-DetermineCompilerInternal.cmake /snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/Comeau-CXX-DetermineCompiler.cmake /snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/Compaq-C-DetermineCompiler.cmake /snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/Compaq-CXX-DetermineCompiler.cmake /snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/Cray-DetermineCompiler.cmake /snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/Embarcadero-DetermineCompiler.cmake /snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/Fujitsu-DetermineCompiler.cmake /snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/FujitsuClang-DetermineCompiler.cmake /snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/GHS-DetermineCompiler.cmake /snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/GNU-C-DetermineCompiler.cmake /snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/GNU-C.cmake /snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/GNU-CXX-DetermineCompiler.cmake /snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/GNU-CXX.cmake /snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/GNU-FindBinUtils.cmake /snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/GNU.cmake /snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/HP-C-DetermineCompiler.cmake /snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/HP-CXX-DetermineCompiler.cmake /snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/IAR-DetermineCompiler.cmake /snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/IBMCPP-C-DetermineVersionInternal.cmake /snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/IBMCPP-CXX-DetermineVersionInternal.cmake /snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/Intel-DetermineCompiler.cmake /snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/IntelLLVM-DetermineCompiler.cmake /snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/MSVC-DetermineCompiler.cmake /snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/NVHPC-DetermineCompiler.cmake /snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/NVIDIA-DetermineCompiler.cmake /snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/OpenWatcom-DetermineCompiler.cmake /snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/PGI-DetermineCompiler.cmake /snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/PathScale-DetermineCompiler.cmake /snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/ROCMClang-DetermineCompiler.cmake /snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/SCO-DetermineCompiler.cmake /snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/SDCC-C-DetermineCompiler.cmake /snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/SunPro-C-DetermineCompiler.cmake /snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/SunPro-CXX-DetermineCompiler.cmake /snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/TI-DetermineCompiler.cmake /snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/TinyCC-C-DetermineCompiler.cmake /snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/VisualAge-C-DetermineCompiler.cmake /snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/VisualAge-CXX-DetermineCompiler.cmake /snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/Watcom-DetermineCompiler.cmake /snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/XL-C-DetermineCompiler.cmake /snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/XL-CXX-DetermineCompiler.cmake /snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/XLClang-C-DetermineCompiler.cmake /snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/XLClang-CXX-DetermineCompiler.cmake /snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/zOS-C-DetermineCompiler.cmake /snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/zOS-CXX-DetermineCompiler.cmake /snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Internal/FeatureTesting.cmake /snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Platform/Linux-Determine-CXX.cmake /snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Platform/Linux-GNU-C.cmake /snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Platform/Linux-GNU-CXX.cmake /snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Platform/Linux-GNU.cmake /snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Platform/Linux.cmake /snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Platform/UnixPaths.cmake CMakeCache.txt CMakeFiles/3.21.1/CMakeCCompiler.cmake CMakeFiles/3.21.1/CMakeCXXCompiler.cmake CMakeFiles/3.21.1/CMakeSystem.cmake + pool = console + + +############################################# +# A missing CMake input file is not an error. + +build ../CMakeLists.txt /snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/CMakeCCompiler.cmake.in /snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/CMakeCCompilerABI.c /snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/CMakeCInformation.cmake /snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/CMakeCXXCompiler.cmake.in /snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/CMakeCXXCompilerABI.cpp /snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/CMakeCXXInformation.cmake /snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/CMakeCommonLanguageInclude.cmake /snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/CMakeCompilerIdDetection.cmake /snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/CMakeDetermineCCompiler.cmake /snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/CMakeDetermineCXXCompiler.cmake /snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/CMakeDetermineCompileFeatures.cmake /snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/CMakeDetermineCompiler.cmake /snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/CMakeDetermineCompilerABI.cmake /snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/CMakeDetermineCompilerId.cmake /snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/CMakeDetermineSystem.cmake /snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/CMakeFindBinUtils.cmake /snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/CMakeGenericSystem.cmake /snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/CMakeInitializeConfigs.cmake /snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/CMakeLanguageInformation.cmake /snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/CMakeParseImplicitIncludeInfo.cmake /snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/CMakeParseImplicitLinkInfo.cmake /snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/CMakeParseLibraryArchitecture.cmake /snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/CMakeSystem.cmake.in /snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/CMakeSystemSpecificInformation.cmake /snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/CMakeSystemSpecificInitialize.cmake /snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/CMakeTestCCompiler.cmake /snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/CMakeTestCXXCompiler.cmake /snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/CMakeTestCompilerCommon.cmake /snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/ADSP-DetermineCompiler.cmake /snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/ARMCC-DetermineCompiler.cmake /snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/ARMClang-DetermineCompiler.cmake /snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/AppleClang-DetermineCompiler.cmake /snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/Borland-DetermineCompiler.cmake /snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/Bruce-C-DetermineCompiler.cmake /snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/CMakeCommonCompilerMacros.cmake /snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/Clang-DetermineCompiler.cmake /snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/Clang-DetermineCompilerInternal.cmake /snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/Comeau-CXX-DetermineCompiler.cmake /snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/Compaq-C-DetermineCompiler.cmake /snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/Compaq-CXX-DetermineCompiler.cmake /snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/Cray-DetermineCompiler.cmake /snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/Embarcadero-DetermineCompiler.cmake /snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/Fujitsu-DetermineCompiler.cmake /snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/FujitsuClang-DetermineCompiler.cmake /snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/GHS-DetermineCompiler.cmake /snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/GNU-C-DetermineCompiler.cmake /snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/GNU-C.cmake /snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/GNU-CXX-DetermineCompiler.cmake /snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/GNU-CXX.cmake /snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/GNU-FindBinUtils.cmake /snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/GNU.cmake /snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/HP-C-DetermineCompiler.cmake /snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/HP-CXX-DetermineCompiler.cmake /snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/IAR-DetermineCompiler.cmake /snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/IBMCPP-C-DetermineVersionInternal.cmake /snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/IBMCPP-CXX-DetermineVersionInternal.cmake /snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/Intel-DetermineCompiler.cmake /snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/IntelLLVM-DetermineCompiler.cmake /snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/MSVC-DetermineCompiler.cmake /snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/NVHPC-DetermineCompiler.cmake /snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/NVIDIA-DetermineCompiler.cmake /snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/OpenWatcom-DetermineCompiler.cmake /snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/PGI-DetermineCompiler.cmake /snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/PathScale-DetermineCompiler.cmake /snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/ROCMClang-DetermineCompiler.cmake /snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/SCO-DetermineCompiler.cmake /snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/SDCC-C-DetermineCompiler.cmake /snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/SunPro-C-DetermineCompiler.cmake /snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/SunPro-CXX-DetermineCompiler.cmake /snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/TI-DetermineCompiler.cmake /snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/TinyCC-C-DetermineCompiler.cmake /snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/VisualAge-C-DetermineCompiler.cmake /snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/VisualAge-CXX-DetermineCompiler.cmake /snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/Watcom-DetermineCompiler.cmake /snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/XL-C-DetermineCompiler.cmake /snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/XL-CXX-DetermineCompiler.cmake /snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/XLClang-C-DetermineCompiler.cmake /snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/XLClang-CXX-DetermineCompiler.cmake /snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/zOS-C-DetermineCompiler.cmake /snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/zOS-CXX-DetermineCompiler.cmake /snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Internal/FeatureTesting.cmake /snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Platform/Linux-Determine-CXX.cmake /snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Platform/Linux-GNU-C.cmake /snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Platform/Linux-GNU-CXX.cmake /snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Platform/Linux-GNU.cmake /snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Platform/Linux.cmake /snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Platform/UnixPaths.cmake CMakeCache.txt CMakeFiles/3.21.1/CMakeCCompiler.cmake CMakeFiles/3.21.1/CMakeCXXCompiler.cmake CMakeFiles/3.21.1/CMakeSystem.cmake: phony + + +############################################# +# Clean all the built files. + +build clean: CLEAN + + +############################################# +# Print all primary targets available. + +build help: HELP + + +############################################# +# Make the all target the default. + +default all diff --git a/cmake-build-debug/cmake_install.cmake b/cmake-build-debug/cmake_install.cmake new file mode 100644 index 0000000..9d5b0cd --- /dev/null +++ b/cmake-build-debug/cmake_install.cmake @@ -0,0 +1,54 @@ +# Install script for directory: /home/tomer/Github/Public-PF + +# Set the install prefix +if(NOT DEFINED CMAKE_INSTALL_PREFIX) + set(CMAKE_INSTALL_PREFIX "/usr/local") +endif() +string(REGEX REPLACE "/$" "" CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}") + +# Set the install configuration name. +if(NOT DEFINED CMAKE_INSTALL_CONFIG_NAME) + if(BUILD_TYPE) + string(REGEX REPLACE "^[^A-Za-z0-9_]+" "" + CMAKE_INSTALL_CONFIG_NAME "${BUILD_TYPE}") + else() + set(CMAKE_INSTALL_CONFIG_NAME "Debug") + endif() + message(STATUS "Install configuration: \"${CMAKE_INSTALL_CONFIG_NAME}\"") +endif() + +# Set the component getting installed. +if(NOT CMAKE_INSTALL_COMPONENT) + if(COMPONENT) + message(STATUS "Install component: \"${COMPONENT}\"") + set(CMAKE_INSTALL_COMPONENT "${COMPONENT}") + else() + set(CMAKE_INSTALL_COMPONENT) + endif() +endif() + +# Install shared libraries without execute permission? +if(NOT DEFINED CMAKE_INSTALL_SO_NO_EXE) + set(CMAKE_INSTALL_SO_NO_EXE "1") +endif() + +# Is this installation the result of a crosscompile? +if(NOT DEFINED CMAKE_CROSSCOMPILING) + set(CMAKE_CROSSCOMPILING "FALSE") +endif() + +# Set default install directory permissions. +if(NOT DEFINED CMAKE_OBJDUMP) + set(CMAKE_OBJDUMP "/usr/bin/objdump") +endif() + +if(CMAKE_INSTALL_COMPONENT) + set(CMAKE_INSTALL_MANIFEST "install_manifest_${CMAKE_INSTALL_COMPONENT}.txt") +else() + set(CMAKE_INSTALL_MANIFEST "install_manifest.txt") +endif() + +string(REPLACE ";" "\n" CMAKE_INSTALL_MANIFEST_CONTENT + "${CMAKE_INSTALL_MANIFEST_FILES}") +file(WRITE "/home/tomer/Github/Public-PF/cmake-build-debug/${CMAKE_INSTALL_MANIFEST}" + "${CMAKE_INSTALL_MANIFEST_CONTENT}") diff --git a/cuckoofilter/.clang-format b/cuckoofilter/.clang-format new file mode 100644 index 0000000..d2b4723 --- /dev/null +++ b/cuckoofilter/.clang-format @@ -0,0 +1,95 @@ +--- +Language: Cpp +# BasedOnStyle: Google +AccessModifierOffset: -1 +AlignAfterOpenBracket: Align +AlignConsecutiveAssignments: false +AlignConsecutiveDeclarations: false +AlignEscapedNewlinesLeft: true +AlignOperands: true +AlignTrailingComments: true +AllowAllParametersOfDeclarationOnNextLine: true +AllowShortBlocksOnASingleLine: false +AllowShortCaseLabelsOnASingleLine: false +AllowShortFunctionsOnASingleLine: All +AllowShortIfStatementsOnASingleLine: true +AllowShortLoopsOnASingleLine: true +AlwaysBreakAfterDefinitionReturnType: None +AlwaysBreakAfterReturnType: None +AlwaysBreakBeforeMultilineStrings: true +AlwaysBreakTemplateDeclarations: true +BinPackArguments: true +BinPackParameters: true +BraceWrapping: + AfterClass: false + AfterControlStatement: false + AfterEnum: false + AfterFunction: false + AfterNamespace: false + AfterObjCDeclaration: false + AfterStruct: false + AfterUnion: false + BeforeCatch: false + BeforeElse: false + IndentBraces: false +BreakBeforeBinaryOperators: None +BreakBeforeBraces: Attach +BreakBeforeTernaryOperators: true +BreakConstructorInitializersBeforeComma: false +BreakAfterJavaFieldAnnotations: false +BreakStringLiterals: true +ColumnLimit: 80 +CommentPragmas: '^ IWYU pragma:' +ConstructorInitializerAllOnOneLineOrOnePerLine: true +ConstructorInitializerIndentWidth: 4 +ContinuationIndentWidth: 4 +Cpp11BracedListStyle: true +DerivePointerAlignment: false +DisableFormat: false +ExperimentalAutoDetectBinPacking: false +ForEachMacros: [ foreach, Q_FOREACH, BOOST_FOREACH ] +IncludeCategories: + - Regex: '^<.*\.h>' + Priority: 1 + - Regex: '^<.*' + Priority: 2 + - Regex: '.*' + Priority: 3 +IncludeIsMainRegex: '([-_](test|unittest))?$' +IndentCaseLabels: true +IndentWidth: 2 +IndentWrappedFunctionNames: false +JavaScriptQuotes: Leave +JavaScriptWrapImports: true +KeepEmptyLinesAtTheStartOfBlocks: false +MacroBlockBegin: '' +MacroBlockEnd: '' +MaxEmptyLinesToKeep: 1 +NamespaceIndentation: None +ObjCBlockIndentWidth: 2 +ObjCSpaceAfterProperty: false +ObjCSpaceBeforeProtocolList: false +PenaltyBreakBeforeFirstCallParameter: 1 +PenaltyBreakComment: 300 +PenaltyBreakFirstLessLess: 120 +PenaltyBreakString: 1000 +PenaltyExcessCharacter: 1000000 +PenaltyReturnTypeOnItsOwnLine: 200 +PointerAlignment: Right +ReflowComments: true +SortIncludes: true +SpaceAfterCStyleCast: false +SpaceBeforeAssignmentOperators: true +SpaceBeforeParens: ControlStatements +SpaceInEmptyParentheses: false +SpacesBeforeTrailingComments: 2 +SpacesInAngles: false +SpacesInContainerLiterals: true +SpacesInCStyleCastParentheses: false +SpacesInParentheses: false +SpacesInSquareBrackets: false +Standard: Auto +TabWidth: 8 +UseTab: Never +... + diff --git a/cuckoofilter/.gitignore b/cuckoofilter/.gitignore new file mode 100644 index 0000000..9ddb24d --- /dev/null +++ b/cuckoofilter/.gitignore @@ -0,0 +1,11 @@ +#* +#*# +*# +*.*# +*.class +*.dSYM +*.la +*.lo +*.o +*.so +test diff --git a/cuckoofilter/LICENSE b/cuckoofilter/LICENSE new file mode 100644 index 0000000..60f8991 --- /dev/null +++ b/cuckoofilter/LICENSE @@ -0,0 +1,13 @@ +Copyright (C) 2013, Carnegie Mellon University and Intel Corporation + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. diff --git a/cuckoofilter/Makefile b/cuckoofilter/Makefile new file mode 100644 index 0000000..9da574b --- /dev/null +++ b/cuckoofilter/Makefile @@ -0,0 +1,43 @@ +CC = g++ +AR = ar +PREFIX=/usr/local + +# Uncomment one of the following to switch between debug and opt mode +#OPT = -O3 -DNDEBUG +OPT = -g -ggdb + +CFLAGS += --std=c++11 -fno-strict-aliasing -Wall -c -I. -I./include -I/usr/include/ -I./src/ $(OPT) + +LDFLAGS+= -Wall -lpthread -lssl -lcrypto + +LIBOBJECTS = \ + ./src/hashutil.o \ + +HEADERS = $(wildcard src/*.h) +ALIB = libcuckoofilter.a + +TEST = test + +all: $(TEST) + +clean: + rm -f $(TEST) */*.o + +test: example/test.o $(LIBOBJECTS) + $(CC) example/test.o $(LIBOBJECTS) $(LDFLAGS) -o $@ + +%.o: %.cc ${HEADERS} Makefile + $(CC) $(CFLAGS) $< -o $@ + +$(ALIB): $(LIBOBJECTS) + $(AR) rcs $@ $(LIBOBJECTS) + +.PHONY: install +install: $(ALIB) + install -D -m 0755 $(HEADERS) -t $(DESTDIR)$(PREFIX)/include/cuckoofilter + install -D -m 0755 $< -t $(DESTDIR)$(PREFIX)/lib + +.PHONY: uninstall +uninstall: + rm -f $(DESTDIR)$(PREFIX)/lib/$(ALIB) + rm -rf $(DESTDIR)$(PREFIX)/include/cuckoofilter diff --git a/cuckoofilter/README.md b/cuckoofilter/README.md new file mode 100644 index 0000000..fb52068 --- /dev/null +++ b/cuckoofilter/README.md @@ -0,0 +1,93 @@ +Cuckoo Filter +============ + +Overview +-------- +Cuckoo filter is a Bloom filter replacement for approximated set-membership queries. While Bloom filters are well-known space-efficient data structures to serve queries like "if item x is in a set?", they do not support deletion. Their variances to enable deletion (like counting Bloom filters) usually require much more space. + +Cuckoo filters provide the flexibility to add and remove items dynamically. A cuckoo filter is based on cuckoo hashing (and therefore named as cuckoo filter). It is essentially a cuckoo hash table storing each key's fingerprint. Cuckoo hash tables can be highly compact, thus a cuckoo filter could use less space than conventional Bloom filters, for applications that require low false positive rates (< 3%). + +For details about the algorithm and citations please use: + +["Cuckoo Filter: Practically Better Than Bloom"](http://www.cs.cmu.edu/~binfan/papers/conext14_cuckoofilter.pdf) in proceedings of ACM CoNEXT 2014 by Bin Fan, Dave Andersen and Michael Kaminsky + + +API +-------- +A cuckoo filter supports following operations: + +* `Add(item)`: insert an item to the filter +* `Contain(item)`: return if item is already in the filter. Note that this method may return false positive results like Bloom filters +* `Delete(item)`: delete the given item from the filter. Note that to use this method, it must be ensured that this item is in the filter (e.g., based on records on external storage); otherwise, a false item may be deleted. +* `Size()`: return the total number of items currently in the filter +* `SizeInBytes()`: return the filter size in bytes + +Here is a simple example in C++ for the basic usage of cuckoo filter. +More examples can be found in `example/` directory. + +```cpp +// Create a cuckoo filter where each item is of type size_t and +// use 12 bits for each item, with capacity of total_items +CuckooFilter filter(total_items); +// Insert item 12 to this cuckoo filter +filter.Add(12); +// Check if previously inserted items are in the filter +assert(filter.Contain(12) == cuckoofilter::Ok); +``` + +Repository structure +-------------------- +* `src/`: the C++ header and implementation of cuckoo filter +* `example/test.cc`: an example of using cuckoo filter +* `benchmarks/`: Some benchmarks of speed, space used, and false positive rate + + +Build +------- +This libray depends on openssl library. Note that on MacOS 10.12, the header +files of openssl are not available by default. It may require to install openssl +and pass the path to `lib` and `include` directories to gcc, for example: + +```bash +$ brew install openssl +# Replace 1.0.2j with the actual version of the openssl installed +$ export LDFLAGS="-L/usr/local/Cellar/openssl/1.0.2j/lib" +$ export CFLAGS="-I/usr/local/Cellar/openssl/1.0.2j/include" +``` + +To build the example (`example/test.cc`): +```bash +$ make test +``` + +To build the benchmarks: +```bash +$ cd benchmarks +$ make +``` + +Install +------- +To install the cuckoofilter library: +```bash +$ make install +``` +By default, the header files will be placed in `/usr/local/include/cuckoofilter` +and the static library at `/usr/local/lib/cuckoofilter.a`. + + +Contributing +------------ +Contributions via GitHub pull requests are welcome. Please keep the code style guided by +[Google C++ style](https://google.github.io/styleguide/cppguide.html). One can use +[clang-format](http://clang.llvm.org/docs/ClangFormat.html) with our provided +[`.clang-format`](https://github.com/efficient/cuckoofilter/blob/master/.clang-format) +in this repository to enforce the style. + + + +Authors +------- +- Bin Fan +- David G. Andersen +- Michael Kaminsky diff --git a/cuckoofilter/benchmarks/Makefile b/cuckoofilter/benchmarks/Makefile new file mode 100644 index 0000000..32bfc90 --- /dev/null +++ b/cuckoofilter/benchmarks/Makefile @@ -0,0 +1,23 @@ +# Uncomment one of the following to switch between debug and opt mode +OPT = -O3 -DNDEBUG +#OPT = -g -ggdb + +CXXFLAGS += -fno-strict-aliasing -Wall -std=c++11 -I. -I../src/ $(OPT) -march=core-avx2 + +LDFLAGS+= -Wall -lpthread -lssl -lcrypto + +HEADERS = $(wildcard ../src/*.h) *.h + +SRC = ../src/hashutil.cc + +.PHONY: all + +BINS = conext-table3.exe conext-figure5.exe bulk-insert-and-query.exe + +all: $(BINS) + +clean: + /bin/rm -f $(BINS) + +%.exe: %.cc ${HEADERS} ${SRC} Makefile + $(CXX) $(CXXFLAGS) $< -o $@ $(SRC) $(LDFLAGS) diff --git a/cuckoofilter/benchmarks/bulk-insert-and-query.cc b/cuckoofilter/benchmarks/bulk-insert-and-query.cc new file mode 100644 index 0000000..c507a23 --- /dev/null +++ b/cuckoofilter/benchmarks/bulk-insert-and-query.cc @@ -0,0 +1,255 @@ +// This benchmark reports on the bulk insert and bulk query rates. It is invoked as: +// +// ./bulk-insert-and-query.exe 158000 +// +// That invocation will test each probabilistic membership container type with 158000 +// randomly generated items. It tests bulk Add() from empty to full and Contain() on +// filters with varying rates of expected success. For instance, at 75%, three out of +// every four values passed to Contain() were earlier Add()ed. +// +// Example output: +// +// $ for num in 55 75 85; do echo $num:; /usr/bin/time -f 'time: %e seconds' ./bulk-insert-and-query.exe ${num}00000; echo; done +// 55: +// Million Find Find Find Find Find optimal wasted +// adds/sec 0% 25% 50% 75% 100% ε bits/item bits/item space +// Cuckoo12 23.78 37.24 35.04 37.17 37.35 36.35 0.131% 18.30 9.58 91.1% +// SemiSort13 11.63 17.55 17.08 17.14 17.54 22.32 0.064% 18.30 10.62 72.4% +// Cuckoo8 35.31 49.32 50.24 49.98 48.32 50.49 2.044% 12.20 5.61 117.4% +// SemiSort9 13.99 22.23 22.78 22.13 23.16 24.06 1.207% 12.20 6.37 91.5% +// Cuckoo16 27.06 36.94 37.12 35.31 36.81 35.10 0.009% 24.40 13.46 81.4% +// SemiSort17 10.37 15.70 15.84 15.78 15.55 15.93 0.004% 24.40 14.72 65.8% +// SimdBlock8 74.22 72.34 74.23 74.34 74.69 74.32 0.508% 12.20 7.62 60.1% +// time: 14.34 seconds +// +// 75: +// Million Find Find Find Find Find optimal wasted +// adds/sec 0% 25% 50% 75% 100% ε bits/item bits/item space +// Cuckoo12 15.61 37.24 37.23 37.34 37.15 37.36 0.173% 13.42 9.18 46.2% +// SemiSort13 8.77 17.11 15.70 17.34 17.73 18.86 0.087% 13.42 10.17 31.9% +// Cuckoo8 23.46 48.81 48.14 39.48 49.28 49.65 2.806% 8.95 5.16 73.6% +// SemiSort9 11.14 23.98 20.80 23.37 24.35 21.41 1.428% 8.95 6.13 46.0% +// Cuckoo16 15.08 36.64 36.75 36.83 36.59 36.74 0.011% 17.90 13.11 36.5% +// SemiSort17 8.02 15.63 15.66 15.87 15.67 15.88 0.006% 17.90 14.02 27.6% +// SimdBlock8 73.26 74.41 74.28 70.86 72.02 70.69 2.071% 8.95 5.59 60.0% +// time: 18.06 seconds +// +// 85: +// Million Find Find Find Find Find optimal wasted +// adds/sec 0% 25% 50% 75% 100% ε bits/item bits/item space +// Cuckoo12 22.74 32.49 32.69 32.58 32.85 32.71 0.102% 23.69 9.94 138.3% +// SemiSort13 9.97 13.16 13.15 13.54 16.01 19.58 0.056% 23.69 10.80 119.4% +// Cuckoo8 30.67 36.86 36.79 37.09 36.97 36.87 1.581% 15.79 5.98 163.9% +// SemiSort9 10.96 15.49 15.37 15.40 15.18 15.63 1.047% 15.79 6.58 140.1% +// Cuckoo16 27.84 33.74 33.72 33.69 33.75 33.62 0.007% 31.58 13.80 128.8% +// SemiSort17 9.51 12.83 12.80 12.64 12.86 12.50 0.004% 31.58 14.65 115.6% +// SimdBlock8 54.84 58.37 59.73 59.13 60.11 60.12 0.144% 15.79 9.44 67.3% +// time: 19.43 seconds +// + +#include +#include +#include +#include +#include + +#include "cuckoofilter.h" +#include "random.h" +#include "simd-block.h" +#include "timing.h" + +using namespace std; + +using namespace cuckoofilter; + +// The number of items sampled when determining the lookup performance +const size_t SAMPLE_SIZE = 1000 * 1000; + +// The statistics gathered for each table type: +struct Statistics { + double adds_per_nano; + map finds_per_nano; // The key is the percent of queries that were expected + // to be positive + double false_positive_probabilty; + double bits_per_item; +}; + +// Output for the first row of the table of results. type_width is the maximum number of +// characters of the description of any table type, and find_percent_count is the number +// of different lookup statistics gathered for each table. This function assumes the +// lookup expected positive probabiilties are evenly distributed, with the first being 0% +// and the last 100%. +string StatisticsTableHeader(int type_width, int find_percent_count) { + ostringstream os; + + os << string(type_width, ' '); + os << setw(12) << right << "Million"; + for (int i = 0; i < find_percent_count; ++i) { + os << setw(8) << "Find"; + } + os << setw(8) << "" << setw(11) << "" << setw(11) + << "optimal" << setw(8) << "wasted" << endl; + + os << string(type_width, ' '); + os << setw(12) << right << "adds/sec"; + for (int i = 0; i < find_percent_count; ++i) { + os << setw(7) + << static_cast(100 * i / static_cast(find_percent_count - 1)) << '%'; + } + os << setw(9) << "ε" << setw(11) << "bits/item" << setw(11) + << "bits/item" << setw(8) << "space"; + return os.str(); +} + +// Overloading the usual operator<< as used in "std::cout << foo", but for Statistics +template +basic_ostream& operator<<( + basic_ostream& os, const Statistics& stats) { + constexpr double NANOS_PER_MILLION = 1000; + os << fixed << setprecision(2) << setw(12) << right + << stats.adds_per_nano * NANOS_PER_MILLION; + for (const auto& fps : stats.finds_per_nano) { + os << setw(8) << fps.second * NANOS_PER_MILLION; + } + const auto minbits = log2(1 / stats.false_positive_probabilty); + os << setw(7) << setprecision(3) << stats.false_positive_probabilty * 100 << '%' + << setw(11) << setprecision(2) << stats.bits_per_item << setw(11) << minbits + << setw(7) << setprecision(1) << 100 * (stats.bits_per_item / minbits - 1) << '%'; + + return os; +} + +template +struct FilterAPI {}; + +template class TableType> +struct FilterAPI> { + using Table = CuckooFilter; + static Table ConstructFromAddCount(size_t add_count) { return Table(add_count); } + static void Add(uint64_t key, Table * table) { + if (0 != table->Add(key)) { + throw logic_error("The filter is too small to hold all of the elements"); + } + } + static bool Contain(uint64_t key, const Table * table) { + return (0 == table->Contain(key)); + } +}; + +template <> +struct FilterAPI> { + using Table = SimdBlockFilter<>; + static Table ConstructFromAddCount(size_t add_count) { + Table ans(ceil(log2(add_count * 8.0 / CHAR_BIT))); + return ans; + } + static void Add(uint64_t key, Table* table) { + table->Add(key); + } + static bool Contain(uint64_t key, const Table * table) { + return table->Find(key); + } +}; + +template +Statistics FilterBenchmark( + size_t add_count, const vector& to_add, const vector& to_lookup) { + if (add_count > to_add.size()) { + throw out_of_range("to_add must contain at least add_count values"); + } + + if (SAMPLE_SIZE > to_lookup.size()) { + throw out_of_range("to_lookup must contain at least SAMPLE_SIZE values"); + } + + Table filter = FilterAPI
::ConstructFromAddCount(add_count); + Statistics result; + + // Add values until failure or until we run out of values to add: + auto start_time = NowNanos(); + for (size_t added = 0; added < add_count; ++added) { + FilterAPI
::Add(to_add[added], &filter); + } + result.adds_per_nano = add_count / static_cast(NowNanos() - start_time); + result.bits_per_item = static_cast(CHAR_BIT * filter.SizeInBytes()) / add_count; + + size_t found_count = 0; + for (const double found_probability : {0.0, 0.25, 0.50, 0.75, 1.00}) { + const auto to_lookup_mixed = MixIn(&to_lookup[0], &to_lookup[SAMPLE_SIZE], &to_add[0], + &to_add[add_count], found_probability); + const auto start_time = NowNanos(); + for (const auto v : to_lookup_mixed) { + found_count += FilterAPI
::Contain(v, &filter); + } + const auto lookup_time = NowNanos() - start_time; + result.finds_per_nano[100 * found_probability] = + SAMPLE_SIZE / static_cast(lookup_time); + if (0.0 == found_probability) { + result.false_positive_probabilty = + found_count / static_cast(to_lookup_mixed.size()); + } + } + return result; +} + +int main(int argc, char * argv[]) { + if (argc != 2) { + cerr << "Usage: " << argv[0] << " $NUMBER" << endl; + return 1; + } + stringstream input_string(argv[1]); + size_t add_count; + input_string >> add_count; + if (input_string.fail()) { + cerr << "Invalid number: " << argv[1]; + return 2; + } + + const vector to_add = GenerateRandom64(add_count); + const vector to_lookup = GenerateRandom64(SAMPLE_SIZE); + + constexpr int NAME_WIDTH = 13; + + cout << StatisticsTableHeader(NAME_WIDTH, 5) << endl; + + auto cf = FilterBenchmark< + CuckooFilter>( + add_count, to_add, to_lookup); + + cout << setw(NAME_WIDTH) << "Cuckoo12" << cf << endl; + + cf = FilterBenchmark< + CuckooFilter>( + add_count, to_add, to_lookup); + + cout << setw(NAME_WIDTH) << "SemiSort13" << cf << endl; + + cf = FilterBenchmark< + CuckooFilter>( + add_count, to_add, to_lookup); + + cout << setw(NAME_WIDTH) << "Cuckoo8" << cf << endl; + + cf = FilterBenchmark< + CuckooFilter>( + add_count, to_add, to_lookup); + + cout << setw(NAME_WIDTH) << "SemiSort9" << cf << endl; + + cf = FilterBenchmark< + CuckooFilter>( + add_count, to_add, to_lookup); + + cout << setw(NAME_WIDTH) << "Cuckoo16" << cf << endl; + + cf = FilterBenchmark< + CuckooFilter>( + add_count, to_add, to_lookup); + + cout << setw(NAME_WIDTH) << "SemiSort17" << cf << endl; + + cf = FilterBenchmark>(add_count, to_add, to_lookup); + + cout << setw(NAME_WIDTH) << "SimdBlock8" << cf << endl; + +} diff --git a/cuckoofilter/benchmarks/conext-figure5.cc b/cuckoofilter/benchmarks/conext-figure5.cc new file mode 100644 index 0000000..2f759de --- /dev/null +++ b/cuckoofilter/benchmarks/conext-figure5.cc @@ -0,0 +1,84 @@ +// This benchmark reproduces the CoNEXT 2014 results found in "Figure 5: Lookup +// performance when a filter achieves its capacity." It takes about two minutes to run on +// an Intel(R) Core(TM) i7-4790 CPU @ 3.60GHz. +// +// Results: +// fraction of queries on existing items/lookup throughput (million OPS) +// CF ss-CF +// 0.00% 24.79 9.37 +// 25.00% 24.65 9.57 +// 50.00% 24.84 9.57 +// 75.00% 24.86 9.62 +// 100.00% 24.89 9.96 + +#include +#include +#include + +#include "cuckoofilter.h" +#include "random.h" +#include "timing.h" + +using namespace std; + +using namespace cuckoofilter; + +// The number of items sampled when determining the lookup performance +const size_t SAMPLE_SIZE = 1000 * 1000; + +// The time (in seconds) to lookup SAMPLE_SIZE keys in which 0%, 25%, 50%, 75%, and 100% +// of the keys looked up are found. +template +array CuckooBenchmark( + size_t add_count, const vector& to_add, const vector& to_lookup) { + Table cuckoo(add_count); + array result; + + // Add values until failure or until we run out of values to add: + size_t added = 0; + while (added < to_add.size() && 0 == cuckoo.Add(to_add[added])) ++added; + + // A value to track to prevent the compiler from optimizing out all lookups: + size_t found_count = 0; + for (const double found_percent : {0.0, 0.25, 0.50, 0.75, 1.00}) { + const auto to_lookup_mixed = MixIn(&to_lookup[0], &to_lookup[SAMPLE_SIZE], &to_add[0], + &to_add[added], found_percent); + auto start_time = NowNanos(); + for (const auto v : to_lookup_mixed) found_count += (0 == cuckoo.Contain(v)); + auto lookup_time = NowNanos() - start_time; + result[found_percent * 4] = lookup_time / (1000.0 * 1000.0 * 1000.0); + } + if (6 * SAMPLE_SIZE == found_count) exit(1); + return result; +} + +int main() { + // Number of distinct values, used only for the constructor of CuckooFilter, which does + // not allow the caller to specify the space usage directly. The actual number of + // distinct items inserted depends on how many fit until an insert failure occurs. + size_t add_count = 127.78 * 1000 * 1000; + + // Overestimate add_count so we don't run out of random data: + const size_t max_add_count = 2 * add_count; + const vector to_add = GenerateRandom64(max_add_count); + const vector to_lookup = GenerateRandom64(SAMPLE_SIZE); + + // Calculate metrics: + const auto cf = CuckooBenchmark< + CuckooFilter>( + add_count, to_add, to_lookup); + const auto sscf = CuckooBenchmark< + CuckooFilter>( + add_count, to_add, to_lookup); + + cout << "fraction of queries on existing items/lookup throughput (million OPS) " + << endl; + cout << setw(10) << "" + << " " << setw(10) << right << "CF" << setw(10) << right << "ss-CF" << endl; + for (const double found_percent : {0.0, 0.25, 0.50, 0.75, 1.00}) { + cout << fixed << setprecision(2) << setw(10) << right << 100 * found_percent << "%"; + cout << setw(10) << right << (SAMPLE_SIZE / cf[found_percent * 4]) / (1000 * 1000); + cout << setw(10) << right << (SAMPLE_SIZE / sscf[found_percent * 4]) / (1000 * 1000); + cout << endl; + } +} diff --git a/cuckoofilter/benchmarks/conext-table3.cc b/cuckoofilter/benchmarks/conext-table3.cc new file mode 100644 index 0000000..800770e --- /dev/null +++ b/cuckoofilter/benchmarks/conext-table3.cc @@ -0,0 +1,91 @@ +// This benchmark reproduces the CoNEXT 2014 results found in "Table 3: Space efficiency +// and construction speed." It takes about two minutes to run on an Intel(R) Core(TM) +// i7-4790 CPU @ 3.60GHz. +// +// Results: +// +// metrics CF ss-CF +// # of items (million) 127.82 127.90 +// bits per item 12.60 12.59 +// false positive rate 0.18% 0.09% +// constr. speed (million keys/sec) 5.86 4.10 + +#include +#include +#include + +#include "cuckoofilter.h" +#include "random.h" +#include "timing.h" + +using namespace std; + +using namespace cuckoofilter; + +// The number of items sampled when determining the false positive rate +const size_t FPR_SAMPLE_SIZE = 1000 * 1000; + +struct Metrics { + double add_count; // # of items (million) + double space; // bits per item + double fpr; // false positive rate (%) + double speed; // const. speed (million keys/sec) +}; + +template +Metrics CuckooBenchmark(size_t add_count, const vector& input) { + Table cuckoo(add_count); + auto start_time = NowNanos(); + + // Insert until failure: + size_t inserted = 0; + while (inserted < input.size() && 0 == cuckoo.Add(input[inserted])) ++inserted; + + auto constr_time = NowNanos() - start_time; + + // Count false positives: + size_t false_positive_count = 0; + size_t absent = 0; + for (; inserted + absent < input.size() && absent < FPR_SAMPLE_SIZE; ++absent) { + false_positive_count += (0 == cuckoo.Contain(input[inserted + absent])); + } + + // Calculate metrics: + const auto time = constr_time / static_cast(1000 * 1000 * 1000); + Metrics result; + result.add_count = static_cast(inserted) / (1000 * 1000); + result.space = static_cast(CHAR_BIT * cuckoo.SizeInBytes()) / inserted; + result.fpr = (100.0 * false_positive_count) / absent; + result.speed = (inserted / time) / (1000 * 1000); + return result; +} + +int main() { + // Number of distinct values, used only for the constructor of CuckooFilter, which does + // not allow the caller to specify the space usage directly. The actual number of + // distinct items inserted depends on how many fit until an insert failure occurs. + const size_t add_count = 127.78 * 1000 * 1000; + + // Overestimate add_count so we don't run out of random data: + const size_t max_add_count = 2 * add_count; + const vector input = GenerateRandom64(max_add_count + FPR_SAMPLE_SIZE); + + // Calculate metrics: + const auto cf = CuckooBenchmark< + CuckooFilter>( + add_count, input); + const auto sscf = CuckooBenchmark< + CuckooFilter>( + add_count, input); + + cout << setw(35) << left << "metrics " << setw(10) << right << "CF" << setw(10) + << "ss-CF" << endl + << fixed << setprecision(2) << setw(35) << left << "# of items (million) " + << setw(10) << right << cf.add_count << setw(10) << sscf.add_count << endl + << setw(35) << left << "bits per item " << setw(10) << right << cf.space + << setw(10) << sscf.space << endl + << setw(35) << left << "false positive rate " << setw(9) << right << cf.fpr << "%" + << setw(9) << sscf.fpr << "%" << endl + << setw(35) << left << "constr. speed (million keys/sec) " << setw(10) << right + << cf.speed << setw(10) << sscf.speed << endl; +} diff --git a/cuckoofilter/benchmarks/random.h b/cuckoofilter/benchmarks/random.h new file mode 100644 index 0000000..66a93eb --- /dev/null +++ b/cuckoofilter/benchmarks/random.h @@ -0,0 +1,45 @@ +// Generating random data + +#pragma once + +#include +#include +#include +#include +#include +#include + + +::std::vector<::std::uint64_t> GenerateRandom64(::std::size_t count) { + ::std::vector<::std::uint64_t> result(count); + ::std::random_device random; + // To generate random keys to lookup, this uses ::std::random_device which is slower but + // stronger than some other pseudo-random alternatives. The reason is that some of these + // alternatives (like libstdc++'s ::std::default_random, which is a linear congruential + // generator) behave non-randomly under some hash families like Dietzfelbinger's + // multiply-shift. + auto genrand = [&random]() { + return random() + (static_cast<::std::uint64_t>(random()) << 32); + }; + ::std::generate(result.begin(), result.end(), ::std::ref(genrand)); + return result; +} + +// Using two pointer ranges for sequences x and y, create a vector clone of x but for +// y_probability y's mixed in. +template +::std::vector MixIn(const T* x_begin, const T* x_end, const T* y_begin, const T* y_end, + double y_probability) { + const size_t x_size = x_end - x_begin, y_size = y_end - y_begin; + if (y_size > (1ull << 32)) throw ::std::length_error("y is too long"); + ::std::vector result(x_begin, x_end); + ::std::random_device random; + auto genrand = [&random, y_size]() { + return (static_cast(random()) * y_size) >> 32; + }; + for (size_t i = 0; i < y_probability * x_size; ++i) { + result[i] = *(y_begin + genrand()); + } + ::std::shuffle(result.begin(), result.end(), random); + return result; +} diff --git a/cuckoofilter/benchmarks/timing.h b/cuckoofilter/benchmarks/timing.h new file mode 100644 index 0000000..6155070 --- /dev/null +++ b/cuckoofilter/benchmarks/timing.h @@ -0,0 +1,12 @@ +// Timers for use in benchmarking. + +#pragma once + +#include +#include + +::std::uint64_t NowNanos() { + return ::std::chrono::duration_cast<::std::chrono::nanoseconds>( + ::std::chrono::steady_clock::now().time_since_epoch()) + .count(); +} diff --git a/cuckoofilter/example/test.cc b/cuckoofilter/example/test.cc new file mode 100644 index 0000000..df869ec --- /dev/null +++ b/cuckoofilter/example/test.cc @@ -0,0 +1,52 @@ +#include "cuckoofilter.h" + +#include +#include + +#include +#include + +using cuckoofilter::CuckooFilter; + +int main(int argc, char **argv) { + size_t total_items = 1000000; + + // Create a cuckoo filter where each item is of type size_t and + // use 12 bits for each item: + // CuckooFilter filter(total_items); + // To enable semi-sorting, define the storage of cuckoo filter to be + // PackedTable, accepting keys of size_t type and making 13 bits + // for each key: + // CuckooFilter filter(total_items); + CuckooFilter filter(total_items); + + // Insert items to this cuckoo filter + size_t num_inserted = 0; + for (size_t i = 0; i < total_items; i++, num_inserted++) { + if (filter.Add(i) != cuckoofilter::Ok) { + break; + } + } + + // Check if previously inserted items are in the filter, expected + // true for all items + for (size_t i = 0; i < num_inserted; i++) { + assert(filter.Contain(i) == cuckoofilter::Ok); + } + + // Check non-existing items, a few false positives expected + size_t total_queries = 0; + size_t false_queries = 0; + for (size_t i = total_items; i < 2 * total_items; i++) { + if (filter.Contain(i) == cuckoofilter::Ok) { + false_queries++; + } + total_queries++; + } + + // Output the measured false positive rate + std::cout << "false positive rate is " + << 100.0 * false_queries / total_queries << "%\n"; + + return 0; +} diff --git a/cuckoofilter/src/bitsutil.h b/cuckoofilter/src/bitsutil.h new file mode 100644 index 0000000..75be5a1 --- /dev/null +++ b/cuckoofilter/src/bitsutil.h @@ -0,0 +1,35 @@ +#ifndef CUCKOO_FILTER_BITS_H_ +#define CUCKOO_FILTER_BITS_H_ + +namespace cuckoofilter { + +// inspired from +// http://www-graphics.stanford.edu/~seander/bithacks.html#ZeroInWord +#define haszero4(x) (((x)-0x1111ULL) & (~(x)) & 0x8888ULL) +#define hasvalue4(x, n) (haszero4((x) ^ (0x1111ULL * (n)))) + +#define haszero8(x) (((x)-0x01010101ULL) & (~(x)) & 0x80808080ULL) +#define hasvalue8(x, n) (haszero8((x) ^ (0x01010101ULL * (n)))) + +#define haszero12(x) (((x)-0x001001001001ULL) & (~(x)) & 0x800800800800ULL) +#define hasvalue12(x, n) (haszero12((x) ^ (0x001001001001ULL * (n)))) + +#define haszero16(x) \ + (((x)-0x0001000100010001ULL) & (~(x)) & 0x8000800080008000ULL) +#define hasvalue16(x, n) (haszero16((x) ^ (0x0001000100010001ULL * (n)))) + +inline uint64_t upperpower2(uint64_t x) { + x--; + x |= x >> 1; + x |= x >> 2; + x |= x >> 4; + x |= x >> 8; + x |= x >> 16; + x |= x >> 32; + x++; + return x; +} + +} // namespace cuckoofilter + +#endif // CUCKOO_FILTER_BITS_H diff --git a/cuckoofilter/src/cuckoofilter.h b/cuckoofilter/src/cuckoofilter.h new file mode 100644 index 0000000..dce1eb5 --- /dev/null +++ b/cuckoofilter/src/cuckoofilter.h @@ -0,0 +1,267 @@ +#ifndef CUCKOO_FILTER_CUCKOO_FILTER_H_ +#define CUCKOO_FILTER_CUCKOO_FILTER_H_ + +#include +#include + +#include "debug.h" +#include "hashutil.h" +#include "packedtable.h" +#include "printutil.h" +#include "singletable.h" + +namespace cuckoofilter { +// status returned by a cuckoo filter operation +enum Status { + Ok = 0, + NotFound = 1, + NotEnoughSpace = 2, + NotSupported = 3, +}; + +// maximum number of cuckoo kicks before claiming failure +const size_t kMaxCuckooCount = 500; + +// A cuckoo filter class exposes a Bloomier filter interface, +// providing methods of Add, Delete, Contain. It takes three +// template parameters: +// ItemType: the type of item you want to insert +// bits_per_item: how many bits each item is hashed into +// TableType: the storage of table, SingleTable by default, and +// PackedTable to enable semi-sorting +template class TableType = SingleTable, + typename HashFamily = TwoIndependentMultiplyShift> +class CuckooFilter { + // Storage of items + TableType *table_; + + // Number of items stored + size_t num_items_; + + typedef struct { + size_t index; + uint32_t tag; + bool used; + } VictimCache; + + VictimCache victim_; + + HashFamily hasher_; + + inline size_t IndexHash(uint32_t hv) const { + // table_->num_buckets is always a power of two, so modulo can be replaced + // with + // bitwise-and: + return hv & (table_->NumBuckets() - 1); + } + + inline uint32_t TagHash(uint32_t hv) const { + uint32_t tag; + tag = hv & ((1ULL << bits_per_item) - 1); + tag += (tag == 0); + return tag; + } + + inline void GenerateIndexTagHash(const ItemType &item, size_t *index, + uint32_t *tag) const { + const uint64_t hash = hasher_(item); + // const uint64_t hash = item; + *index = IndexHash(hash >> 32); + *tag = TagHash(hash); + } + + inline size_t AltIndex(const size_t index, const uint32_t tag) const { + // NOTE(binfan): originally we use: + // index ^ HashUtil::BobHash((const void*) (&tag), 4)) & table_->INDEXMASK; + // now doing a quick-n-dirty way: + // 0x5bd1e995 is the hash constant from MurmurHash2 + return IndexHash((uint32_t)(index ^ (tag * 0x5bd1e995))); + // uint64_t temp_index = (index ^ (tag * 0xc4ceb9fe1a85ec53L)); + // return IndexHash(temp_index); + } + + Status AddImpl(const size_t i, const uint32_t tag); + + // load factor is the fraction of occupancy + double LoadFactor() const { return 1.0 * Size() / table_->SizeInTags(); } + + double BitsPerItem() const { return 8.0 * table_->SizeInBytes() / Size(); } + + public: + explicit CuckooFilter(const size_t max_num_keys) + : num_items_(0), victim_(), hasher_() { + size_t assoc = 4; + size_t num_buckets = + upperpower2(std::max(1, max_num_keys / assoc)); + double frac = (double)max_num_keys / num_buckets / assoc; + if (frac > 0.96) { + std::cout << "CF might fail." << std::endl; + // num_buckets <<= 1; + } + victim_.used = false; + table_ = new TableType(num_buckets); + // std::cout << "load is: " << frac << std::endl; + // std::cout << "Here!" << std::endl; + // std::cout << __LINE__ << std::endl; + } + + ~CuckooFilter() { + // std::cout << "CF-??? " << "Byte size is: \t" << SizeInBytes() << + // std::endl; + delete table_; + } + + // Add an item to the filter. + Status Add(const ItemType &item); + + // Report if the item is inserted, with false positive rate. + Status Contain(const ItemType &item) const; + + // Delete an key from the filter + Status Delete(const ItemType &item); + + /* methods for providing stats */ + // summary infomation + std::string Info() const; + + // number of current inserted items; + size_t Size() const { return num_items_; } + + // size of the filter in bytes. + size_t SizeInBytes() const { return table_->SizeInBytes(); } + + size_t get_cap() const { return num_items_; } +}; + +template class TableType, typename HashFamily> +Status CuckooFilter::Add( + const ItemType &item) { + size_t i; + uint32_t tag; + + if (victim_.used) { + #ifndef NDEBUG + std::cout << std::string(80, '=') << std::endl; + if (Contain(item) == Ok) { + std::cout << "Item was already in the set." << std::endl; + } else { + std::cout << "Item was not already in the set." << std::endl; + } + std::cout << "Info: "; + std::cout << std::string(80, '=') << std::endl; + #endif //! NDEBUG + std::cout << Info(); + + return NotEnoughSpace; + } + + GenerateIndexTagHash(item, &i, &tag); + return AddImpl(i, tag); +} + +template class TableType, typename HashFamily> +Status CuckooFilter::AddImpl( + const size_t i, const uint32_t tag) { + size_t curindex = i; + uint32_t curtag = tag; + uint32_t oldtag; + + for (uint32_t count = 0; count < kMaxCuckooCount; count++) { + bool kickout = count > 0; + oldtag = 0; + if (table_->InsertTagToBucket(curindex, curtag, kickout, oldtag)) { + num_items_++; + return Ok; + } + if (kickout) { + curtag = oldtag; + } + curindex = AltIndex(curindex, curtag); + } + + victim_.index = curindex; + victim_.tag = curtag; + victim_.used = true; + return Ok; +} + +template class TableType, typename HashFamily> +Status CuckooFilter::Contain( + const ItemType &key) const { + bool found = false; + size_t i1, i2; + uint32_t tag; + + GenerateIndexTagHash(key, &i1, &tag); + i2 = AltIndex(i1, tag); + + assert(i1 == AltIndex(i2, tag)); + + found = victim_.used && (tag == victim_.tag) && + (i1 == victim_.index || i2 == victim_.index); + + if (found || table_->FindTagInBuckets(i1, i2, tag)) { + return Ok; + } else { + return NotFound; + } +} + +template class TableType, typename HashFamily> +Status CuckooFilter::Delete( + const ItemType &key) { + size_t i1, i2; + uint32_t tag; + + GenerateIndexTagHash(key, &i1, &tag); + i2 = AltIndex(i1, tag); + + if (table_->DeleteTagFromBucket(i1, tag)) { + num_items_--; + goto TryEliminateVictim; + } else if (table_->DeleteTagFromBucket(i2, tag)) { + num_items_--; + goto TryEliminateVictim; + } else if (victim_.used && tag == victim_.tag && + (i1 == victim_.index || i2 == victim_.index)) { + // num_items_--; + victim_.used = false; + return Ok; + } else { + return NotFound; + } +TryEliminateVictim: + if (victim_.used) { + victim_.used = false; + size_t i = victim_.index; + uint32_t tag = victim_.tag; + AddImpl(i, tag); + } + return Ok; +} + +template class TableType, typename HashFamily> +std::string CuckooFilter::Info() + const { + std::stringstream ss; + ss << "CuckooFilter Status:\n" + << "\t\t" << table_->Info() << "\n" + << "\t\tKeys stored: " << Size() << "\n" + << "\t\tLoad factor: " << LoadFactor() << "\n" + << "\t\tHashtable size: " << (table_->SizeInBytes() >> 10) << " KB\n"; + if (Size() > 0) { + ss << "\t\tbit/key: " << BitsPerItem() << "\n"; + } else { + ss << "\t\tbit/key: N/A\n"; + } + return ss.str(); +} + +} // namespace cuckoofilter +#endif // CUCKOO_FILTER_CUCKOO_FILTER_H_ diff --git a/cuckoofilter/src/cuckoofilter_stable.h b/cuckoofilter/src/cuckoofilter_stable.h new file mode 100644 index 0000000..c677c76 --- /dev/null +++ b/cuckoofilter/src/cuckoofilter_stable.h @@ -0,0 +1,271 @@ +#ifndef CUCKOO_FILTER_STABLE_CUCKOO_FILTER_STABLE_H_ +#define CUCKOO_FILTER_STABLE_CUCKOO_FILTER_STABLE_H_ + +#include +#include + +#include "debug.h" +#include "hashutil.h" +#include "packedtable.h" +#include "printutil.h" +#include "singletable.h" + +namespace cuckoofilter { + +inline uint32_t reduce(uint64_t hash, uint32_t n) { + // http://lemire.me/blog/2016/06/27/a-fast-alternative-to-the-modulo-reduction/ + return (uint32_t)(((hash & 0xffffffffL) * n) >> 32); +} + +// A stable cuckoo filter class exposes a Bloomier filter interface, +// providing methods of Add, Delete, Contain. It takes three +// template parameters: +// ItemType: the type of item you want to insert +// bits_per_item: how many bits each item is hashed into +// TableType: the storage of table, SingleTable by default, and +// PackedTable to enable semi-sorting +template class TableType = SingleTable, + typename HashFamily = TwoIndependentMultiplyShift> +class CuckooFilterStable { + // Storage of items + TableType *table_; + size_t bucketCount; + + // Number of items stored + size_t num_items_; + + typedef struct { + size_t index; + uint32_t tag; + bool used; + } VictimCache; + + VictimCache victim_; + + HashFamily hasher_; + + inline size_t IndexHash(uint32_t hv) const { + size_t x = reduce(hv, bucketCount); + return x; + } + + inline uint32_t TagHash(uint32_t hv) const { + uint32_t tag; + tag = hv & ((1ULL << bits_per_item) - 1); + tag += (tag == 0); + return tag; + } + + inline void GenerateIndexTagHash(const ItemType &item, size_t *index, + uint32_t *tag) const { + const uint64_t hash = hasher_(item); + // const uint64_t hash = item; + // *index = IndexHash(hash >> 32); Mistake! + *index = IndexHash((uint32_t)hash); + *tag = TagHash(hash >> 32); + } + + inline size_t AltIndex(const size_t index, const uint32_t tag) const { + // NOTE(binfan): originally we use: + // index ^ HashUtil::BobHash((const void*) (&tag), 4)) & table_->INDEXMASK; + // now doing a quick-n-dirty way: + // 0x5bd1e995 is the hash constant from MurmurHash2 + // return IndexHash((uint32_t)(index ^ (tag * 0x5bd1e995))); + + uint64_t hash = tag * 0xc4ceb9fe1a85ec53L; + // we don't use xor; instead, we ensure bucketCount is even, + // and bucket2 = bucketCount - bucket - y, + // and if negative add the bucketCount, + // where y is 1..bucketCount - 1 and odd - + // that way, bucket2 is never the original bucket, + // and running this twice will give the original bucket, as needed + uint32_t r = (reduce(hash, bucketCount >> 1) << 1) + 1; + + // this is needed because the bucket size is not always 2^n: + int32_t b2 = bucketCount - index - r; + if (b2 < 0) { + b2 += bucketCount; + } + + // I tried the following alternatives (also combinations), + // but performance is the same: + + // uint32_t b2 = bucketCount - index - r; + // b2 += bucketCount * (b2 >> 31); + + // int32_t b2 = bucketCount - index - r; + // b2 += bucketCount & (b2 >> 31); + + // int32_t b2 = r - index; + // b2 += bucketCount & (b2 >> 31); + + return b2; + } + + Status AddImpl(const size_t i, const uint32_t tag); + + // load factor is the fraction of occupancy + double LoadFactor() const { return 1.0 * Size() / table_->SizeInTags(); } + + double BitsPerItem() const { return 8.0 * table_->SizeInBytes() / Size(); } + + public: + size_t get_cap() const { return num_items_; } + + double get_effective_load() const { + return LoadFactor(); + } + + explicit CuckooFilterStable(const size_t max_num_keys) + : num_items_(0), victim_(), hasher_() { + size_t assoc = 4; + // bucket count needs to be even + constexpr double load = .94; + bucketCount = (10 + max_num_keys / load / assoc) / 2 * 2; + // std::cout << "bucketCount: " << bucketCount << std::endl; + victim_.used = false; + table_ = new TableType(bucketCount); + } + + ~CuckooFilterStable() { delete table_; } + + // Add an item to the filter. + Status Add(const ItemType &item); + + // Report if the item is inserted, with false positive rate. + Status Contain(const ItemType &item) const; + + // Delete an key from the filter + Status Delete(const ItemType &item); + + /* methods for providing stats */ + // summary infomation + std::string Info() const; + + // number of current inserted items; + size_t Size() const { return num_items_; } + + // size of the filter in bytes. + size_t SizeInBytes() const { return table_->SizeInBytes(); } +}; + +template class TableType, typename HashFamily> +Status CuckooFilterStable::Add( + const ItemType &item) { + size_t i; + uint32_t tag; + + if (victim_.used) { + return NotEnoughSpace; + } + + GenerateIndexTagHash(item, &i, &tag); + return AddImpl(i, tag); +} + +template class TableType, typename HashFamily> +Status CuckooFilterStable::AddImpl(const size_t i, + const uint32_t tag) { + size_t curindex = i; + uint32_t curtag = tag; + uint32_t oldtag; + + for (uint32_t count = 0; count < kMaxCuckooCount; count++) { + bool kickout = count > 0; + oldtag = 0; + if (table_->InsertTagToBucket(curindex, curtag, kickout, oldtag)) { + num_items_++; + return Ok; + } + if (kickout) { + curtag = oldtag; + } + curindex = AltIndex(curindex, curtag); + } + + victim_.index = curindex; + victim_.tag = curtag; + victim_.used = true; + return Ok; +} + +template class TableType, typename HashFamily> +Status CuckooFilterStable::Contain(const ItemType &key) const { + bool found = false; + size_t i1, i2; + uint32_t tag; + + GenerateIndexTagHash(key, &i1, &tag); + i2 = AltIndex(i1, tag); + + assert(i1 == AltIndex(i2, tag)); + + found = victim_.used && (tag == victim_.tag) && + (i1 == victim_.index || i2 == victim_.index); + + if (found || table_->FindTagInBuckets(i1, i2, tag)) { + return Ok; + } else { + return NotFound; + } +} + +template class TableType, typename HashFamily> +Status CuckooFilterStable::Delete(const ItemType &key) { + size_t i1, i2; + uint32_t tag; + + GenerateIndexTagHash(key, &i1, &tag); + i2 = AltIndex(i1, tag); + + if (table_->DeleteTagFromBucket(i1, tag)) { + num_items_--; + goto TryEliminateVictim; + } else if (table_->DeleteTagFromBucket(i2, tag)) { + num_items_--; + goto TryEliminateVictim; + } else if (victim_.used && tag == victim_.tag && + (i1 == victim_.index || i2 == victim_.index)) { + // num_items_--; + victim_.used = false; + return Ok; + } else { + return NotFound; + } +TryEliminateVictim: + if (victim_.used) { + victim_.used = false; + size_t i = victim_.index; + uint32_t tag = victim_.tag; + AddImpl(i, tag); + } + return Ok; +} + +template class TableType, typename HashFamily> +std::string CuckooFilterStable::Info() const { + std::stringstream ss; + ss << "CuckooFilterStable Status:\n" + << "\t\t" << table_->Info() << "\n" + << "\t\tKeys stored: " << Size() << "\n" + << "\t\tLoad factor: " << LoadFactor() << "\n" + << "\t\tHashtable size: " << (table_->SizeInBytes() >> 10) << " KB\n"; + if (Size() > 0) { + ss << "\t\tbit/key: " << BitsPerItem() << "\n"; + } else { + ss << "\t\tbit/key: N/A\n"; + } + return ss.str(); +} +} // namespace cuckoofilter +#endif // CUCKOO_FILTER_STABLE_CUCKOO_FILTER_STABLE_H_ diff --git a/cuckoofilter/src/debug.h b/cuckoofilter/src/debug.h new file mode 100644 index 0000000..519554b --- /dev/null +++ b/cuckoofilter/src/debug.h @@ -0,0 +1,54 @@ +#ifndef CUCKOO_FILTER_DEBUG_H_ +#define CUCKOO_FILTER_DEBUG_H_ + +#include // for perror + +namespace cuckoofilter { + +#ifndef DEBUG +//#define DEBUG +#endif + +#define debug_level (DEBUG_ERRS | DEBUG_CUCKOO) + +#ifdef DEBUG +// extern unsigned int debug; + +/* + * a combination of DEBUG_ERRS, DEBUG_CUCKOO, DEBUG_TABLE, DEBUG_ENCODE + */ + +#define DPRINTF(level, ...) \ + do { \ + if (debug_level & (level)) fprintf(stdout, ##__VA_ARGS__); \ + } while (0) +#define DEBUG_PERROR(errmsg) \ + do { \ + if (debug_level & DEBUG_ERRS) perror(errmsg); \ + } while (0) + +#else + +#define DPRINTF(level, ...) +#define DEBUG_PERROR(level, ...) + +#endif + +/* + * The format of this should be obvious. Please add some explanatory + * text if you add a debugging value. This text will show up in + * -d list + */ +#define DEBUG_NONE 0x00 // DBTEXT: No debugging +#define DEBUG_ERRS 0x01 // DBTEXT: Verbose error reporting +#define DEBUG_CUCKOO 0x02 // DBTEXT: Messages for cuckoo hashing +#define DEBUG_TABLE 0x04 // DBTEXT: Messages for table operations +#define DEBUG_ENCODE 0x08 // DBTEXT: Messages for encoding + +#define DEBUG_ALL 0xffffffff + +// int set_debug(char *arg); /* Returns 0 on success, -1 on failure */ + +} // namespace cuckoofilter + +#endif // CUCKOO_FILTER_DEBUG_H_ diff --git a/cuckoofilter/src/hashutil.cc b/cuckoofilter/src/hashutil.cc new file mode 100644 index 0000000..4fb84c5 --- /dev/null +++ b/cuckoofilter/src/hashutil.cc @@ -0,0 +1,782 @@ +// Pulled from lookup3.c by Bob Jenkins +#include "hashutil.h" + +#define rot(x, k) (((x) << (k)) | ((x) >> (32 - (k)))) +#define mix(a, b, c) \ + { \ + a -= c; \ + a ^= rot(c, 4); \ + c += b; \ + b -= a; \ + b ^= rot(a, 6); \ + a += c; \ + c -= b; \ + c ^= rot(b, 8); \ + b += a; \ + a -= c; \ + a ^= rot(c, 16); \ + c += b; \ + b -= a; \ + b ^= rot(a, 19); \ + a += c; \ + c -= b; \ + c ^= rot(b, 4); \ + b += a; \ + } + +#define final(a, b, c) \ + { \ + c ^= b; \ + c -= rot(b, 14); \ + a ^= c; \ + a -= rot(c, 11); \ + b ^= a; \ + b -= rot(a, 25); \ + c ^= b; \ + c -= rot(b, 16); \ + a ^= c; \ + a -= rot(c, 4); \ + b ^= a; \ + b -= rot(a, 14); \ + c ^= b; \ + c -= rot(b, 24); \ + } +// Assuming little endian +#define HASH_LITTLE_ENDIAN 1 + +#define get16bits(d) (*((const uint16_t *)(d))) + +namespace cuckoofilter { +/* + hashlittle() -- hash a variable-length key into a 32-bit value + k : the key (the unaligned variable-length array of bytes) + length : the length of the key, counting by bytes + initval : can be any 4-byte value + Returns a 32-bit value. Every bit of the key affects every bit of + the return value. Two keys differing by one or two bits will have + totally different hash values. + + The best hash table sizes are powers of 2. There is no need to do + mod a prime (mod is sooo slow!). If you need less than 32 bits, + use a bitmask. For example, if you need only 10 bits, do + h = (h & hashmask(10)); + In which case, the hash table should have hashsize(10) elements. + + If you are hashing n strings (uint8_t **)k, do it like this: + for (i=0, h=0; i 12) { + a += k[0]; + b += k[1]; + c += k[2]; + mix(a, b, c); + length -= 12; + k += 3; + } + +/*----------------------------- handle the last (probably partial) block */ +/* + * "k[2]&0xffffff" actually reads beyond the end of the string, but + * then masks off the part it's not allowed to read. Because the + * string is aligned, the masked-off tail is in the same word as the + * rest of the string. Every machine with memory protection I've seen + * does it on word boundaries, so is OK with this. But VALGRIND will + * still catch it and complain. The masking trick does make the hash + * noticably faster for short strings (like English words). + */ +#ifndef VALGRIND + + switch (length) { + case 12: + c += k[2]; + b += k[1]; + a += k[0]; + break; + case 11: + c += k[2] & 0xffffff; + b += k[1]; + a += k[0]; + break; + case 10: + c += k[2] & 0xffff; + b += k[1]; + a += k[0]; + break; + case 9: + c += k[2] & 0xff; + b += k[1]; + a += k[0]; + break; + case 8: + b += k[1]; + a += k[0]; + break; + case 7: + b += k[1] & 0xffffff; + a += k[0]; + break; + case 6: + b += k[1] & 0xffff; + a += k[0]; + break; + case 5: + b += k[1] & 0xff; + a += k[0]; + break; + case 4: + a += k[0]; + break; + case 3: + a += k[0] & 0xffffff; + break; + case 2: + a += k[0] & 0xffff; + break; + case 1: + a += k[0] & 0xff; + break; + case 0: + return c; /* zero length strings require no mixing */ + } + +#else /* make valgrind happy */ + + const u_int8_t *k8; + k8 = (const u_int8_t *)k; + switch (length) { + case 12: + c += k[2]; + b += k[1]; + a += k[0]; + break; + case 11: + c += ((uint32_t)k8[10]) << 16; /* fall through */ + case 10: + c += ((uint32_t)k8[9]) << 8; /* fall through */ + case 9: + c += k8[8]; /* fall through */ + case 8: + b += k[1]; + a += k[0]; + break; + case 7: + b += ((uint32_t)k8[6]) << 16; /* fall through */ + case 6: + b += ((uint32_t)k8[5]) << 8; /* fall through */ + case 5: + b += k8[4]; /* fall through */ + case 4: + a += k[0]; + break; + case 3: + a += ((uint32_t)k8[2]) << 16; /* fall through */ + case 2: + a += ((uint32_t)k8[1]) << 8; /* fall through */ + case 1: + a += k8[0]; + break; + case 0: + return c; + } + +#endif /* !valgrind */ + + } else if (HASH_LITTLE_ENDIAN && ((u.i & 0x1) == 0)) { + const u_int16_t *k = (const u_int16_t *)buf; /* read 16-bit chunks */ + const u_int8_t *k8; + + /*--------------- all but last block: aligned reads and different mixing */ + while (length > 12) { + a += k[0] + (((uint32_t)k[1]) << 16); + b += k[2] + (((uint32_t)k[3]) << 16); + c += k[4] + (((uint32_t)k[5]) << 16); + mix(a, b, c); + length -= 12; + k += 6; + } + + /*----------------------------- handle the last (probably partial) block */ + k8 = (const u_int8_t *)k; + switch (length) { + case 12: + c += k[4] + (((uint32_t)k[5]) << 16); + b += k[2] + (((uint32_t)k[3]) << 16); + a += k[0] + (((uint32_t)k[1]) << 16); + break; + case 11: + c += ((uint32_t)k8[10]) << 16; /* fall through */ + case 10: + c += k[4]; + b += k[2] + (((uint32_t)k[3]) << 16); + a += k[0] + (((uint32_t)k[1]) << 16); + break; + case 9: + c += k8[8]; /* fall through */ + case 8: + b += k[2] + (((uint32_t)k[3]) << 16); + a += k[0] + (((uint32_t)k[1]) << 16); + break; + case 7: + b += ((uint32_t)k8[6]) << 16; /* fall through */ + case 6: + b += k[2]; + a += k[0] + (((uint32_t)k[1]) << 16); + break; + case 5: + b += k8[4]; /* fall through */ + case 4: + a += k[0] + (((uint32_t)k[1]) << 16); + break; + case 3: + a += ((uint32_t)k8[2]) << 16; /* fall through */ + case 2: + a += k[0]; + break; + case 1: + a += k8[0]; + break; + case 0: + return c; /* zero length requires no mixing */ + } + + } else { /* need to read the key one byte at a time */ + const u_int8_t *k = (const u_int8_t *)buf; + + /*--------------- all but the last block: affect some 32 bits of (a,b,c) */ + while (length > 12) { + a += k[0]; + a += ((uint32_t)k[1]) << 8; + a += ((uint32_t)k[2]) << 16; + a += ((uint32_t)k[3]) << 24; + b += k[4]; + b += ((uint32_t)k[5]) << 8; + b += ((uint32_t)k[6]) << 16; + b += ((uint32_t)k[7]) << 24; + c += k[8]; + c += ((uint32_t)k[9]) << 8; + c += ((uint32_t)k[10]) << 16; + c += ((uint32_t)k[11]) << 24; + mix(a, b, c); + length -= 12; + k += 12; + } + + /*-------------------------------- last block: affect all 32 bits of (c) */ + switch (length) /* all the case statements fall through */ + { + case 12: + c += ((uint32_t)k[11]) << 24; + case 11: + c += ((uint32_t)k[10]) << 16; + case 10: + c += ((uint32_t)k[9]) << 8; + case 9: + c += k[8]; + case 8: + b += ((uint32_t)k[7]) << 24; + case 7: + b += ((uint32_t)k[6]) << 16; + case 6: + b += ((uint32_t)k[5]) << 8; + case 5: + b += k[4]; + case 4: + a += ((uint32_t)k[3]) << 24; + case 3: + a += ((uint32_t)k[2]) << 16; + case 2: + a += ((uint32_t)k[1]) << 8; + case 1: + a += k[0]; + break; + case 0: + return c; + } + } + + final(a, b, c); + return c; +} + +/* + * hashlittle2: return 2 32-bit hash values + * + * This is identical to hashlittle(), except it returns two 32-bit hash + * values instead of just one. This is good enough for hash table + * lookup with 2^^64 buckets, or if you want a second hash if you're not + * happy with the first, or if you want a probably-unique 64-bit ID for + * the key. *pc is better mixed than *pb, so use *pc first. If you want + * a 64-bit value do something like "*pc + (((uint64_t)*pb)<<32)". + */ +void HashUtil::BobHash(const void *buf, size_t length, uint32_t *idx1, + uint32_t *idx2) { + uint32_t a, b, c; /* internal state */ + union { + const void *ptr; + size_t i; + } u; /* needed for Mac Powerbook G4 */ + + /* Set up the internal state */ + a = b = c = 0xdeadbeef + ((uint32_t)length) + *idx1; + c += *idx2; + + u.ptr = buf; + if (HASH_LITTLE_ENDIAN && ((u.i & 0x3) == 0)) { + const uint32_t *k = (const uint32_t *)buf; /* read 32-bit chunks */ +#ifdef VALGRIND + const uint8_t *k8; +#endif + /*------ all but last block: aligned reads and affect 32 bits of (a,b,c) */ + while (length > 12) { + a += k[0]; + b += k[1]; + c += k[2]; + mix(a, b, c); + length -= 12; + k += 3; + } + +/*----------------------------- handle the last (probably partial) block */ +/* + * "k[2]&0xffffff" actually reads beyond the end of the string, but + * then masks off the part it's not allowed to read. Because the + * string is aligned, the masked-off tail is in the same word as the + * rest of the string. Every machine with memory protection I've seen + * does it on word boundaries, so is OK with this. But VALGRIND will + * still catch it and complain. The masking trick does make the hash + * noticably faster for short strings (like English words). + */ +#ifndef VALGRIND + + switch (length) { + case 12: + c += k[2]; + b += k[1]; + a += k[0]; + break; + case 11: + c += k[2] & 0xffffff; + b += k[1]; + a += k[0]; + break; + case 10: + c += k[2] & 0xffff; + b += k[1]; + a += k[0]; + break; + case 9: + c += k[2] & 0xff; + b += k[1]; + a += k[0]; + break; + case 8: + b += k[1]; + a += k[0]; + break; + case 7: + b += k[1] & 0xffffff; + a += k[0]; + break; + case 6: + b += k[1] & 0xffff; + a += k[0]; + break; + case 5: + b += k[1] & 0xff; + a += k[0]; + break; + case 4: + a += k[0]; + break; + case 3: + a += k[0] & 0xffffff; + break; + case 2: + a += k[0] & 0xffff; + break; + case 1: + a += k[0] & 0xff; + break; + case 0: + *idx1 = c; + *idx2 = b; + return; /* zero length strings require no mixing */ + } + +#else /* make valgrind happy */ + + k8 = (const uint8_t *)k; + switch (length) { + case 12: + c += k[2]; + b += k[1]; + a += k[0]; + break; + case 11: + c += ((uint32_t)k8[10]) << 16; /* fall through */ + case 10: + c += ((uint32_t)k8[9]) << 8; /* fall through */ + case 9: + c += k8[8]; /* fall through */ + case 8: + b += k[1]; + a += k[0]; + break; + case 7: + b += ((uint32_t)k8[6]) << 16; /* fall through */ + case 6: + b += ((uint32_t)k8[5]) << 8; /* fall through */ + case 5: + b += k8[4]; /* fall through */ + case 4: + a += k[0]; + break; + case 3: + a += ((uint32_t)k8[2]) << 16; /* fall through */ + case 2: + a += ((uint32_t)k8[1]) << 8; /* fall through */ + case 1: + a += k8[0]; + break; + case 0: + *idx1 = c; + *idx2 = b; + return; /* zero length strings require no mixing */ + } + +#endif /* !valgrind */ + + } else if (HASH_LITTLE_ENDIAN && ((u.i & 0x1) == 0)) { + const uint16_t *k = (const uint16_t *)buf; /* read 16-bit chunks */ + const uint8_t *k8; + + /*--------------- all but last block: aligned reads and different mixing */ + while (length > 12) { + a += k[0] + (((uint32_t)k[1]) << 16); + b += k[2] + (((uint32_t)k[3]) << 16); + c += k[4] + (((uint32_t)k[5]) << 16); + mix(a, b, c); + length -= 12; + k += 6; + } + + /*----------------------------- handle the last (probably partial) block */ + k8 = (const uint8_t *)k; + switch (length) { + case 12: + c += k[4] + (((uint32_t)k[5]) << 16); + b += k[2] + (((uint32_t)k[3]) << 16); + a += k[0] + (((uint32_t)k[1]) << 16); + break; + case 11: + c += ((uint32_t)k8[10]) << 16; /* fall through */ + case 10: + c += k[4]; + b += k[2] + (((uint32_t)k[3]) << 16); + a += k[0] + (((uint32_t)k[1]) << 16); + break; + case 9: + c += k8[8]; /* fall through */ + case 8: + b += k[2] + (((uint32_t)k[3]) << 16); + a += k[0] + (((uint32_t)k[1]) << 16); + break; + case 7: + b += ((uint32_t)k8[6]) << 16; /* fall through */ + case 6: + b += k[2]; + a += k[0] + (((uint32_t)k[1]) << 16); + break; + case 5: + b += k8[4]; /* fall through */ + case 4: + a += k[0] + (((uint32_t)k[1]) << 16); + break; + case 3: + a += ((uint32_t)k8[2]) << 16; /* fall through */ + case 2: + a += k[0]; + break; + case 1: + a += k8[0]; + break; + case 0: + *idx1 = c; + *idx2 = b; + return; /* zero length strings require no mixing */ + } + + } else { /* need to read the key one byte at a time */ + const uint8_t *k = (const uint8_t *)buf; + + /*--------------- all but the last block: affect some 32 bits of (a,b,c) */ + while (length > 12) { + a += k[0]; + a += ((uint32_t)k[1]) << 8; + a += ((uint32_t)k[2]) << 16; + a += ((uint32_t)k[3]) << 24; + b += k[4]; + b += ((uint32_t)k[5]) << 8; + b += ((uint32_t)k[6]) << 16; + b += ((uint32_t)k[7]) << 24; + c += k[8]; + c += ((uint32_t)k[9]) << 8; + c += ((uint32_t)k[10]) << 16; + c += ((uint32_t)k[11]) << 24; + mix(a, b, c); + length -= 12; + k += 12; + } + + /*-------------------------------- last block: affect all 32 bits of (c) */ + switch (length) /* all the case statements fall through */ + { + case 12: + c += ((uint32_t)k[11]) << 24; + case 11: + c += ((uint32_t)k[10]) << 16; + case 10: + c += ((uint32_t)k[9]) << 8; + case 9: + c += k[8]; + case 8: + b += ((uint32_t)k[7]) << 24; + case 7: + b += ((uint32_t)k[6]) << 16; + case 6: + b += ((uint32_t)k[5]) << 8; + case 5: + b += k[4]; + case 4: + a += ((uint32_t)k[3]) << 24; + case 3: + a += ((uint32_t)k[2]) << 16; + case 2: + a += ((uint32_t)k[1]) << 8; + case 1: + a += k[0]; + break; + case 0: + *idx1 = c; + *idx2 = b; + return; /* zero length strings require no mixing */ + } + } + + final(a, b, c); + *idx1 = c; + *idx2 = b; +} + +void HashUtil::BobHash(const std::string &s, uint32_t *idx1, uint32_t *idx2) { + return BobHash(s.data(), s.length(), idx1, idx2); +} + +//----------------------------------------------------------------------------- +// MurmurHash2, by Austin Appleby +// Note - This code makes a few assumptions about how your machine behaves - +// 1. We can read a 4-byte value from any address without crashing +// 2. sizeof(int) == 4 +// And it has a few limitations - +// 1. It will not work incrementally. +// 2. It will not produce the same results on little-endian and big-endian +// machines. +// All code is released to the public domain. For business purposes, +// Murmurhash is under the MIT license. + +uint32_t HashUtil::MurmurHash(const void *buf, size_t len, uint32_t seed) { + // 'm' and 'r' are mixing constants generated offline. + // They're not really 'magic', they just happen to work well. + + const unsigned int m = 0x5bd1e995; + const int r = 24; + + // Initialize the hash to a 'random' value + uint32_t h = seed ^ len; + + // Mix 4 bytes at a time into the hash + const unsigned char *data = (const unsigned char *)buf; + + while (len >= 4) { + unsigned int k = *(unsigned int *)data; + + k *= m; + k ^= k >> r; + k *= m; + + h *= m; + h ^= k; + + data += 4; + len -= 4; + } + + // Handle the last few bytes of the input array + switch (len) { + case 3: + h ^= data[2] << 16; + case 2: + h ^= data[1] << 8; + case 1: + h ^= data[0]; + h *= m; + }; + + // Do a few final mixes of the hash to ensure the last few + // bytes are well-incorporated. + h ^= h >> 13; + h *= m; + h ^= h >> 15; + return h; +} + +uint32_t HashUtil::MurmurHash(const std::string &s, uint32_t seed) { + return MurmurHash(s.data(), s.length(), seed); +} + +// SuperFastHash aka Hsieh Hash, License: GPL 2.0 +uint32_t HashUtil::SuperFastHash(const void *buf, size_t len) { + const char *data = (const char *)buf; + uint32_t hash = len, tmp; + int rem; + + if (len == 0 || data == NULL) return 0; + + rem = len & 3; + len >>= 2; + + /* Main loop */ + for (; len > 0; len--) { + hash += get16bits(data); + tmp = (get16bits(data + 2) << 11) ^ hash; + hash = (hash << 16) ^ tmp; + data += 2 * sizeof(uint16_t); + hash += hash >> 11; + } + + /* Handle end cases */ + switch (rem) { + case 3: + hash += get16bits(data); + hash ^= hash << 16; + hash ^= data[sizeof(uint16_t)] << 18; + hash += hash >> 11; + break; + case 2: + hash += get16bits(data); + hash ^= hash << 11; + hash += hash >> 17; + break; + case 1: + hash += *data; + hash ^= hash << 10; + hash += hash >> 1; + } + + /* Force "avalanching" of final 127 bits */ + hash ^= hash << 3; + hash += hash >> 5; + hash ^= hash << 4; + hash += hash >> 17; + hash ^= hash << 25; + hash += hash >> 6; + + return hash; +} + +uint32_t HashUtil::SuperFastHash(const std::string &s) { + return SuperFastHash(s.data(), s.length()); +} + +uint32_t HashUtil::NullHash(const void *buf, size_t length, + uint32_t shiftbytes) { + // Ensure that enough bits exist in buffer + if (length - shiftbytes < sizeof(uint32_t)) { + return 0; + } + char *data = (char *)buf; + return ((data[(length - shiftbytes - 4)] << 24) + + (data[(length - shiftbytes - 3)] << 16) + + (data[(length - shiftbytes - 2)] << 8) + + (data[(length - shiftbytes - 1)])); +} + +/* + * Compatibility layer for OpenSSL < 1.1.0. + * Implemented as proposed by + * https://wiki.openssl.org/index.php/OpenSSL_1.1.0_Changes + */ +#if OPENSSL_VERSION_NUMBER < 0x10100000L +#include +static void *OPENSSL_zalloc(size_t num) { + void *ret = OPENSSL_malloc(num); + + if (ret != NULL) memset(ret, 0, num); + return ret; +} + +EVP_MD_CTX *EVP_MD_CTX_new(void) { + return (EVP_MD_CTX *)OPENSSL_zalloc(sizeof(EVP_MD_CTX)); +} + +void EVP_MD_CTX_free(EVP_MD_CTX *ctx) { + EVP_MD_CTX_cleanup(ctx); + OPENSSL_free(ctx); +} +#endif + +std::string HashUtil::MD5Hash(const char *inbuf, size_t in_length) { + EVP_MD_CTX *mdctx; + unsigned char md_value[EVP_MAX_MD_SIZE]; + unsigned int md_len; + + mdctx = EVP_MD_CTX_new(); + EVP_DigestInit(mdctx, EVP_md5()); + EVP_DigestUpdate(mdctx, (const void *)inbuf, in_length); + EVP_DigestFinal_ex(mdctx, md_value, &md_len); + EVP_MD_CTX_free(mdctx); + + return std::string((char *)md_value, (size_t)md_len); +} + +std::string HashUtil::SHA1Hash(const char *inbuf, size_t in_length) { + EVP_MD_CTX *mdctx; + unsigned char md_value[EVP_MAX_MD_SIZE]; + unsigned int md_len; + + mdctx = EVP_MD_CTX_new(); + EVP_DigestInit(mdctx, EVP_sha1()); + EVP_DigestUpdate(mdctx, (const void *)inbuf, in_length); + EVP_DigestFinal_ex(mdctx, md_value, &md_len); + EVP_MD_CTX_free(mdctx); + + return std::string((char *)md_value, (size_t)md_len); +} +} // namespace cuckoofilter diff --git a/cuckoofilter/src/hashutil.h b/cuckoofilter/src/hashutil.h new file mode 100644 index 0000000..fec02be --- /dev/null +++ b/cuckoofilter/src/hashutil.h @@ -0,0 +1,115 @@ +#ifndef CUCKOO_FILTER_HASHUTIL_H_ +#define CUCKOO_FILTER_HASHUTIL_H_ + +#include +#include +#include + +#include + +// #include +#include + +namespace cuckoofilter { + +class HashUtil { + public: + // Bob Jenkins Hash + static uint32_t BobHash(const void *buf, size_t length, uint32_t seed = 0); + static uint32_t BobHash(const std::string &s, uint32_t seed = 0); + + // Bob Jenkins Hash that returns two indices in one call + // Useful for Cuckoo hashing, power of two choices, etc. + // Use idx1 before idx2, when possible. idx1 and idx2 should be initialized to + // seeds. + static void BobHash(const void *buf, size_t length, uint32_t *idx1, + uint32_t *idx2); + static void BobHash(const std::string &s, uint32_t *idx1, uint32_t *idx2); + + // MurmurHash2 + static uint32_t MurmurHash(const void *buf, size_t length, uint32_t seed = 0); + static uint32_t MurmurHash(const std::string &s, uint32_t seed = 0); + + // SuperFastHash + static uint32_t SuperFastHash(const void *buf, size_t len); + static uint32_t SuperFastHash(const std::string &s); + + // Null hash (shift and mask) + static uint32_t NullHash(const void *buf, size_t length, uint32_t shiftbytes); + + // Wrappers for MD5 and SHA1 hashing using EVP + static std::string MD5Hash(const char *inbuf, size_t in_length); + static std::string SHA1Hash(const char *inbuf, size_t in_length); + + private: + HashUtil(); +}; + +// See Martin Dietzfelbinger, "Universal hashing and k-wise independent random +// variables via integer arithmetic without primes". +class TwoIndependentMultiplyShift { + unsigned __int128 multiply_, add_; + + public: + TwoIndependentMultiplyShift() { + std::uint_least64_t seed; + sysrandom(&seed, sizeof(seed)); + std::mt19937_64 rng(seed); + std::uniform_int_distribution dist(0, UINT64_MAX); + + for (auto v : {&multiply_, &add_}) { + for (size_t i = 0; i < 8; i++) { + unsigned __int128 hi = dist(rng); + unsigned __int128 lo = dist(rng); + *v ^= (hi << 64) | lo; + } + } + // ::std::random_device random; + // for (auto v : {&multiply_, &add_}) { + // *v = random(); + // for (int i = 1; i <= 4; ++i) { + // *v = *v << 32; + // *v |= random(); + // } + // } + } + + uint64_t operator()(uint64_t key) const { + return (add_ + multiply_ * static_cast(key)) >> 64; + } + + inline size_t sysrandom(void *dst, size_t dstlen) { + char *buffer = reinterpret_cast(dst); + std::ifstream stream("/dev/urandom", + std::ios_base::binary | std::ios_base::in); + stream.read(buffer, dstlen); + + return dstlen; + } +}; + +// See Patrascu and Thorup's "The Power of Simple Tabulation Hashing" +class SimpleTabulation { + uint64_t tables_[sizeof(uint64_t)][1 << CHAR_BIT]; + + public: + SimpleTabulation() { + ::std::random_device random; + for (unsigned i = 0; i < sizeof(uint64_t); ++i) { + for (int j = 0; j < (1 << CHAR_BIT); ++j) { + tables_[i][j] = random() | ((static_cast(random())) << 32); + } + } + } + + uint64_t operator()(uint64_t key) const { + uint64_t result = 0; + for (unsigned i = 0; i < sizeof(key); ++i) { + result ^= tables_[i][reinterpret_cast(&key)[i]]; + } + return result; + } +}; +} // namespace cuckoofilter + +#endif // CUCKOO_FILTER_HASHUTIL_H_ diff --git a/cuckoofilter/src/packedtable.h b/cuckoofilter/src/packedtable.h new file mode 100644 index 0000000..ceed009 --- /dev/null +++ b/cuckoofilter/src/packedtable.h @@ -0,0 +1,438 @@ +#ifndef CUCKOO_FILTER_PACKED_TABLE_H_ +#define CUCKOO_FILTER_PACKED_TABLE_H_ + +#include +#include + +#include "debug.h" +#include "permencoding.h" +#include "printutil.h" + +namespace cuckoofilter { + +// Using Permutation encoding to save 1 bit per tag +template +class PackedTable { + static_assert(bits_per_tag == 5 || bits_per_tag == 6 || bits_per_tag == 7 || + bits_per_tag == 8 || bits_per_tag == 9 || + bits_per_tag == 13 || bits_per_tag == 17, + "bits_per_tag must be 5, 6, 7, 8, 9, 13, or 17"); + static const size_t kDirBitsPerTag = bits_per_tag - 4; + static const size_t kBitsPerBucket = (3 + kDirBitsPerTag) * 4; + static const size_t kBytesPerBucket = (kBitsPerBucket + 7) >> 3; + static const uint32_t kDirBitsMask = ((1ULL << kDirBitsPerTag) - 1) << 4; + + // using a pointer adds one more indirection + size_t len_; + size_t num_buckets_; + char *buckets_; + PermEncoding perm_; + + public: + explicit PackedTable(size_t num) : num_buckets_(num) { + // NOTE(binfan): use 7 extra bytes to avoid overrun as we + // always read a uint64 + len_ = kBytesPerBucket * num_buckets_ + 7; + buckets_ = new char[len_]; + memset(buckets_, 0, len_); + } + + ~PackedTable() { delete[] buckets_; } + + size_t NumBuckets() const { return num_buckets_; } + + size_t SizeInTags() const { return 4 * num_buckets_; } + + size_t SizeInBytes() const { return len_; } + + std::string Info() const { + std::stringstream ss; + ss << "PackedHashtable with tag size: " << bits_per_tag << " bits"; + ss << "\t4 packed bits(3 bits after compression) and " << kDirBitsPerTag + << " direct bits\n"; + ss << "\t\tAssociativity: 4\n"; + ss << "\t\tTotal # of rows: " << num_buckets_ << "\n"; + ss << "\t\ttotal # slots: " << SizeInTags() << "\n"; + return ss.str(); + } + + void PrintBucket(const size_t i) const { + DPRINTF(DEBUG_TABLE, "PackedTable::PrintBucket %zu \n", i); + const char *p = buckets_ + kBitsPerBucket * i / 8; + std::cout << "\tbucketbits =" + << PrintUtil::bytes_to_hex((char *)p, kBytesPerBucket + 1) + << std::endl; + + uint32_t tags[4]; + + ReadBucket(i, tags); + PrintTags(tags); + DPRINTF(DEBUG_TABLE, "PackedTable::PrintBucket done \n"); + } + + void PrintTags(uint32_t tags[4]) const { + DPRINTF(DEBUG_TABLE, "PackedTable::PrintTags \n"); + uint8_t lowbits[4]; + uint32_t dirbits[4]; + for (size_t j = 0; j < 4; j++) { + lowbits[j] = tags[j] & 0x0f; + dirbits[j] = (tags[j] & kDirBitsMask) >> 4; + } + uint16_t codeword = perm_.encode(lowbits); + std::cout << "\tcodeword =" + << PrintUtil::bytes_to_hex((char *)&codeword, 2) << std::endl; + for (size_t j = 0; j < 4; j++) { + std::cout << "\ttag[" << j + << "]: " << PrintUtil::bytes_to_hex((char *)&tags[j], 4); + std::cout << " lowbits=" + << PrintUtil::bytes_to_hex((char *)&lowbits[j], 1) + << " dirbits=" + << PrintUtil::bytes_to_hex((char *)&dirbits[j], + kDirBitsPerTag / 8 + 1) + << std::endl; + } + DPRINTF(DEBUG_TABLE, "PackedTable::PrintTags done\n"); + } + + inline void SortPair(uint32_t &a, uint32_t &b) { + if ((a & 0x0f) > (b & 0x0f)) { + std::swap(a, b); + } + } + + inline void SortTags(uint32_t *tags) { + SortPair(tags[0], tags[2]); + SortPair(tags[1], tags[3]); + SortPair(tags[0], tags[1]); + SortPair(tags[2], tags[3]); + SortPair(tags[1], tags[2]); + } + + /* read and decode the bucket i, pass the 4 decoded tags to the 2nd arg + * bucket bits = 12 codeword bits + dir bits of tag1 + dir bits of tag2 ... + */ + inline void ReadBucket(const size_t i, uint32_t tags[4]) const { + DPRINTF(DEBUG_TABLE, "PackedTable::ReadBucket %zu \n", i); + DPRINTF(DEBUG_TABLE, "kdirbitsMask=%x\n", kDirBitsMask); + + const char *p; // = buckets_ + ((kBitsPerBucket * i) >> 3); + uint16_t codeword; + uint8_t lowbits[4]; + + if (bits_per_tag == 5) { + // 1 dirbits per tag, 16 bits per bucket + p = buckets_ + (i * 2); + uint16_t bucketbits = *((uint16_t *)p); + codeword = bucketbits & 0x0fff; + tags[0] = ((bucketbits >> 8) & kDirBitsMask); + tags[1] = ((bucketbits >> 9) & kDirBitsMask); + tags[2] = ((bucketbits >> 10) & kDirBitsMask); + tags[3] = ((bucketbits >> 11) & kDirBitsMask); + } else if (bits_per_tag == 6) { + // 2 dirbits per tag, 20 bits per bucket + p = buckets_ + ((20 * i) >> 3); + uint32_t bucketbits = *((uint32_t *)p); + codeword = (*((uint16_t *)p) >> ((i & 1) << 2)) & 0x0fff; + tags[0] = (bucketbits >> (8 + ((i & 1) << 2))) & kDirBitsMask; + tags[1] = (bucketbits >> (10 + ((i & 1) << 2))) & kDirBitsMask; + tags[2] = (bucketbits >> (12 + ((i & 1) << 2))) & kDirBitsMask; + tags[3] = (bucketbits >> (14 + ((i & 1) << 2))) & kDirBitsMask; + } else if (bits_per_tag == 7) { + // 3 dirbits per tag, 24 bits per bucket + p = buckets_ + (i << 1) + i; + uint32_t bucketbits = *((uint32_t *)p); + codeword = *((uint16_t *)p) & 0x0fff; + tags[0] = (bucketbits >> 8) & kDirBitsMask; + tags[1] = (bucketbits >> 11) & kDirBitsMask; + tags[2] = (bucketbits >> 14) & kDirBitsMask; + tags[3] = (bucketbits >> 17) & kDirBitsMask; + } else if (bits_per_tag == 8) { + // 4 dirbits per tag, 28 bits per bucket + p = buckets_ + ((28 * i) >> 3); + uint32_t bucketbits = *((uint32_t *)p); + codeword = (*((uint16_t *)p) >> ((i & 1) << 2)) & 0x0fff; + tags[0] = (bucketbits >> (8 + ((i & 1) << 2))) & kDirBitsMask; + tags[1] = (bucketbits >> (12 + ((i & 1) << 2))) & kDirBitsMask; + tags[2] = (bucketbits >> (16 + ((i & 1) << 2))) & kDirBitsMask; + tags[3] = (bucketbits >> (20 + ((i & 1) << 2))) & kDirBitsMask; + } else if (bits_per_tag == 9) { + // 5 dirbits per tag, 32 bits per bucket + p = buckets_ + (i * 4); + uint32_t bucketbits = *((uint32_t *)p); + codeword = *((uint16_t *)p) & 0x0fff; + tags[0] = (bucketbits >> 8) & kDirBitsMask; + tags[1] = (bucketbits >> 13) & kDirBitsMask; + tags[2] = (bucketbits >> 18) & kDirBitsMask; + tags[3] = (bucketbits >> 23) & kDirBitsMask; + } else if (bits_per_tag == 13) { + // 9 dirbits per tag, 48 bits per bucket + p = buckets_ + (i * 6); + uint64_t bucketbits = *((uint64_t *)p); + codeword = *((uint16_t *)p) & 0x0fff; + tags[0] = (bucketbits >> 8) & kDirBitsMask; + tags[1] = (bucketbits >> 17) & kDirBitsMask; + tags[2] = (bucketbits >> 26) & kDirBitsMask; + tags[3] = (bucketbits >> 35) & kDirBitsMask; + } else if (bits_per_tag == 17) { + // 13 dirbits per tag, 64 bits per bucket + p = buckets_ + (i << 3); + uint64_t bucketbits = *((uint64_t *)p); + codeword = *((uint16_t *)p) & 0x0fff; + tags[0] = (bucketbits >> 8) & kDirBitsMask; + tags[1] = (bucketbits >> 21) & kDirBitsMask; + tags[2] = (bucketbits >> 34) & kDirBitsMask; + tags[3] = (bucketbits >> 47) & kDirBitsMask; + } + + /* codeword is the lowest 12 bits in the bucket */ + uint16_t v = perm_.dec_table[codeword]; + lowbits[0] = (v & 0x000f); + lowbits[2] = ((v >> 4) & 0x000f); + lowbits[1] = ((v >> 8) & 0x000f); + lowbits[3] = ((v >> 12) & 0x000f); + + tags[0] |= lowbits[0]; + tags[1] |= lowbits[1]; + tags[2] |= lowbits[2]; + tags[3] |= lowbits[3]; + + if (debug_level & DEBUG_TABLE) { + PrintTags(tags); + } + DPRINTF(DEBUG_TABLE, "PackedTable::ReadBucket done \n"); + } + + /* Tag = 4 low bits + x high bits + * L L L L H H H H ... + */ + inline void WriteBucket(const size_t i, uint32_t tags[4], bool sort = true) { + DPRINTF(DEBUG_TABLE, "PackedTable::WriteBucket %zu \n", i); + /* first sort the tags in increasing order is arg sort = true*/ + if (sort) { + DPRINTF(DEBUG_TABLE, "Sort tags\n"); + SortTags(tags); + } + if (debug_level & DEBUG_TABLE) { + PrintTags(tags); + } + + /* put in direct bits for each tag*/ + + uint8_t lowbits[4]; + uint32_t highbits[4]; + + lowbits[0] = tags[0] & 0x0f; + lowbits[1] = tags[1] & 0x0f; + lowbits[2] = tags[2] & 0x0f; + lowbits[3] = tags[3] & 0x0f; + + highbits[0] = tags[0] & 0xfffffff0; + highbits[1] = tags[1] & 0xfffffff0; + highbits[2] = tags[2] & 0xfffffff0; + highbits[3] = tags[3] & 0xfffffff0; + + // note that : tags[j] = lowbits[j] | highbits[j] + + uint16_t codeword = perm_.encode(lowbits); + DPRINTF(DEBUG_TABLE, "codeword=%s\n", + PrintUtil::bytes_to_hex((char *)&codeword, 2).c_str()); + + /* write out the bucketbits to its place*/ + const char *p = buckets_ + ((kBitsPerBucket * i) >> 3); + DPRINTF(DEBUG_TABLE, "original bucketbits=%s\n", + PrintUtil::bytes_to_hex((char *)p, 8).c_str()); + + if (kBitsPerBucket == 16) { + // 1 dirbits per tag + *((uint16_t *)p) = codeword | (highbits[0] << 8) | (highbits[1] << 9) | + (highbits[2] << 10) | (highbits[3] << 11); + } else if (kBitsPerBucket == 20) { + // 2 dirbits per tag + if ((i & 0x0001) == 0) { + *((uint32_t *)p) &= 0xfff00000; + *((uint32_t *)p) |= codeword | (highbits[0] << 8) | + (highbits[1] << 10) | (highbits[2] << 12) | + (highbits[3] << 14); + } else { + *((uint32_t *)p) &= 0xff00000f; + *((uint32_t *)p) |= (codeword << 4) | (highbits[0] << 12) | + (highbits[1] << 14) | (highbits[2] << 16) | + (highbits[3] << 18); + } + } else if (kBitsPerBucket == 24) { + // 3 dirbits per tag + *((uint32_t *)p) &= 0xff000000; + *((uint32_t *)p) |= codeword | (highbits[0] << 8) | (highbits[1] << 11) | + (highbits[2] << 14) | (highbits[3] << 17); + } else if (kBitsPerBucket == 28) { + // 4 dirbits per tag + if ((i & 0x0001) == 0) { + *((uint32_t *)p) &= 0xf0000000; + *((uint32_t *)p) |= codeword | (highbits[0] << 8) | + (highbits[1] << 12) | (highbits[2] << 16) | + (highbits[3] << 20); + } else { + *((uint32_t *)p) &= 0x0000000f; + *((uint32_t *)p) |= (codeword << 4) | (highbits[0] << 12) | + (highbits[1] << 16) | (highbits[2] << 20) | + (highbits[3] << 24); + } + } else if (kBitsPerBucket == 32) { + // 5 dirbits per tag + *((uint32_t *)p) = codeword | (highbits[0] << 8) | (highbits[1] << 13) | + (highbits[2] << 18) | (highbits[3] << 23); + DPRINTF(DEBUG_TABLE, " new bucketbits=%s\n", + PrintUtil::bytes_to_hex((char *)p, 4).c_str()); + } else if (kBitsPerBucket == 48) { + // 9 dirbits per tag + *((uint64_t *)p) &= 0xffff000000000000ULL; + *((uint64_t *)p) |= codeword | ((uint64_t)highbits[0] << 8) | + ((uint64_t)highbits[1] << 17) | + ((uint64_t)highbits[2] << 26) | + ((uint64_t)highbits[3] << 35); + DPRINTF(DEBUG_TABLE, " new bucketbits=%s\n", + PrintUtil::bytes_to_hex((char *)p, 4).c_str()); + + } else if (kBitsPerBucket == 64) { + // 13 dirbits per tag + *((uint64_t *)p) = codeword | ((uint64_t)highbits[0] << 8) | + ((uint64_t)highbits[1] << 21) | + ((uint64_t)highbits[2] << 34) | + ((uint64_t)highbits[3] << 47); + } + DPRINTF(DEBUG_TABLE, "PackedTable::WriteBucket done\n"); + } + + bool FindTagInBuckets(const size_t i1, const size_t i2, + const uint32_t tag) const { + // DPRINTF(DEBUG_TABLE, "PackedTable::FindTagInBucket %zu\n", i); + uint32_t tags1[4]; + uint32_t tags2[4]; + + // disable for now + // _mm_prefetch( buckets_ + (i1 * kBitsPerBucket) / 8, _MM_HINT_NTA); + // _mm_prefetch( buckets_ + (i2 * kBitsPerBucket) / 8, _MM_HINT_NTA); + + // ReadBucket(i1, tags1); + // ReadBucket(i2, tags2); + + uint16_t v; + uint64_t bucketbits1 = *((uint64_t *)(buckets_ + kBitsPerBucket * i1 / 8)); + uint64_t bucketbits2 = *((uint64_t *)(buckets_ + kBitsPerBucket * i2 / 8)); + + tags1[0] = (bucketbits1 >> 8) & kDirBitsMask; + tags1[1] = (bucketbits1 >> 17) & kDirBitsMask; + tags1[2] = (bucketbits1 >> 26) & kDirBitsMask; + tags1[3] = (bucketbits1 >> 35) & kDirBitsMask; + v = perm_.dec_table[(bucketbits1)&0x0fff]; + // the order 0 2 1 3 is not a bug + tags1[0] |= (v & 0x000f); + tags1[2] |= ((v >> 4) & 0x000f); + tags1[1] |= ((v >> 8) & 0x000f); + tags1[3] |= ((v >> 12) & 0x000f); + + tags2[0] = (bucketbits2 >> 8) & kDirBitsMask; + tags2[1] = (bucketbits2 >> 17) & kDirBitsMask; + tags2[2] = (bucketbits2 >> 26) & kDirBitsMask; + tags2[3] = (bucketbits2 >> 35) & kDirBitsMask; + v = perm_.dec_table[(bucketbits2)&0x0fff]; + tags2[0] |= (v & 0x000f); + tags2[2] |= ((v >> 4) & 0x000f); + tags2[1] |= ((v >> 8) & 0x000f); + tags2[3] |= ((v >> 12) & 0x000f); + + return (tags1[0] == tag) || (tags1[1] == tag) || (tags1[2] == tag) || + (tags1[3] == tag) || (tags2[0] == tag) || (tags2[1] == tag) || + (tags2[2] == tag) || (tags2[3] == tag); + } + + bool FindTagInBucket(const size_t i, const uint32_t tag) const { + DPRINTF(DEBUG_TABLE, "PackedTable::FindTagInBucket %zu\n", i); + uint32_t tags[4]; + ReadBucket(i, tags); + if (debug_level & DEBUG_TABLE) { + PrintTags(tags); + } + + bool ret = ((tags[0] == tag) || (tags[1] == tag) || (tags[2] == tag) || + (tags[3] == tag)); + DPRINTF(DEBUG_TABLE, "PackedTable::FindTagInBucket %d \n", ret); + return ret; + } + + bool DeleteTagFromBucket(const size_t i, const uint32_t tag) { + uint32_t tags[4]; + ReadBucket(i, tags); + if (debug_level & DEBUG_TABLE) { + PrintTags(tags); + } + for (size_t j = 0; j < 4; j++) { + if (tags[j] == tag) { + tags[j] = 0; + WriteBucket(i, tags); + return true; + } + } + return false; + } // DeleteTagFromBucket + + bool InsertTagToBucket(const size_t i, const uint32_t tag, const bool kickout, + uint32_t &oldtag) { + DPRINTF(DEBUG_TABLE, "PackedTable::InsertTagToBucket %zu \n", i); + + uint32_t tags[4]; + DPRINTF(DEBUG_TABLE, + "PackedTable::InsertTagToBucket read bucket to tags\n"); + ReadBucket(i, tags); + if (debug_level & DEBUG_TABLE) { + PrintTags(tags); + PrintBucket(i); + } + for (size_t j = 0; j < 4; j++) { + if (tags[j] == 0) { + DPRINTF(DEBUG_TABLE, + "PackedTable::InsertTagToBucket slot %zu is empty\n", j); + + tags[j] = tag; + WriteBucket(i, tags); + if (debug_level & DEBUG_TABLE) { + PrintBucket(i); + ReadBucket(i, tags); + } + DPRINTF(DEBUG_TABLE, "PackedTable::InsertTagToBucket Ok\n"); + return true; + } + } + if (kickout) { + size_t r = rand() & 3; + DPRINTF( + DEBUG_TABLE, + "PackedTable::InsertTagToBucket, let's kick out a random slot %zu \n", + r); + // PrintBucket(i); + + oldtag = tags[r]; + tags[r] = tag; + WriteBucket(i, tags); + if (debug_level & DEBUG_TABLE) { + PrintTags(tags); + } + } + DPRINTF(DEBUG_TABLE, "PackedTable::InsertTagToBucket, insert failed \n"); + return false; + } + + // inline size_t NumTagsInBucket(const size_t i) { + // size_t num = 0; + // for (size_t j = 0; j < tags_per_bucket; j++ ){ + // if (ReadTag(i, j) != 0) { + // num ++; + // } + // } + // return num; + // } // NumTagsInBucket + +}; // PackedTable +} // namespace cuckoofilter + +#endif // CUCKOO_FILTER_PACKED_TABLE_H_ \ No newline at end of file diff --git a/cuckoofilter/src/permencoding.h b/cuckoofilter/src/permencoding.h new file mode 100644 index 0000000..493e2ef --- /dev/null +++ b/cuckoofilter/src/permencoding.h @@ -0,0 +1,88 @@ +#ifndef CUCKOO_FILTER_PERM_ENCODING_H_ +#define CUCKOO_FILTER_PERM_ENCODING_H_ + +#include +#include +#include +#include + +#include + +#include "debug.h" + +namespace cuckoofilter { + +class PermEncoding { + /* unpack one 2-byte number to four 4-bit numbers */ + // inline void unpack(const uint16_t in, const uint8_t out[4]) const { + // (*(uint16_t *)out) = in & 0x0f0f; + // (*(uint16_t *)(out +2)) = (in >> 4) & 0x0f0f; + // } + + inline void unpack(uint16_t in, uint8_t out[4]) const { + out[0] = (in & 0x000f); + out[2] = ((in >> 4) & 0x000f); + out[1] = ((in >> 8) & 0x000f); + out[3] = ((in >> 12) & 0x000f); + } + + /* pack four 4-bit numbers to one 2-byte number */ + inline uint16_t pack(const uint8_t in[4]) const { + uint16_t in1 = *((uint16_t *)(in)) & 0x0f0f; + uint16_t in2 = *((uint16_t *)(in + 2)) << 4; + return in1 | in2; + } + + public: + PermEncoding() { + uint8_t dst[4]; + uint16_t idx = 0; + memset(dec_table, 0, sizeof(dec_table)); + memset(enc_table, 0, sizeof(enc_table)); + gen_tables(0, 0, dst, idx); + } + + ~PermEncoding() {} + + static const size_t N_ENTS = 3876; + + uint16_t dec_table[N_ENTS]; + uint16_t enc_table[1 << 16]; + + inline void decode(const uint16_t codeword, uint8_t lowbits[4]) const { + unpack(dec_table[codeword], lowbits); + } + + inline uint16_t encode(const uint8_t lowbits[4]) const { + if (DEBUG_ENCODE & debug_level) { + printf("Perm.encode\n"); + for (int i = 0; i < 4; i++) { + printf("encode lowbits[%d]=%x\n", i, lowbits[i]); + } + printf("pack(lowbits) = %x\n", pack(lowbits)); + printf("enc_table[%x]=%x\n", pack(lowbits), enc_table[pack(lowbits)]); + } + + return enc_table[pack(lowbits)]; + } + + void gen_tables(int base, int k, uint8_t dst[4], uint16_t &idx) { + for (int i = base; i < 16; i++) { + /* for fast comparison in binary_search in little-endian machine */ + dst[k] = i; + if (k + 1 < 4) { + gen_tables(i, k + 1, dst, idx); + } else { + dec_table[idx] = pack(dst); + enc_table[pack(dst)] = idx; + if (DEBUG_ENCODE & debug_level) { + printf("enc_table[%04x]=%04x\t%x %x %x %x\n", pack(dst), idx, dst[0], + dst[1], dst[2], dst[3]); + } + idx++; + } + } + } +}; +} // namespace cuckoofilter +#endif // CUCKOO_FILTER_PERM_ENCODING_H_ diff --git a/cuckoofilter/src/printutil.cc b/cuckoofilter/src/printutil.cc new file mode 100644 index 0000000..4dc7cae --- /dev/null +++ b/cuckoofilter/src/printutil.cc @@ -0,0 +1,24 @@ +// #include "printutil.h" +// #include +// #include + +// namespace cuckoofilter { + +// std::string PrintUtil::bytes_to_hex(const char *data, size_t len) { +// std::string hexstr = ""; +// static const char hexes[] = "0123456789ABCDEF "; + +// for (size_t i = 0; i < len; i++) { +// unsigned char c = data[i]; +// hexstr.push_back(hexes[c >> 4]); +// hexstr.push_back(hexes[c & 0xf]); +// hexstr.push_back(hexes[16]); +// } +// return hexstr; +// }; + +// std::string PrintUtil::bytes_to_hex(const std::string &s) { +// return bytes_to_hex((const char *)s.data(), s.size()); +// }; + +// } // namespace cuckoofilter diff --git a/cuckoofilter/src/printutil.h b/cuckoofilter/src/printutil.h new file mode 100644 index 0000000..b2af626 --- /dev/null +++ b/cuckoofilter/src/printutil.h @@ -0,0 +1,32 @@ +#ifndef CUCKOO_FILTER_PRINTUTIL_H_ +#define CUCKOO_FILTER_PRINTUTIL_H_ + +#include + +namespace cuckoofilter { +class PrintUtil { + public: + static std::string bytes_to_hex(const char *data, size_t len) { + std::string hexstr = ""; + static const char hexes[] = "0123456789ABCDEF "; + + for (size_t i = 0; i < len; i++) { + unsigned char c = data[i]; + hexstr.push_back(hexes[c >> 4]); + hexstr.push_back(hexes[c & 0xf]); + hexstr.push_back(hexes[16]); + } + return hexstr; + } + + static std::string bytes_to_hex(const std::string &s) { + return bytes_to_hex((const char *)s.data(), s.size()); + } + + private: + PrintUtil(); +}; // class PrintUtil + +} // namespace cuckoofilter + +#endif // CUCKOO_FILTER_PRINTUTIL_H_ diff --git a/cuckoofilter/src/simd-block-fixed-fpp.h b/cuckoofilter/src/simd-block-fixed-fpp.h new file mode 100644 index 0000000..66bd724 --- /dev/null +++ b/cuckoofilter/src/simd-block-fixed-fpp.h @@ -0,0 +1,488 @@ +// Copied from Apache Impala (incubating), usable under the terms in the Apache License, +// Version 2.0. + +// This is a block Bloom filter (from Putze et al.'s "Cache-, Hash- and Space-Efficient +// Bloom Filters") with some twists: +// +// 1. Each block is a split Bloom filter - see Section 2.1 of Broder and Mitzenmacher's +// "Network Applications of Bloom Filters: A Survey". +// +// 2. The number of bits set per Add() is contant in order to take advantage of SIMD +// instructions. + +#pragma once + +#include +#include + +#include +#include + + +#include "hashutil.h" + +using uint32_t = ::std::uint32_t; +using uint64_t = ::std::uint64_t; + +__attribute__((always_inline)) +inline uint32_t reduce(uint32_t hash, uint32_t n) { + // http://lemire.me/blog/2016/06/27/a-fast-alternative-to-the-modulo-reduction/ + return (uint32_t) (((uint64_t) hash * n) >> 32); +} + +static inline uint64_t rotl64(uint64_t n, unsigned int c) { + // assumes width is a power of 2 + const unsigned int mask = (CHAR_BIT * sizeof(n) - 1); + // assert ( (c<=mask) &&"rotate by type width or more"); + c &= mask; + return (n << c) | ( n >> ((-c) & mask)); +} + +#ifdef __AVX2__ +#include + +template +class SimdBlockFilterFixed { + private: + // The filter is divided up into Buckets: + using Bucket = uint32_t[8]; + + const int bucketCount; + + Bucket* directory_; + + HashFamily hasher_; + + public: + // Consumes at most (1 << log_heap_space) bytes on the heap: + explicit SimdBlockFilterFixed(const int bits); + ~SimdBlockFilterFixed() noexcept; + void Add(const uint64_t key) noexcept; + + // Add multiple items to the filter. + void AddAll(const vector & data, const size_t start, const size_t end) { + return AddAll(data.data(), start,end); + } + void AddAll(const uint64_t* data, const size_t start, const size_t end); + + bool Find(const uint64_t key) const noexcept; + uint64_t SizeInBytes() const { return sizeof(Bucket) * bucketCount; } + + private: + // A helper function for Insert()/Find(). Turns a 32-bit hash into a 256-bit Bucket + // with 1 single 1-bit set in each 32-bit lane. + static __m256i MakeMask(const uint32_t hash) noexcept; + + void ApplyBlock(uint64_t* tmp, int block, int len); + +}; + +template +SimdBlockFilterFixed::SimdBlockFilterFixed(const int bits) + // bits / 16: fpp 0.1777%, 75.1% + // bits / 20: fpp 0.4384%, 63.4% + // bits / 22: fpp 0.6692%, 61.1% + // bits / 24: fpp 0.9765%, 59.7% <<== seems to be best (1% fpp seems important) + // bits / 26: fpp 1.3769%, 59.3% + // bits / 28: fpp 1.9197%, 60.3% + // bits / 32: fpp 3.3280%, 63.0% + : bucketCount(::std::max(1, bits / 24)), + directory_(nullptr), + hasher_() { + if (!__builtin_cpu_supports("avx2")) { + throw ::std::runtime_error("SimdBlockFilterFixed does not work without AVX2 instructions"); + } + const size_t alloc_size = bucketCount * sizeof(Bucket); + const int malloc_failed = + posix_memalign(reinterpret_cast(&directory_), 64, alloc_size); + if (malloc_failed) throw ::std::bad_alloc(); + memset(directory_, 0, alloc_size); +} + +template +SimdBlockFilterFixed::~SimdBlockFilterFixed() noexcept { + free(directory_); + directory_ = nullptr; +} + +// The SIMD reinterpret_casts technically violate C++'s strict aliasing rules. However, we +// compile with -fno-strict-aliasing. +template +[[gnu::always_inline]] inline __m256i +SimdBlockFilterFixed::MakeMask(const uint32_t hash) noexcept { + const __m256i ones = _mm256_set1_epi32(1); + // Odd contants for hashing: + const __m256i rehash = _mm256_setr_epi32(0x47b6137bU, 0x44974d91U, 0x8824ad5bU, + 0xa2b7289dU, 0x705495c7U, 0x2df1424bU, 0x9efc4947U, 0x5c6bfb31U); + // Load hash into a YMM register, repeated eight times + __m256i hash_data = _mm256_set1_epi32(hash); + // Multiply-shift hashing ala Dietzfelbinger et al.: multiply 'hash' by eight different + // odd constants, then keep the 5 most significant bits from each product. + hash_data = _mm256_mullo_epi32(rehash, hash_data); + hash_data = _mm256_srli_epi32(hash_data, 27); + // Use these 5 bits to shift a single bit to a location in each 32-bit lane + return _mm256_sllv_epi32(ones, hash_data); +} + +template +[[gnu::always_inline]] inline void +SimdBlockFilterFixed::Add(const uint64_t key) noexcept { + const auto hash = hasher_(key); + const uint32_t bucket_idx = reduce(rotl64(hash, 32), bucketCount); + const __m256i mask = MakeMask(hash); + __m256i* const bucket = &reinterpret_cast<__m256i*>(directory_)[bucket_idx]; + _mm256_store_si256(bucket, _mm256_or_si256(*bucket, mask)); +} + +const int blockShift = 14; +const int blockLen = 1 << blockShift; + +template +void SimdBlockFilterFixed::ApplyBlock(uint64_t* tmp, int block, int len) { + for (int i = 0; i < len; i += 2) { + uint64_t hash = tmp[(block << blockShift) + i]; + uint32_t bucket_idx = tmp[(block << blockShift) + i + 1]; + const __m256i mask = MakeMask(hash); + __m256i* const bucket = &reinterpret_cast<__m256i*>(directory_)[bucket_idx]; + _mm256_store_si256(bucket, _mm256_or_si256(*bucket, mask)); + } +} + +template +void SimdBlockFilterFixed::AddAll( + const uint64_t* keys, const size_t start, const size_t end) { + int blocks = 1 + bucketCount / blockLen; + uint64_t* tmp = new uint64_t[blocks * blockLen]; + int* tmpLen = new int[blocks](); + for(size_t i = start; i < end; i++) { + uint64_t key = keys[i]; + uint64_t hash = hasher_(key); + uint32_t bucket_idx = reduce(rotl64(hash, 32), bucketCount); + int block = bucket_idx >> blockShift; + int len = tmpLen[block]; + tmp[(block << blockShift) + len] = hash; + tmp[(block << blockShift) + len + 1] = bucket_idx; + tmpLen[block] = len + 2; + if (len + 2 == blockLen) { + ApplyBlock(tmp, block, len + 1); + tmpLen[block] = 0; + } + } + for (int block = 0; block < blocks; block++) { + ApplyBlock(tmp, block, tmpLen[block]); + } + delete[] tmp; + delete[] tmpLen; +} + +template +[[gnu::always_inline]] inline bool +SimdBlockFilterFixed::Find(const uint64_t key) const noexcept { + const auto hash = hasher_(key); + const uint32_t bucket_idx = reduce(rotl64(hash, 32), bucketCount); + const __m256i mask = MakeMask(hash); + const __m256i bucket = reinterpret_cast<__m256i*>(directory_)[bucket_idx]; + // We should return true if 'bucket' has a one wherever 'mask' does. _mm256_testc_si256 + // takes the negation of its first argument and ands that with its second argument. In + // our case, the result is zero everywhere iff there is a one in 'bucket' wherever + // 'mask' is one. testc returns 1 if the result is 0 everywhere and returns 0 otherwise. + return _mm256_testc_si256(bucket, mask); +} + +/////////////////////////////////////////////////////////////////// +/// 64-byte version +/////////////////////////////////////////////////////////////////// + + +struct mask64bytes { + __m256i first; + __m256i second; +}; + +typedef struct mask64bytes mask64bytes_t; + +template +class SimdBlockFilterFixed64 { + private: + // The filter is divided up into Buckets: + using Bucket = mask64bytes_t; + + const int bucketCount; + + Bucket* directory_; + + HashFamily hasher_; + + public: + // Consumes at most (1 << log_heap_space) bytes on the heap: + explicit SimdBlockFilterFixed64(const int bits); + ~SimdBlockFilterFixed64() noexcept; + void Add(const uint64_t key) noexcept; + + bool Find(const uint64_t key) const noexcept; + uint64_t SizeInBytes() const { return sizeof(Bucket) * bucketCount; } + + private: + static mask64bytes_t MakeMask(const uint64_t hash) noexcept; + + +}; + +template +SimdBlockFilterFixed64::SimdBlockFilterFixed64(const int bits) + + : bucketCount(::std::max(1, bits / 50)), + directory_(nullptr), + hasher_() { + if (!__builtin_cpu_supports("avx2")) { + throw ::std::runtime_error("SimdBlockFilterFixed64 does not work without AVX2 instructions"); + } + const size_t alloc_size = bucketCount * sizeof(Bucket); + const int malloc_failed = + posix_memalign(reinterpret_cast(&directory_), 64, alloc_size); + if (malloc_failed) throw ::std::bad_alloc(); + memset(directory_, 0, alloc_size); +} + +template +SimdBlockFilterFixed64::~SimdBlockFilterFixed64() noexcept { + free(directory_); + directory_ = nullptr; +} + + + +template +[[gnu::always_inline]] inline mask64bytes_t +SimdBlockFilterFixed64::MakeMask(const uint64_t hash) noexcept { + const __m256i ones = _mm256_set1_epi64x(1); + const __m256i rehash1 = _mm256_setr_epi32(0x47b6137bU, 0x44974d91U, 0x8824ad5bU, + 0xa2b7289dU, 0x705495c7U, 0x2df1424bU, 0x9efc4947U, 0x5c6bfb31U); + mask64bytes_t answer; + __m256i hash_data = _mm256_set1_epi32(hash); + __m256i h = _mm256_mullo_epi32(rehash1, hash_data); + h = _mm256_srli_epi32(h, 26); + answer.first = _mm256_unpackhi_epi32(h,_mm256_setzero_si256()); + answer.first = _mm256_sllv_epi64(ones, answer.first); + answer.second = _mm256_unpacklo_epi32(h,_mm256_setzero_si256()); + answer.second = _mm256_sllv_epi64(ones, answer.second); + return answer; +} + +template +[[gnu::always_inline]] inline void +SimdBlockFilterFixed64::Add(const uint64_t key) noexcept { + const auto hash = hasher_(key); + const uint32_t bucket_idx = reduce(rotl64(hash, 32), bucketCount); + mask64bytes_t mask = MakeMask(hash); + mask64bytes_t* const bucket = &reinterpret_cast(directory_)[bucket_idx]; + bucket->first = _mm256_or_si256(mask.first, bucket->first); + bucket->second= _mm256_or_si256(mask.second, bucket->second); +} + +template +[[gnu::always_inline]] inline bool +SimdBlockFilterFixed64::Find(const uint64_t key) const noexcept { + const auto hash = hasher_(key); + const uint32_t bucket_idx = reduce(rotl64(hash, 32), bucketCount); + const mask64bytes_t mask = MakeMask(hash); + const mask64bytes_t bucket = reinterpret_cast(directory_)[bucket_idx]; + return _mm256_testc_si256(bucket.first, mask.first) & _mm256_testc_si256(bucket.second, mask.second); +} + +#endif //__AVX2__ + +/////////////////// +// 16-byte version ARM +////////////////// +#ifdef __aarch64__ +#include + +template +class SimdBlockFilterFixed { + private: + // The filter is divided up into Buckets: + using Bucket = uint16x8_t; + + const int bucketCount; + + Bucket* directory_; + + HashFamily hasher_; + + public: + // Consumes at most (1 << log_heap_space) bytes on the heap: + explicit SimdBlockFilterFixed(const int bits); + ~SimdBlockFilterFixed() noexcept; + void Add(const uint64_t key) noexcept; + + // Add multiple items to the filter. + void AddAll(const vector& data, const size_t start, const size_t end) { + return AddAll(data.data(),start,end); + } + + void AddAll(const uint64_t* data, const size_t start, const size_t end); + + bool Find(const uint64_t key) const noexcept; + uint64_t SizeInBytes() const { return sizeof(Bucket) * bucketCount; } + + private: + // A helper function for Insert()/Find(). Turns a 32-bit hash into a 256-bit Bucket + // with 1 single 1-bit set in each 32-bit lane. + static Bucket MakeMask(const uint16_t hash) noexcept; + + void ApplyBlock(uint64_t* tmp, int block, int len); + +}; + +template +SimdBlockFilterFixed::SimdBlockFilterFixed(const int bits) + : bucketCount(::std::max(1, bits / 10)), + directory_(nullptr), + hasher_() { + const size_t alloc_size = bucketCount * sizeof(Bucket); + const int malloc_failed = + posix_memalign(reinterpret_cast(&directory_), 64, alloc_size); + if (malloc_failed) throw ::std::bad_alloc(); + memset(directory_, 0, alloc_size); +} + +template +SimdBlockFilterFixed::~SimdBlockFilterFixed() noexcept { + free(directory_); + directory_ = nullptr; +} + +template +[[gnu::always_inline]] inline uint16x8_t +SimdBlockFilterFixed::MakeMask(const uint16_t hash) noexcept { + const uint16x8_t ones = {1,1,1,1,1,1,1,1}; + const uint16x8_t rehash = {0x79d8, 0xe722, 0xf2fb, 0x21ec, 0x121b, 0x2302, 0x705a, 0x6e87}; + uint16x8_t hash_data = {hash,hash,hash,hash,hash,hash,hash,hash}; + uint16x8_t answer = vmulq_u16(hash_data,rehash); + answer = vshrq_n_u16(answer, 12); + answer = vshlq_u16(ones, vreinterpretq_s16_u16(answer)); + return answer; +} + +template +[[gnu::always_inline]] inline void +SimdBlockFilterFixed::Add(const uint64_t key) noexcept { + const auto hash = hasher_(key); + const uint32_t bucket_idx = reduce(rotl64(hash, 32), bucketCount); + const uint16x8_t mask = MakeMask(hash); + uint16x8_t bucket = directory_[bucket_idx]; + directory_[bucket_idx] = vorrq_u16(mask, bucket); +} + +template +[[gnu::always_inline]] inline bool +SimdBlockFilterFixed::Find(const uint64_t key) const noexcept { + const auto hash = hasher_(key); + const uint32_t bucket_idx = reduce(rotl64(hash, 32), bucketCount); + const uint16x8_t mask = MakeMask(hash); + const uint16x8_t bucket = directory_[bucket_idx]; + uint16x8_t an = vbicq_u16(mask, bucket); + uint64x2_t v64 = vreinterpretq_u64_u16(an); + uint32x2_t v32 = vqmovn_u64(v64); + uint64x1_t result = vreinterpret_u64_u32(v32); + return vget_lane_u64(result, 0) == 0; +} + + + +#endif // __aarch64__ + + +/////////////////////////////////////////////////////////////////// +/// 16-byte version (not very good) +/////////////////////////////////////////////////////////////////// + +#ifdef __SSE4_1__ + +#include + +template +class SimdBlockFilterFixed16 { + private: + // The filter is divided up into Buckets: + using Bucket = __m128i; + + const int bucketCount; + + Bucket* directory_; + + HashFamily hasher_; + + public: + // Consumes at most (1 << log_heap_space) bytes on the heap: + explicit SimdBlockFilterFixed16(const int bits); + ~SimdBlockFilterFixed16() noexcept; + void Add(const uint64_t key) noexcept; + + bool Find(const uint64_t key) const noexcept; + uint64_t SizeInBytes() const { return sizeof(Bucket) * bucketCount; } + + private: + static __m128i MakeMask(const uint64_t hash) noexcept; + + +}; + +template +SimdBlockFilterFixed16::SimdBlockFilterFixed16(const int bits) + + : bucketCount(::std::max(1, bits / 10)), + directory_(nullptr), + hasher_() { + const size_t alloc_size = bucketCount * sizeof(Bucket); + const int malloc_failed = + posix_memalign(reinterpret_cast(&directory_), 64, alloc_size); + if (malloc_failed) throw ::std::bad_alloc(); + memset(directory_, 0, alloc_size); +} + +template +SimdBlockFilterFixed16::~SimdBlockFilterFixed16() noexcept { + free(directory_); + directory_ = nullptr; +} + + +template +[[gnu::always_inline]] inline __m128i +SimdBlockFilterFixed16::MakeMask(const uint64_t hash) noexcept { + const __m128i rehash1 = _mm_setr_epi16(0x47b5, 0x4497, 0x8823, + 0xa2b7, 0x7053, 0x2df1, 0x9efc, 0x5c6b); + __m128i hash_data = _mm_set1_epi32(hash ); + __m128i h = _mm_mulhi_epi16(rehash1, hash_data); +return _mm_shuffle_epi8(_mm_set_epi8(1,2,4,8,16,32,64,-128,1,2,4,8,16,32,64,-128),h); +} + + + + +template +[[gnu::always_inline]] inline void +SimdBlockFilterFixed16::Add(const uint64_t key) noexcept { + const auto hash = hasher_(key); + const uint32_t bucket_idx = reduce(rotl64(hash, 32), bucketCount); + __m128i mask = MakeMask(hash); + __m128i* const bucket = reinterpret_cast<__m128i*>(directory_) + bucket_idx; + __m128i bucketvalue = _mm_loadu_si128(bucket); + bucketvalue = _mm_or_si128(bucketvalue, mask); + _mm_storeu_si128(bucket,bucketvalue); +} + +template +[[gnu::always_inline]] inline bool +SimdBlockFilterFixed16::Find(const uint64_t key) const noexcept { + const auto hash = hasher_(key); + const uint32_t bucket_idx = reduce(rotl64(hash, 32), bucketCount); + const __m128i mask = MakeMask(hash); + __m128i* const bucket = reinterpret_cast<__m128i*>(directory_) + bucket_idx; + __m128i bucketvalue = _mm_loadu_si128(bucket); + return _mm_testc_si128(bucketvalue,mask); +} + +#endif // #ifdef __SSE41__ diff --git a/cuckoofilter/src/simd-block.h b/cuckoofilter/src/simd-block.h new file mode 100644 index 0000000..4452ce4 --- /dev/null +++ b/cuckoofilter/src/simd-block.h @@ -0,0 +1,141 @@ +// // Copied from Apache Impala (incubating), usable under the terms in the Apache License, +// // Version 2.0. + +// // This is a block Bloom filter (from Putze et al.'s "Cache-, Hash- and Space-Efficient +// // Bloom Filters") with some twists: +// // +// // 1. Each block is a split Bloom filter - see Section 2.1 of Broder and Mitzenmacher's +// // "Network Applications of Bloom Filters: A Survey". +// // +// // 2. The number of bits set per Add() is contant in order to take advantage of SIMD +// // instructions. + +// #pragma once + +// #include +// #include + +// #include +// #include + +// #include + +// #include "hashutil.h" + +// using uint32_t = ::std::uint32_t; +// using uint64_t = ::std::uint64_t; + +// template +// class SimdBlockFilter { +// private: +// // The filter is divided up into Buckets: +// using Bucket = uint32_t[8]; + +// // log2(number of bytes in a bucket): +// static constexpr int LOG_BUCKET_BYTE_SIZE = 5; + +// static_assert( +// (1 << LOG_BUCKET_BYTE_SIZE) == sizeof(Bucket) && sizeof(Bucket) == sizeof(__m256i), +// "Bucket sizing has gone awry."); + +// // log_num_buckets_ is the log (base 2) of the number of buckets in the directory: +// const int log_num_buckets_; + +// // directory_mask_ is (1 << log_num_buckets_) - 1. It is precomputed in the contructor +// // for efficiency reasons: +// const uint32_t directory_mask_; + +// Bucket* directory_; + +// HashFamily hasher_; + +// public: +// // Consumes at most (1 << log_heap_space) bytes on the heap: +// explicit SimdBlockFilter(const int log_heap_space); +// SimdBlockFilter(SimdBlockFilter&& that) +// : log_num_buckets_(that.log_num_buckets_), +// directory_mask_(that.directory_mask_), +// directory_(that.directory_), +// hasher_(that.hasher_) {} +// ~SimdBlockFilter() noexcept; +// void Add(const uint64_t key) noexcept; +// bool Find(const uint64_t key) const noexcept; +// uint64_t SizeInBytes() const { return sizeof(Bucket) * (1ull << log_num_buckets_); } + +// private: +// // A helper function for Insert()/Find(). Turns a 32-bit hash into a 256-bit Bucket +// // with 1 single 1-bit set in each 32-bit lane. +// static __m256i MakeMask(const uint32_t hash) noexcept; + +// SimdBlockFilter(const SimdBlockFilter&) = delete; +// void operator=(const SimdBlockFilter&) = delete; +// }; + +// template +// SimdBlockFilter::SimdBlockFilter(const int log_heap_space) +// : // Since log_heap_space is in bytes, we need to convert it to the number of Buckets +// // we will use. +// log_num_buckets_(::std::max(1, log_heap_space - LOG_BUCKET_BYTE_SIZE)), +// // Don't use log_num_buckets_ if it will lead to undefined behavior by a shift that is +// // too large. +// directory_mask_((1ull << ::std::min(63, log_num_buckets_)) - 1), +// directory_(nullptr), +// hasher_() { +// if (!__builtin_cpu_supports("avx2")) { +// throw ::std::runtime_error("SimdBlockFilter does not work without AVX2 instructions"); +// } +// const size_t alloc_size = 1ull << (log_num_buckets_ + LOG_BUCKET_BYTE_SIZE); +// const int malloc_failed = +// posix_memalign(reinterpret_cast(&directory_), 64, alloc_size); +// if (malloc_failed) throw ::std::bad_alloc(); +// memset(directory_, 0, alloc_size); +// } + +// template +// SimdBlockFilter::~SimdBlockFilter() noexcept { +// free(directory_); +// directory_ = nullptr; +// } + +// // The SIMD reinterpret_casts technically violate C++'s strict aliasing rules. However, we +// // compile with -fno-strict-aliasing. +// template +// [[gnu::always_inline]] inline __m256i +// SimdBlockFilter::MakeMask(const uint32_t hash) noexcept { +// const __m256i ones = _mm256_set1_epi32(1); +// // Odd contants for hashing: +// const __m256i rehash = _mm256_setr_epi32(0x47b6137bU, 0x44974d91U, 0x8824ad5bU, +// 0xa2b7289dU, 0x705495c7U, 0x2df1424bU, 0x9efc4947U, 0x5c6bfb31U); +// // Load hash into a YMM register, repeated eight times +// __m256i hash_data = _mm256_set1_epi32(hash); +// // Multiply-shift hashing ala Dietzfelbinger et al.: multiply 'hash' by eight different +// // odd constants, then keep the 5 most significant bits from each product. +// hash_data = _mm256_mullo_epi32(rehash, hash_data); +// hash_data = _mm256_srli_epi32(hash_data, 27); +// // Use these 5 bits to shift a single bit to a location in each 32-bit lane +// return _mm256_sllv_epi32(ones, hash_data); +// } + +// template +// [[gnu::always_inline]] inline void +// SimdBlockFilter::Add(const uint64_t key) noexcept { +// const auto hash = hasher_(key); +// const uint32_t bucket_idx = hash & directory_mask_; +// const __m256i mask = MakeMask(hash >> log_num_buckets_); +// __m256i* const bucket = &reinterpret_cast<__m256i*>(directory_)[bucket_idx]; +// _mm256_store_si256(bucket, _mm256_or_si256(*bucket, mask)); +// } + +// template +// [[gnu::always_inline]] inline bool +// SimdBlockFilter::Find(const uint64_t key) const noexcept { +// const auto hash = hasher_(key); +// const uint32_t bucket_idx = hash & directory_mask_; +// const __m256i mask = MakeMask(hash >> log_num_buckets_); +// const __m256i bucket = reinterpret_cast<__m256i*>(directory_)[bucket_idx]; +// // We should return true if 'bucket' has a one wherever 'mask' does. _mm256_testc_si256 +// // takes the negation of its first argument and ands that with its second argument. In +// // our case, the result is zero everywhere iff there is a one in 'bucket' wherever +// // 'mask' is one. testc returns 1 if the result is 0 everywhere and returns 0 otherwise. +// return _mm256_testc_si256(bucket, mask); +// } diff --git a/cuckoofilter/src/singletable.h b/cuckoofilter/src/singletable.h new file mode 100644 index 0000000..7235264 --- /dev/null +++ b/cuckoofilter/src/singletable.h @@ -0,0 +1,268 @@ +#ifndef CUCKOO_FILTER_SINGLE_TABLE_H_ +#define CUCKOO_FILTER_SINGLE_TABLE_H_ + +#include + +#include + +#include "bitsutil.h" +#include "debug.h" +#include "printutil.h" + +namespace cuckoofilter { + +constexpr size_t t_bits_per_tag = 12; +constexpr size_t t_tags = 4; +constexpr size_t t_bytesPerBucket = (t_bits_per_tag * t_tags + 7) >> 3; +constexpr size_t t_PaddingBuckets = + ((((t_bytesPerBucket + 7) / 8) * 8) - 1) / t_bytesPerBucket; + +// the most naive table implementation: one huge bit array +template +class SingleTable { + static const size_t kTagsPerBucket = 4; + static const size_t kBytesPerBucket = + (bits_per_tag * kTagsPerBucket + 7) >> 3; + static const uint32_t kTagMask = (1ULL << bits_per_tag) - 1; + // NOTE: accomodate extra buckets if necessary to avoid overrun + // as we always read a uint64 + static const size_t kPaddingBuckets = + ((((kBytesPerBucket + 7) / 8) * 8) - 1) / kBytesPerBucket; + + struct Bucket { + char bits_[kBytesPerBucket]; + } __attribute__((__packed__)); + + // using a pointer adds one more indirection + Bucket *buckets_; + size_t num_buckets_; + + public: + explicit SingleTable(const size_t num) : num_buckets_(num) { + buckets_ = new Bucket[num_buckets_ + kPaddingBuckets]; + memset(buckets_, 0, kBytesPerBucket * (num_buckets_ + kPaddingBuckets)); + } + + ~SingleTable() { delete[] buckets_; } + + size_t NumBuckets() const { return num_buckets_; } + + size_t SizeInBytes() const { return kBytesPerBucket * num_buckets_; } + + size_t SizeInTags() const { return kTagsPerBucket * num_buckets_; } + + std::string Info() const { + std::stringstream ss; + ss << "SingleHashtable with tag size: " << bits_per_tag << " bits \n"; + ss << "\t\tAssociativity: " << kTagsPerBucket << "\n"; + ss << "\t\tTotal # of rows: " << num_buckets_ << "\n"; + ss << "\t\tTotal # slots: " << SizeInTags() << "\n"; + return ss.str(); + } + + // read tag from pos(i,j) + inline uint32_t ReadTag(const size_t i, const size_t j) const { + const char *p = buckets_[i].bits_; + uint32_t tag; + /* following code only works for little-endian */ + if (bits_per_tag == 2) { + tag = *((uint8_t *)p) >> (j * 2); + } else if (bits_per_tag == 4) { + p += (j >> 1); + tag = *((uint8_t *)p) >> ((j & 1) << 2); + } else if (bits_per_tag == 8) { + p += j; + tag = *((uint8_t *)p); + } else if (bits_per_tag == 12) { + p += j + (j >> 1); + tag = *((uint16_t *)p) >> ((j & 1) << 2); + } else if (bits_per_tag == 16) { + p += (j << 1); + tag = *((uint16_t *)p); + } else if (bits_per_tag == 32) { + tag = ((uint32_t *)p)[j]; + } + return tag & kTagMask; + } + + // write tag to pos(i,j) + inline void WriteTag(const size_t i, const size_t j, const uint32_t t) { + char *p = buckets_[i].bits_; + uint32_t tag = t & kTagMask; + /* following code only works for little-endian */ + if (bits_per_tag == 2) { + *((uint8_t *)p) |= tag << (2 * j); + } else if (bits_per_tag == 4) { + p += (j >> 1); + if ((j & 1) == 0) { + *((uint8_t *)p) &= 0xf0; + *((uint8_t *)p) |= tag; + } else { + *((uint8_t *)p) &= 0x0f; + *((uint8_t *)p) |= (tag << 4); + } + } else if (bits_per_tag == 8) { + ((uint8_t *)p)[j] = tag; + } else if (bits_per_tag == 12) { + p += (j + (j >> 1)); + if ((j & 1) == 0) { + ((uint16_t *)p)[0] &= 0xf000; + ((uint16_t *)p)[0] |= tag; + } else { + ((uint16_t *)p)[0] &= 0x000f; + ((uint16_t *)p)[0] |= (tag << 4); + } + } else if (bits_per_tag == 16) { + ((uint16_t *)p)[j] = tag; + } else if (bits_per_tag == 32) { + ((uint32_t *)p)[j] = tag; + } + } + + inline bool FindTagInBuckets(const size_t i1, const size_t i2, + const uint32_t tag) const { + + // size_t t = 0; // with 0 about 4.4 E7 + // __asm__ volatile("incq %0" :: "m" (t)); // with 0 about 3.9 E7 + // __asm__ volatile("incq %0" :: "m" (t)); // with 0 about 3.9 E7 + // __asm__ volatile("incq %0" :: "m" (t)); // with 0 about 3.75 E7 + // __asm__ volatile("incq %0" :: "m" (t)); // with 0 about 3.0 E7 + // __asm__ volatile("incq %0" :: "m" (t)); // with 0 about 3.0 E7 + // __asm__ volatile("incq %0" :: "m" (t)); // with 0 about 3.0 E7 + // __asm__ volatile("incq %0" :: "m" (t)); // with 0 about 3.0 E7 + // __asm__ volatile("incq %0" :: "m" (t)); // with 0 about 3.0 E7 + // __asm__ volatile("incq %0" :: "m" (t)); // with 0 about 3.0 E7 + // __asm__ volatile("incq %0" :: "m" (t)); // with 0 about 3.0 E7 + // __asm__ volatile("incq %0" :: "m" (t)); // with 0 about 3.0 E7 + // __asm__ volatile("incq %0" :: "m" (t)); // with 0 about 3.0 E7 + // __asm__ volatile("incq %0" :: "m" (t)); // with 0 about 3.0 E7 + // size_t t1 = 0, t2 = 0, t3 = 0, t4 = 0; + // __asm__ volatile("incq %0" :: "m" (t1)); + // __asm__ volatile("incq %0" :: "m" (t2)); + // __asm__ volatile("incq %0" :: "m" (t3)); + // __asm__ volatile("incq %0" :: "m" (t4)); + + const char *p1 = buckets_[i1].bits_; + const char *p2 = buckets_[i2].bits_; + + uint64_t v1 = *((uint64_t *)p1); + uint64_t v2 = *((uint64_t *)p2); + + // caution: unaligned access & assuming little endian + if (bits_per_tag == 4 && kTagsPerBucket == 4) { + return hasvalue4(v1, tag) || hasvalue4(v2, tag); + } else if (bits_per_tag == 8 && kTagsPerBucket == 4) { + return hasvalue8(v1, tag) || hasvalue8(v2, tag); + } else if (bits_per_tag == 12 && kTagsPerBucket == 4) { + return hasvalue12(v1, tag) || hasvalue12(v2, tag); + } else if (bits_per_tag == 16 && kTagsPerBucket == 4) { + return hasvalue16(v1, tag) || hasvalue16(v2, tag); + } else { + for (size_t j = 0; j < kTagsPerBucket; j++) { + if ((ReadTag(i1, j) == tag) || (ReadTag(i2, j) == tag)) { + return true; + } + } + return false; + } + } + + inline bool FindTagInBucket(const size_t i, const uint32_t tag) const { + // caution: unaligned access & assuming little endian + const char *p = buckets_[i].bits_; + uint64_t v = *(uint64_t *)p; // uint16_t may suffice + if (bits_per_tag == 4 && kTagsPerBucket == 4) { + return hasvalue4(v, tag); + } else if (bits_per_tag == 8 && kTagsPerBucket == 4) { + // const char *p = buckets_[i].bits_; + // uint64_t v = *(uint64_t *)p; // uint32_t may suffice + return hasvalue8(v, tag); + } else if (bits_per_tag == 12 && kTagsPerBucket == 4) { + // const char *p = buckets_[i].bits_; + // uint64_t v = *(uint64_t *)p; + return hasvalue12(v, tag); + } else if (bits_per_tag == 16 && kTagsPerBucket == 4) { + // const char *p = buckets_[i].bits_; + // uint64_t v = *(uint64_t *)p; + return hasvalue16(v, tag); + } else { + for (size_t j = 0; j < kTagsPerBucket; j++) { + if (ReadTag(i, j) == tag) { + return true; + } + } + return false; + } + } + + inline bool DeleteTagFromBucket(const size_t i, const uint32_t tag) { + for (size_t j = 0; j < kTagsPerBucket; j++) { + if (ReadTag(i, j) == tag) { + assert(FindTagInBucket(i, tag) == true); + WriteTag(i, j, 0); + return true; + } + } + return false; + } + + inline bool InsertTagToBucket(const size_t i, const uint32_t tag, + const bool kickout, uint32_t &oldtag) { + // static unsigned slot_index = 0; + for (size_t j = 0; j < kTagsPerBucket; j++) { + if (ReadTag(i, j) == 0) { + WriteTag(i, j, tag); + return true; + } + } + if (kickout) { + size_t r = rand() % kTagsPerBucket; + // size_t r = slot_index; + // slot_index = (slot_index + 1) % kTagsPerBucket; + oldtag = ReadTag(i, r); + WriteTag(i, r, tag); + } + return false; + } + + inline size_t NumTagsInBucket(const size_t i) const { + size_t num = 0; + for (size_t j = 0; j < kTagsPerBucket; j++) { + if (ReadTag(i, j) != 0) { + num++; + } + } + return num; + } + + inline bool FindTagIn3Buckets(const size_t i1, const size_t i2, + const size_t i3, const uint32_t tag) const { + const char *p1 = buckets_[i1].bits_; + const char *p2 = buckets_[i2].bits_; + const char *p3 = buckets_[i3].bits_; + + uint64_t v1 = *((uint64_t *)p1); + uint64_t v2 = *((uint64_t *)p2); + uint64_t v3 = *((uint64_t *)p3); + + // caution: unaligned access & assuming little endian + if (bits_per_tag == 4 && kTagsPerBucket == 4) { + return hasvalue4(v1, tag) || hasvalue4(v2, tag) || hasvalue4(v3, tag); + } else if (bits_per_tag == 8 && kTagsPerBucket == 4) { + return hasvalue8(v1, tag) || hasvalue8(v2, tag) || hasvalue8(v3, tag); + } else if (bits_per_tag == 12 && kTagsPerBucket == 4) { + return hasvalue12(v1, tag) || hasvalue12(v2, tag) || hasvalue12(v3, tag); + } else if (bits_per_tag == 16 && kTagsPerBucket == 4) { + return hasvalue16(v1, tag) || hasvalue16(v2, tag) || hasvalue16(v3, tag); + } else { + for (size_t j = 0; j < kTagsPerBucket; j++) { + if ((ReadTag(i1, j) == tag) || (ReadTag(i2, j) == tag)) { + return true; + } + } + return false; + } + } +}; +} // namespace cuckoofilter +#endif // CUCKOO_FILTER_SINGLE_TABLE_H_ diff --git a/example.cpp b/example.cpp new file mode 100644 index 0000000..cdbd19d --- /dev/null +++ b/example.cpp @@ -0,0 +1,20 @@ +#include "Tests/wrappers.hpp" + +int main(){ + using spare = TC_shortcut; // Any incremental filter can replace TC_shortcut. + using prefixFilter = Prefix_Filter; // + + size_t filter_max_capacity = 1'000'000; // Choose any size. + prefixFilter example_filter = FilterAPI::ConstructFromAddCount(filter_max_capacity); + + uint64_t x1 = 0x0123'4567'89ab'cdef; + FilterAPI::Add(x1, &example_filter); // Insertions of an item x1. Insertion can be performed only one step at a time. + + bool res = FilterAPI::Contain(x1, &example_filter); // Lookup of x1. + assert(res); //No false negative. + + uint64_t y1 = ~0x0123'4567'89ab'cdef; + bool res2 = FilterAPI::Contain(y1, &example_filter); // Lookup of y1. + std::cout << res2 << std::endl; // Possible false positive. (Although with one item in the filter, this is highly unlikely.) + return 0; +} \ No newline at end of file diff --git a/hashutil.h b/hashutil.h new file mode 100644 index 0000000..d288089 --- /dev/null +++ b/hashutil.h @@ -0,0 +1,289 @@ + +#ifndef HASHUTIL_H_ +#define HASHUTIL_H_ + +#include +#include +#include +#include +#include +#include +#include +#include +// #include "Hash_functions/BobJenkins.h" +// #include "Hash_functions/wyhash.h" +// #include "Hash_functions/xxhash64.h" +#include +#include +#include + +#include +#include + +// #include "Hash_functions/woothash.h" + +namespace hashing { + inline size_t sysrandom(void *dst, size_t dstlen) { + char *buffer = reinterpret_cast(dst); + std::ifstream stream("/dev/urandom", std::ios_base::binary | std::ios_base::in); + stream.read(buffer, dstlen); + + return dstlen; + } + + // See Martin Dietzfelbinger, "Universal hashing and k-wise independent random + // variables via integer arithmetic without primes". + class TwoIndependentMultiplyShift { + unsigned __int128 multiply_, add_; + + public: + TwoIndependentMultiplyShift() { + std::uint_least64_t seed; + sysrandom(&seed, sizeof(seed)); + std::mt19937_64 rng(seed); + std::uniform_int_distribution dist(0, UINT64_MAX); + + for (auto v : {&multiply_, &add_}) { + for (size_t i = 0; i < 8; i++) { + unsigned __int128 hi = dist(rng); + unsigned __int128 lo = dist(rng); + *v ^= (hi << 64) | lo; + } + } + } + /* // ::std::random_device random; + // for (auto v : {&multiply_, &add_}) { + // *v = random(); + // for (int i = 1; i <= 4; ++i) { + // *v = *v << 32; + // *v |= random(); + // } + // } + } + + // + // * @brief Construct a new Two Independent Multiply Shift object + // * Disable the randomness for debugging. + // * + // * @param seed1 Garbage + // * @param seed2 Garbage + // + // TwoIndependentMultiplyShift(unsigned __int128 seed1, unsigned __int128 seed2) { + // std::cout << "hash function is pseudo random" << std::endl; + + // multiply_ = 0xaaaa'bbbb'cccc'dddd; + // multiply_ <<= 64; + // multiply_ |= 0xeeee'ffff'1111'0000; + // add_ = 0xaaaa'aaaa'bbbb'bbbb; + // add_ <<= 64; + // add_ |= 0xcccc'cccc'dddd'dddd; + + // assert(multiply_ > 18446744073709551615ULL); + // assert(add_ > 18446744073709551615ULL); + // } */ + + inline uint64_t operator()(uint64_t key) const { + return (add_ + multiply_ * static_cast(key)) >> 64; + } + + inline uint32_t hash32(uint64_t key) const { + return ((uint32_t) (add_ + multiply_ * static_cast(key))); + } + auto get_name() const -> std::string { + return "TwoIndependentMultiplyShift"; + } + }; + + + /** + * @brief Like others, only with redundancies, to produce more operations. + * + */ + class IdioticHash { + unsigned __int128 multiply_, add_; + unsigned __int128 multiply_2, add_2; + + public: + IdioticHash() { + std::uint_least64_t seed; + sysrandom(&seed, sizeof(seed)); + std::mt19937_64 rng(seed); + std::uniform_int_distribution dist(0, UINT64_MAX); + + for (auto v : {&multiply_, &add_}) { + for (size_t i = 0; i < 8; i++) { + unsigned __int128 hi = dist(rng); + unsigned __int128 lo = dist(rng); + *v ^= (hi << 64) | lo; + } + } + + for (auto v : {&multiply_2, &add_2}) { + for (size_t i = 0; i < 8; i++) { + unsigned __int128 hi = dist(rng); + unsigned __int128 lo = dist(rng); + *v ^= (hi << 64) | lo; + } + } + } + + static inline uint64_t select64(uint64_t x, int64_t j) { + assert(j < 64); + const uint64_t y = _pdep_u64(UINT64_C(1) << j, x); + return _tzcnt_u64(y); + } + + inline uint64_t operator()(uint64_t key) const { + auto res1 = (add_ + multiply_ * static_cast(key)) >> 64; + auto res2 = (add_2 + multiply_2 * static_cast(key)) >> 64; + + size_t index = _mm_popcnt_u64(key); + size_t pos = select64(key, index / 2); + if (pos & 1) + return res1; + return res2; + } + + auto get_name() const -> std::string { + return "IdioticHash"; + } + }; + + // See Patrascu and Thorup's "The Power of Simple Tabulation Hashing" + class SimpleTabulation { + uint64_t tables_[sizeof(uint64_t)][1 << CHAR_BIT]; + + public: + SimpleTabulation() { + std::uint_least64_t seed; + sysrandom(&seed, sizeof(seed)); + std::mt19937_64 rng(seed); + std::uniform_int_distribution dist(0, UINT64_MAX); + for (unsigned i = 0; i < sizeof(uint64_t); ++i) { + for (int j = 0; j < (1 << CHAR_BIT); ++j) { + tables_[i][j] = dist(rng); + } + } + } + + uint64_t operator()(uint64_t key) const { + uint64_t result = 0; + for (unsigned i = 0; i < sizeof(key); ++i) { + result ^= tables_[i][reinterpret_cast(&key)[i]]; + } + return result; + } + }; + + class SimpleMixSplit { + + public: + uint64_t seed; + + SimpleMixSplit() { + std::uint_least64_t seed; + sysrandom(&seed, sizeof(seed)); + std::mt19937_64 rng(seed); + std::uniform_int_distribution dist(0, UINT64_MAX); + seed = dist(rng); + // seed <<= 32; + // seed |= random(); + } + + inline static uint64_t murmur64(uint64_t h) { + h ^= h >> 33; + h *= UINT64_C(0xff51afd7ed558ccd); + h ^= h >> 33; + h *= UINT64_C(0xc4ceb9fe1a85ec53); + h ^= h >> 33; + return h; + } + + inline uint64_t operator()(uint64_t key) const { + return murmur64(key + seed); + } + }; + + // class my_xxhash64 { + // uint64_t seed; + + // public: + // my_xxhash64() { + // seed = random(); + // } + // inline uint64_t operator()(uint64_t key) const { + // return XXHash64::hash(&key, 8, seed); + // } + // auto get_name() const -> std::string { + // return "xxhash64"; + // } + // }; + + // class my_wyhash64 { + // uint64_t seed; + + // public: + // my_wyhash64() { + // seed = random(); + // } + // inline uint64_t operator()(uint64_t key) const { + // return wyhash64(key, seed); + // } + + // auto get_name() const -> std::string { + // return "wyhash64"; + // } + // }; + + // class my_BobHash { + // uint64_t seed1, seed2; + + // public: + // my_BobHash() { + // seed1 = random(); + // seed2 = random(); + // } + + + // inline uint64_t operator()(uint32_t s) const { + // uint32_t out1 = seed1, out2 = seed2; + // void BobHash(const void *buf, size_t length, uint32_t *idx1, uint32_t *idx2); + // BobJenkins::BobHash((void *) &s, 4, &out1, &out2); + // return ((uint64_t) out1 << 32ul) | ((uint64_t) out2); + + // // return BobJenkins::BobHash((void *) &s, 4, seed); + // } + + // // inline uint64_t operator()(uint64_t s) const { + // // return BobJenkins::BobHash((void *) &s, 8, seed); + // // } + + // auto get_name() const -> std::string { + // return "BobHash"; + // } + // }; + + // inline uint32_t hashint(uint32_t a) { + // a = (a + 0x7ed55d16) + (a << 12); + // a = (a ^ 0xc761c23c) ^ (a >> 19); + // a = (a + 0x165667b1) + (a << 5); + // a = (a + 0xd3a2646c) ^ (a << 9); + // a = (a + 0xfd7046c5) + (a << 3); + // a = (a ^ 0xb55a4f09) ^ (a >> 16); + // return a; + // } + + // inline uint32_t hashint(uint64_t a) { + // a = (a + 0x7ed55d16) + (a << 12); + // a = (a ^ 0xc761c23c) ^ (a >> 19); + // a = (a + 0x165667b1) + (a << 5); + // a = (a + 0xd3a2646c) ^ (a << 9); + // a = (a + 0xfd7046c5) + (a << 3); + // a = (a ^ 0xb55a4f09) ^ (a >> 16); + // return a; + // } + + +}// namespace hashing + +#endif// CUCKOO_FILTER_HASHUTIL_H_ diff --git a/main-built.cpp b/main-built.cpp new file mode 100644 index 0000000..7b84554 --- /dev/null +++ b/main-built.cpp @@ -0,0 +1,85 @@ + +#include "Tests/smart_tests.hpp" + +void bench_to_csv(); + +int main() { + // constexpr int k1 = (int) ((double) 8 * 0.693147180559945 + 0.5); + // constexpr int k2 = (int) ((double) 12 * 0.693147180559945 + 0.5); + // constexpr int k3 = (int) ((double) 16 * 0.693147180559945 + 0.5); + bench_to_csv(); + return 0; +} + + +void bench_to_csv() { + using CF8 = cuckoofilter::CuckooFilter; + using CF12 = cuckoofilter::CuckooFilter; + using CF16 = cuckoofilter::CuckooFilter; + // using CF32 = cuckoofilter::CuckooFilter; + + using CF8_Flex = cuckoofilter::CuckooFilterStable; + using CF12_Flex = cuckoofilter::CuckooFilterStable; + // using CF16_Flex = cuckoofilter::CuckooFilterStable; + + using inc4 = Prefix_Filter>; + using inc6 = Prefix_Filter; + using inc8 = Prefix_Filter; + // using inc9 = Prefix_Filter>; + + using BBF = SimdBlockFilter<>; + using BBF_Fixed = SimdBlockFilterFixed<>; + + using L_BF8 = bloomfilter::BloomFilter; + using L_BF12 = bloomfilter::BloomFilter; + using L_BF16 = bloomfilter::BloomFilter; + + using CF12_Flex = cuckoofilter::CuckooFilterStable; + using CF16_Flex = cuckoofilter::CuckooFilterStable; + + constexpr size_t number_of_filters = 13; + // constexpr size_t db_speeder = 1; + constexpr size_t max_filter_capacity = ((1ULL << 28) * 94 / 100) / testSmart::db_speeder; + + std::stringstream ss_array[number_of_filters]; + std::string names[14] = {"Bloom-8[k=6]", "Bloom-12[k=8]", "Bloom-16[k=11]", + "CF-8", "CF-12", "CF-8-Flex", "CF-12-Flex","TC", + "PF[BBF_Fixed]", "PF[CF12-Flex]", "PF[TC]", + "BBF", "BBF_Fixed" //"Impala512" + }; + for (size_t j = 0; j < number_of_filters; j++) { + ss_array[j] << names[j] << ", "; + } + + for (size_t i = 0; i < testSmart::ROUNDS; i++) { + vector v_add; + size_t j = 0; + testSmart::fill_vec_smart(&v_add, max_filter_capacity); + ss_array[j++] << testSmart::bench_build_to_file22(max_filter_capacity, &v_add) << ", "; + ss_array[j++] << testSmart::bench_build_to_file22(max_filter_capacity, &v_add) << ", "; + ss_array[j++] << testSmart::bench_build_to_file22(max_filter_capacity, &v_add) << ", "; + ss_array[j++] << testSmart::bench_build_to_file22(max_filter_capacity, &v_add) << ", "; + ss_array[j++] << testSmart::bench_build_to_file22(max_filter_capacity, &v_add) << ", "; + ss_array[j++] << testSmart::bench_build_to_file22(max_filter_capacity, &v_add) << ", "; + ss_array[j++] << testSmart::bench_build_to_file22(max_filter_capacity, &v_add) << ", "; + ss_array[j++] << testSmart::bench_build_to_file22(max_filter_capacity, &v_add) << ", "; + ss_array[j++] << testSmart::bench_build_to_file22(max_filter_capacity, &v_add) << ", "; + ss_array[j++] << testSmart::bench_build_to_file22(max_filter_capacity, &v_add) << ", "; + ss_array[j++] << testSmart::bench_build_to_file22(max_filter_capacity, &v_add) << ", "; + // ss_array[j++] << testSmart::bench_build_to_file22(max_filter_capacity, &v_add) << ", "; + ss_array[j++] << testSmart::bench_build_to_file22(max_filter_capacity, &v_add) << ", "; + ss_array[j++] << testSmart::bench_build_to_file22(max_filter_capacity, &v_add) << ", "; + // ss_array[j++] << testSmart::bench_build_to_file22>(max_filter_capacity, &v_add) << ", "; + } + + const std::string file_name = "../scripts/build-all.csv"; + std::fstream file(file_name, std::fstream::in | std::fstream::out | std::fstream::app); + file << endl; + file << "n = " << max_filter_capacity << std::endl; + + for (size_t j = 0; j < number_of_filters; j++) { + file << ss_array[j].str() << std::endl; + } + + file.close(); +} diff --git a/main-fpp.cpp b/main-fpp.cpp new file mode 100644 index 0000000..cef3295 --- /dev/null +++ b/main-fpp.cpp @@ -0,0 +1,71 @@ + + +#include "Tests/smart_tests.hpp" + +void write_fpp_to_file(); + + +int main() { + write_fpp_to_file(); + return 0; +} + +void write_fpp_to_file() { + using CF8 = cuckoofilter::CuckooFilter; + using CF12 = cuckoofilter::CuckooFilter; + using CF16 = cuckoofilter::CuckooFilter; + using CF32 = cuckoofilter::CuckooFilter; + using CF8_N2 = cuckoofilter::CuckooFilterStable; + using CF12_Flex = cuckoofilter::CuckooFilterStable; + using CF16_N2 = cuckoofilter::CuckooFilterStable; + using CF32_N2 = cuckoofilter::CuckooFilterStable; + + using inc4 = Prefix_Filter>; + using inc6 = Prefix_Filter; + using inc8 = Prefix_Filter; + using inc9 = Prefix_Filter>; + + using L_BF8 = bloomfilter::BloomFilter; + using L_BF12 = bloomfilter::BloomFilter; + using L_BF16 = bloomfilter::BloomFilter; + + constexpr size_t fp_capacity = ((1ULL << 28) * 94 / 100) / testSmart::db_speeder; + constexpr size_t fp_lookups = fp_capacity; + + std::vector fp_v_add, fp_v_find; + testSmart::fill_vec_smart(&fp_v_add, fp_capacity); + testSmart::fill_vec_smart(&fp_v_find, fp_lookups); + + + std::string path = "../scripts/fpp_table.csv"; + + std::fstream file(path, std::fstream::in | std::fstream::out | std::fstream::app); + file << "n =, " << fp_capacity << ", Lookups =, " << fp_lookups << std::endl; + std::string header = "Filter, Size in bytes, Ratio of yes-queries bits per item (average), optimal bits per item (w.r.t. yes-queries), difference of BPI to optimal BPI, ratio of BPI to optimal BPI"; + // file << "name, byte size, FPR, BPI, opt-BPI, bpi-additive-difference, bpi-ratio" << std::endl; + file << header << std::endl; + file.close(); + + testSmart::FPR_test(&fp_v_add, &fp_v_find, path); + testSmart::FPR_test(&fp_v_add, &fp_v_find, path); + testSmart::FPR_test(&fp_v_add, &fp_v_find, path); + + testSmart::FPR_test(&fp_v_add, &fp_v_find, path); + testSmart::FPR_test(&fp_v_add, &fp_v_find, path); + testSmart::FPR_test(&fp_v_add, &fp_v_find, path); + + testSmart::FPR_test(&fp_v_add, &fp_v_find, path); + testSmart::FPR_test(&fp_v_add, &fp_v_find, path); + testSmart::FPR_test(&fp_v_add, &fp_v_find, path); + testSmart::FPR_test(&fp_v_add, &fp_v_find, path); + + testSmart::FPR_test>(&fp_v_add, &fp_v_find, path); + testSmart::FPR_test>(&fp_v_add, &fp_v_find, path); + testSmart::FPR_test>(&fp_v_add, &fp_v_find, path); + + testSmart::FPR_test(&fp_v_add, &fp_v_find, path); + testSmart::FPR_test(&fp_v_add, &fp_v_find, path); + testSmart::FPR_test(&fp_v_add, &fp_v_find, path); + + testSmart::FPR_test(&fp_v_add, &fp_v_find, path); +} diff --git a/main-perf.cpp b/main-perf.cpp new file mode 100644 index 0000000..9d1d2ff --- /dev/null +++ b/main-perf.cpp @@ -0,0 +1,67 @@ +#include "Tests/smart_tests.hpp" + +void bench_cmp_np(); +void temp_main(); + +int main() { + for (size_t i = 0; i < testSmart::ROUNDS; ++i) { + bench_cmp_np(); + } + return 0; +} + + +void bench_cmp_np() { + // using spare_item = uint64_t; + using CF8 = cuckoofilter::CuckooFilter; + using CF12 = cuckoofilter::CuckooFilter; + using CF16 = cuckoofilter::CuckooFilter; + using CF8_N2 = cuckoofilter::CuckooFilterStable; + using CF12_Flex = cuckoofilter::CuckooFilterStable; + using CF16_Flex = cuckoofilter::CuckooFilterStable; + + + using inc4 = Prefix_Filter>; + using inc6 = Prefix_Filter; + using inc8 = Prefix_Filter; + // using inc9 = Prefix_Filter>; + + using L_BF8 = bloomfilter::BloomFilter; + using L_BF12 = bloomfilter::BloomFilter; + using L_BF16 = bloomfilter::BloomFilter; + + // constexpr size_t db_speeder = 1; + constexpr size_t max_filter_capacity = ((1ULL << 28) * 94 / 100) / testSmart::db_speeder;// load is .94 + constexpr size_t lookup_reps = max_filter_capacity; + constexpr size_t bench_precision = 20; + std::vector v_add, v_find; + + testSmart::fill_vec_smart(&v_add, max_filter_capacity); + testSmart::fill_vec_smart(&v_find, lookup_reps); + + + const std::string path = "../scripts/Inputs/"; + + constexpr bool to_print = false; + + testSmart::Bench_res_to_file_incremental_22>(max_filter_capacity, bench_precision, &v_add, &v_find, path, to_print); + testSmart::Bench_res_to_file_incremental_22>(max_filter_capacity, bench_precision, &v_add, &v_find, path, to_print); + // testSmart::Bench_res_to_file_incremental_22>(max_filter_capacity, bench_precision, &v_add, &v_find, path, to_print); + + testSmart::Bench_res_to_file_incremental_22(max_filter_capacity, bench_precision, &v_add, &v_find, path, to_print); + testSmart::Bench_res_to_file_incremental_22(max_filter_capacity, bench_precision, &v_add, &v_find, path, to_print); + testSmart::Bench_res_to_file_incremental_22(max_filter_capacity, bench_precision, &v_add, &v_find, path, to_print); + testSmart::Bench_res_to_file_incremental_22(max_filter_capacity, bench_precision, &v_add, &v_find, path, to_print); + + // testSmart::Bench_res_to_file_incremental_22(max_filter_capacity, bench_precision, &v_add, &v_find, path, to_print); + testSmart::Bench_res_to_file_incremental_22(max_filter_capacity, bench_precision, &v_add, &v_find, path, to_print); + testSmart::Bench_res_to_file_incremental_22(max_filter_capacity, bench_precision, &v_add, &v_find, path, to_print); + testSmart::Bench_res_to_file_incremental_22(max_filter_capacity, bench_precision, &v_add, &v_find, path, to_print); + // testSmart::Bench_res_to_file_incremental_22(max_filter_capacity, bench_precision, &v_add, &v_find, path, to_print); + + // testSmart::Bench_res_to_file_incremental_22(max_filter_capacity, bench_precision, &v_add, &v_find, path, to_print); + // testSmart::Bench_res_to_file_incremental_22(max_filter_capacity, bench_precision, &v_add, &v_find, path, to_print); + // testSmart::Bench_res_to_file_incremental_22(max_filter_capacity, bench_precision, &v_add, &v_find, path, to_print); + return; +} + diff --git a/scripts/Generate-median-csv.py b/scripts/Generate-median-csv.py new file mode 100755 index 0000000..f258d68 --- /dev/null +++ b/scripts/Generate-median-csv.py @@ -0,0 +1,338 @@ +#!/usr/bin/env python3 + +from Naming import name_dict, get_time +from typing import * +import matplotlib.pyplot as plt +from matplotlib.gridspec import GridSpec +# import matplotlib +# import pandas as pd +import os +import sys + +# https://github.com/bendichter/brokenaxes +from brokenaxes import brokenaxes + +from statistics import median +USE_AVERAGE = 0 +USE_MEDIAN = 1 + +assert (USE_AVERAGE ^ USE_MEDIAN) + + +def get_lines(dir: str) -> list: + # file_name = os.path.basename(dir) + f = open(dir, "r") + lines = f.readlines() + f.close() + return lines + + +def find_line_index(lines: list, phrase: str) -> int: + for i in range(len(lines)): + line = lines[i].strip() + if (len(line) == 0) or (line.startswith("#")): + continue + if line.startswith(phrase): + return i + return -1 + + +def get_filter_name_from_lines(lines): + i = find_line_index(lines, "NAME") + if (i == -1): + print(lines) + assert 0 + assert i != -1 + name = lines[i][5:].strip() + return name + +def get_all_values_from_perf_list(lines: List[str]): + def find_all_partial_matches_in_lines(lines: List[str], pattern: str): + indexes = [] + for i in range(len(lines)): + if lines[i].startswith(pattern): + indexes.append(i) + return indexes + + beg_list = find_all_partial_matches_in_lines(lines, "NAME") + end_list = find_all_partial_matches_in_lines(lines, "BENCH_END") + + def get_performance_list(lines: List[str]): + start_line = find_line_index(lines, "BENCH_START") + 1 + end_line = find_line_index(lines, "BENCH_END") - 1 # inclusive. + + performance_list = [[] for _ in range(4)] + for line in lines[start_line:end_line]: + if not (len(line.strip())): + continue + + temp_list0 = line.split(",") + temp_list1 = [int(i.strip()) for i in temp_list0] + assert(len(temp_list1) == 4) + for i in range(4): + performance_list[i].append(temp_list1[i]) + + return performance_list + + assert(len(beg_list) == len(end_list)) + perfs_lists = [] + for i in range(len(beg_list)): + temp_lines = lines[beg_list[i]: end_list[i] + 1] + assert temp_lines[0].startswith("NAME") + assert temp_lines[-1].startswith("BENCH") + temp_perf = get_performance_list(temp_lines) + perfs_lists.append(temp_perf) + + def built_temp_list(single_perf_list: List, op: int, k: int): + """[summary] + + Args: + single_perf_list (List): [description] + op (int): [description] + k (int): [description] + + Returns: + [Lists of lists]: [Each cell in the list, is ] + """ + # single_perf_list[Run][Operation][Round] + # temp_l == [Operation][Round][Run(0);Run(last)] + runs = len(single_perf_list) + assert len(single_perf_list) == runs + temp_l = [single_perf_list[i][op][k] for i in range(runs)] + return temp_l + + assert len(perfs_lists[0]) == 4 + operations = len(perfs_lists[0]) + rounds = len(perfs_lists[0][0]) + + def built_raw_single_list(): + fl = [[0] * rounds for _ in range(operations)] + assert operations == 4 + for op in range(operations - 1): + for k in range(rounds): + temp_med = built_temp_list(perfs_lists, op, k) + fl[op][k] = temp_med + return fl + + med_fl_list = built_raw_single_list() + return med_fl_list + +def get_median_performance_list(lines: List[str]) -> List[List[float]]: + """Returns a List of Lists: [operation][round(load)] + + Args: + lines (List[str]): [description] + + Returns: + List[List[float]]: [description] + """ + def find_all_partial_matches_in_lines(lines: List[str], pattern: str): + indexes = [] + for i in range(len(lines)): + if lines[i].startswith(pattern): + indexes.append(i) + return indexes + + beg_list = find_all_partial_matches_in_lines(lines, "NAME") + end_list = find_all_partial_matches_in_lines(lines, "BENCH_END") + + def get_performance_list(lines: List[str]): + start_line = find_line_index(lines, "BENCH_START") + 1 + end_line = find_line_index(lines, "BENCH_END") - 1 # inclusive. + + performance_list = [[] for _ in range(4)] + for line in lines[start_line:end_line]: + if not (len(line.strip())): + continue + + temp_list0 = line.split(",") + temp_list1 = [int(i.strip()) for i in temp_list0] + assert(len(temp_list1) == 4) + for i in range(4): + performance_list[i].append(temp_list1[i]) + + return performance_list + + assert(len(beg_list) == len(end_list)) + perfs_lists = [] + for i in range(len(beg_list)): + temp_lines = lines[beg_list[i]: end_list[i] + 1] + assert temp_lines[0].startswith("NAME") + assert temp_lines[-1].startswith("BENCH") + temp_perf = get_performance_list(temp_lines) + perfs_lists.append(temp_perf) + + def built_temp_list(single_perf_list: List, op: int, k: int) -> List[float]: + # single_perf_list[Run][Operation][Round] + runs = len(single_perf_list) + assert len(single_perf_list) == runs + temp_l = [single_perf_list[i][op][k] for i in range(runs)] + return temp_l + + assert len(perfs_lists[0]) == 4 + operations = len(perfs_lists[0]) + rounds = len(perfs_lists[0][0]) + + def built_median_single_list() -> List[List[float]]: + fl = [[0] * rounds for _ in range(operations)] + assert operations == 4 + for op in range(operations - 1): + for k in range(rounds): + temp_med = median(built_temp_list(perfs_lists, op, k)) + fl[op][k] = temp_med + return fl + + med_fl_list = built_median_single_list() + return med_fl_list + +def get_op_divisors(lines: List[str]): + # a = find_line_index(lines, "NAME") + b = find_line_index(lines, "FILTER_MAX_CAPACITY") + c = find_line_index(lines, "NUMBER_OF_LOOKUP") + + # name = lines[a].split()[1] + filter_max_cap = int(lines[b].split()[1]) + lookup_reps = int(lines[c].split()[1]) + return filter_max_cap, lookup_reps + + +def get_raw_all_data(f_list: list): + lines_list = [] + names_list = [] + for temp_file in f_list: + temp_lines = get_lines(temp_file) + lines_list.append(temp_lines) + names_list.append(get_filter_name_from_lines(temp_lines)) + + perf_lists = [] + + for temp_lines in lines_list: + # temp_perf == [Operation][Round][Run(0);Run(last)] + temp_perf = get_all_values_from_perf_list(temp_lines) + perf_lists.append(temp_perf) + + def get_all_diviate_list(l): + def ratio(x, denom): + assert(denom != 0) + return (x-denom)/denom + t_med = median(l) + fl = [ratio(i, t_med) for i in l] + return fl + + flat_div_list = [] + filters_num = len(perf_lists) + operation_num = len(perf_lists[0]) + rounds = len(perf_lists[0][0]) + for op in range(3): + for t_filter in range(filters_num): + for t_round in range(rounds): + temp_l = perf_lists[t_filter][op][t_round] + # print(op, t_filter, t_round, end=":\t") + # print(temp_l) + # if temp_l == 0: + temp_res = get_all_diviate_list(temp_l) + flat_div_list += temp_res + # print() + return flat_div_list + + +def final_diver(f_list: list) -> None: + flat_diviate = get_raw_all_data(f_list) + s_fd = sorted(flat_diviate) + above_05 = [i for i in s_fd if abs(i) > 0.005] + above_1 = [i for i in s_fd if abs(i) > 0.01] + r1 = len(above_1)/len(s_fd) + r05 = len(above_05)/len(s_fd) + print( + "fraction of elements that are at most 1% away from median (in thier category) \t{:<.5f}".format(1-r1)) + print( + "fraction of elements that are at most 0.5% from median (in thier category)\t{:<.5f}".format(1-r05)) + print("min & max diviations:", s_fd[0], s_fd[-1]) + + +def generate_csvs(f_list: list): + lines_list = [] + names_list = [] + for temp_file in f_list: + temp_lines = get_lines(temp_file) + lines_list.append(temp_lines) + names_list.append(get_filter_name_from_lines(temp_lines)) + + perf_lists = [] + + for temp_lines in lines_list: + temp_perf = [] + if (USE_MEDIAN): + assert(not USE_AVERAGE) + temp_perf = get_median_performance_list(temp_lines) + elif (USE_AVERAGE): + temp_perf = get_average_performance_list(temp_lines) + else: + assert(0) + perf_lists.append(temp_perf) + + filter_max_cap, lookup_reps = get_op_divisors(lines_list[0]) + rounds_num = len(perf_lists[0][0]) + add_step = round(filter_max_cap / rounds_num) + find_step = round(lookup_reps / rounds_num) + + ########################################### + ins_list = [temp_perf[0] for temp_perf in perf_lists] + uni_list = [temp_perf[1] for temp_perf in perf_lists] + yes_list = [temp_perf[2] for temp_perf in perf_lists] + ########################################### + curr_time = get_time() + names = ["add-med-({:}).csv", "uni-med-({:}).csv", "yes-med-({:}).csv"] + names = [nm.format(curr_time) for nm in names] + f_add = open(names[0], "a") + f_uni = open(names[1], "a") + f_yes = open(names[2], "a") + files = [f_add, f_uni, f_yes] + lists = [ins_list, uni_list, yes_list] + filters_names = [name_dict(t) for t in names_list] + + size = len(filters_names) + assert size == len(ins_list) + for op in range(len(files)): + t_file = files[op] + t_list = lists[op] + for i in range(size): + t_file.write(filters_names[i] + ",") + temp_line = str(t_list[i])[1:-1] + t_file.write(temp_line + "\n") + + f_add.close() + f_uni.close() + f_yes.close() + + +def main_helper(path): + chosen_files = os.listdir(path) + files_list = [os.path.join(path, i) + for i in chosen_files if not i.endswith(".csv")] + files_list.sort() + final_diver(files_list) + generate_csvs(files_list) + + +def main(): + """ + sys.argv[1] = path + """ + + argc: int = len(sys.argv) + if argc == 1: + path = os.path.abspath(os.getcwd()) + path = os.path.join(path, "Inputs") + assert os.path.isdir(path) + # name = "bench{:}".get_time() + main_helper(path) + elif argc == 2: + path = sys.argv[1] + # name = "bench{:}".format(get_time()) + main_helper(path) + else: + print("Too many arguments where given ({:})".format(argc)) + + +main_helper("./Inputs/") diff --git a/scripts/Naming.py b/scripts/Naming.py new file mode 100644 index 0000000..cf7281f --- /dev/null +++ b/scripts/Naming.py @@ -0,0 +1,59 @@ +from typing import * +from datetime import datetime + +def get_marker_type(filter_name: str) -> str: + filter_name = filter_name.strip() + prefix_names_list = ["PF", "CF", "TC", "Bloom", "BBF", "Lem", "Impala512", "BF"] + symbols = ["o", "s", "D", "D", "^", "X", '$\star$', "D"] + default_symbol = "o" + for i in range(len(prefix_names_list)): + temp_prefix = prefix_names_list[i] + if filter_name.startswith(temp_prefix): + return symbols[i] + + return default_symbol + + +def name_dict(filter_name: str) -> str: + filter_name = filter_name.strip() + name_dict = { + 'BBF-Fixed': "BBF-Flex", + 'BBF_Fixed': "BBF-Flex", + 'Cuckoo-8': 'CF-8', + 'Cuckoo-12': 'CF-12', + 'Cuckoo-16': 'CF-16', + 'CuckooStable-8': 'CF-8-Flex', + 'CuckooStable-12': 'CF-12-Flex', + 'CuckooStable-16': 'CF-16-Flex', + 'SimdBlockFilter': "BBF", + 'TCD256': "TwoChoicer-256", + 'TC_V2': "TwoChoicer", + 'TC-shortcut': "TC", + 'TwoChoicer-dynamic': "TC-dyn", + 'VQF_Wrapper': "VQF", + 'inc2Choicer': "TwoChoicer", + 'Prefix-Filter [ evenFilter ]': "PF[AF-2]", + 'PF[BBF_Fixed]': "PF[BBF-Flex]", + 'PF[BBF-Fixed]': "PF[BBF-Flex]", + 'Prefix-Filter [ SimdBlockFilter ]': "PF[BBF]", + 'Prefix-Filter [ Cuckoo-12 ]': 'PF[CF-12]', + 'Prefix-Filter [ CuckooStable-12 ]': 'PF[CF-12-Flex]', + 'PF[CF12-Flex]': 'PF[CF-12-Flex]', + 'Prefix-Filter [ TC-shortcut ]': 'PF[TC]', + 'Prefix-Filter [ BBF-Fixed ]': 'PF[BBF-Flex]', + 'Prefix-Filter [ Impala512 ]': 'PF[Impala]', + 'Bloom-8[k=6]': 'BF-8[k=6]', + 'Bloom-12[k=8]': 'BF-12[k=8]', + 'Bloom-16[k=11]': 'BF-16[k=11]', + 'Bloom-16[k=10]': 'BF-16[k=11]' + } + + if filter_name in name_dict: + return name_dict[filter_name] + else: + print(filter_name, "not in dict") + return filter_name + + +def get_time(): + return datetime.now().strftime('%Y-%m-%d %H:%M:%S') diff --git a/scripts/__pycache__/Naming.cpython-38.pyc b/scripts/__pycache__/Naming.cpython-38.pyc new file mode 100644 index 0000000000000000000000000000000000000000..2c67decab6ea49b52f4e9bbcc33122fb3a138988 GIT binary patch literal 1752 zcmbUiO>ZML)b=FlBx%wQ_Jgtu3TUHMkg_3>HmX*DN>dFWK~s0q7B|F!zpy8sXVPpM?P=7~AQv`9;|3}cm6XqA?MM`&?s2rS41zksoaoKL2?37+J(&@>OSj7k0)^PLIN z9D*?Fqu+NX1}MF@Z<7N{ksi!J&(7}#aU3dRch|Cw?^tLTzYRxj;6814Y_e-994nkC zy!RUartr^l<_dQT+hzBp|Zcn-|6H%6Qt`xmJv zl40N{Laij1;ZYnUc9pVYcN~ae#!%Q-Wx>MHFuU^?;&(yB>nE+#IAkpWfVaK|+2f^9f?$x|hx~)Ee6TM~h(Xf|*oDmXtmd}N18jG)r7Me?mu;8QjRm}$;#?<` ztPalO-f8T6j5j+^yLRaf&7mZaEDU;0dKuZq^B*i}9$1H8SzB%<;Wr+ z>2r>(-k|Agjw}E@=sB_kYnC){98B0gJo};xY(U!`z_%S))_522cH3z@fK%F1|AJ9l zqr()HW^e4B#W7f3oMB-79PP?##_bFDC}41E?G_DZml$1pt?!2v65Kn>lEntw_q0>; zgWm9YN0z}A$!W}mHx_d9jia=GAe}tB3_cqE#NE+|al7nCUT5Z7`S2jk>sc1o4r}ZW z7G`YFhp` zA**E6P1LG0auzswi~bCv8pWdKM>XnuqCt2SvPbP+t4Uk&3f3Z z(^~zTXZ7!&)%y*D>pRMb;&Wv}gFDs@eL;8KkhnHLnYzp9-EE)}-8K;Bx^wI|3aS8o n2fEQr7|2N*O{!#i=Is(c4`VtG*q8c8k?3MJ@hVxbtUvxAqv62X literal 0 HcmV?d00001 diff --git a/scripts/arg-plotter.py b/scripts/arg-plotter.py new file mode 100755 index 0000000..c1ab2c2 --- /dev/null +++ b/scripts/arg-plotter.py @@ -0,0 +1,640 @@ +#!/usr/bin/env python3 + +from Naming import name_dict, get_marker_type, get_time +from typing import * +import matplotlib.pyplot as plt +from matplotlib.gridspec import GridSpec +# import matplotlib +# import pandas as pd +import os +import sys + +# https://github.com/bendichter/brokenaxes +from brokenaxes import brokenaxes + +from statistics import median +USE_AVERAGE = 0 +USE_MEDIAN = 1 + +assert (USE_AVERAGE ^ USE_MEDIAN) + + +def get_lines(dir: str) -> list: + # file_name = os.path.basename(dir) + f = open(dir, "r") + lines = f.readlines() + f.close() + return lines + + +def find_line_index(lines: list, phrase: str) -> int: + for i in range(len(lines)): + line = lines[i].strip() + if (len(line) == 0) or (line.startswith("#")): + continue + if line.startswith(phrase): + return i + return -1 + + +def get_filter_name_from_lines(lines): + i = find_line_index(lines, "NAME") + if (i == -1): + print(lines) + assert 0 + assert i != -1 + name = lines[i][5:].strip() + return name + + +def get_average_performance_list(lines: List[str]): + def find_all_partial_matches_in_lines(lines: List[str], pattern: str): + indexes = [] + for i in range(len(lines)): + if lines[i].startswith(pattern): + indexes.append(i) + return indexes + + beg_list = find_all_partial_matches_in_lines(lines, "NAME") + end_list = find_all_partial_matches_in_lines(lines, "BENCH_END") + + def get_performance_list(lines: List[str]): + start_line = find_line_index(lines, "BENCH_START") + 1 + end_line = find_line_index(lines, "BENCH_END") - 1 # inclusive. + + performance_list = [[] for _ in range(4)] + for line in lines[start_line:end_line]: + if not (len(line.strip())): + continue + + temp_list0 = line.split(",") + temp_list1 = [int(i.strip()) for i in temp_list0] + assert(len(temp_list1) == 4) + for i in range(4): + performance_list[i].append(temp_list1[i]) + + name = get_filter_name_from_lines(lines) + # print(name) + # print(performance_list) + return performance_list + + assert(len(beg_list) == len(end_list)) + perfs_lists = [] + for i in range(len(beg_list)): + temp_lines = lines[beg_list[i]: end_list[i] + 1] + assert temp_lines[0].startswith("NAME") + assert temp_lines[-1].startswith("BENCH") + temp_perf = get_performance_list(temp_lines) + perfs_lists.append(temp_perf) + + def get_lists_average(ll: List[List]): + k = len(ll) + cols = len(ll[0]) + assert (cols == 4) + rows = len(ll[0][0]) + z_list = [0] * rows + avg_fl_list = [z_list[:] for _ in range(cols)] + # print(len(avg_fl_list)) + # print(len(avg_fl_list[0])) + for col in range(cols): + for row in range(rows): + for i in range(k): + # print(col, row) + avg_fl_list[col][row] += ll[i][col][row] + + for col in range(cols): + for row in range(rows): + avg_fl_list[col][row] /= k + return avg_fl_list + + avg_fl_list = get_lists_average(perfs_lists) + return avg_fl_list + # end_list = [] + + +def get_median_performance_list(lines: List[str]) -> List[List[float]]: + """Returns a List of Lists: [operation][round(load)] + + Args: + lines (List[str]): [description] + + Returns: + List[List[float]]: [description] + """ + def find_all_partial_matches_in_lines(lines: List[str], pattern: str): + indexes = [] + for i in range(len(lines)): + if lines[i].startswith(pattern): + indexes.append(i) + return indexes + + beg_list = find_all_partial_matches_in_lines(lines, "NAME") + end_list = find_all_partial_matches_in_lines(lines, "BENCH_END") + + def get_performance_list(lines: List[str]): + start_line = find_line_index(lines, "BENCH_START") + 1 + end_line = find_line_index(lines, "BENCH_END") - 1 # inclusive. + + performance_list = [[] for _ in range(4)] + for line in lines[start_line:end_line]: + if not (len(line.strip())): + continue + + temp_list0 = line.split(",") + temp_list1 = [int(i.strip()) for i in temp_list0] + assert(len(temp_list1) == 4) + for i in range(4): + performance_list[i].append(temp_list1[i]) + + return performance_list + + assert(len(beg_list) == len(end_list)) + perfs_lists = [] + for i in range(len(beg_list)): + temp_lines = lines[beg_list[i]: end_list[i] + 1] + assert temp_lines[0].startswith("NAME") + assert temp_lines[-1].startswith("BENCH") + temp_perf = get_performance_list(temp_lines) + perfs_lists.append(temp_perf) + + def built_temp_list(single_perf_list: List, op: int, k: int) -> List[float]: + # single_perf_list[Run][Operation][Round] + runs = len(single_perf_list) + assert len(single_perf_list) == runs + temp_l = [single_perf_list[i][op][k] for i in range(runs)] + return temp_l + + # print("="*40) + # print(len(perfs_lists)) + # print(len(perfs_lists[0])) + # print(len(perfs_lists[0][0])) + # print("="*40) + runs = len(perfs_lists) + assert len(perfs_lists[0]) == 4 + operations = len(perfs_lists[0]) + rounds = len(perfs_lists[0][0]) + + def built_median_single_list() -> List[List[float]]: + fl = [[0] * rounds for _ in range(operations)] + assert operations == 4 + for op in range(operations - 1): + for k in range(rounds): + # print(op, k) + temp_med = median(built_temp_list(perfs_lists, op, k)) + fl[op][k] = temp_med + return fl + + med_fl_list = built_median_single_list() + return med_fl_list + + +def get_all_values_from_perf_list(lines: List[str]): + def find_all_partial_matches_in_lines(lines: List[str], pattern: str): + indexes = [] + for i in range(len(lines)): + if lines[i].startswith(pattern): + indexes.append(i) + return indexes + + beg_list = find_all_partial_matches_in_lines(lines, "NAME") + end_list = find_all_partial_matches_in_lines(lines, "BENCH_END") + + def get_performance_list(lines: List[str]): + start_line = find_line_index(lines, "BENCH_START") + 1 + end_line = find_line_index(lines, "BENCH_END") - 1 # inclusive. + + performance_list = [[] for _ in range(4)] + for line in lines[start_line:end_line]: + if not (len(line.strip())): + continue + + temp_list0 = line.split(",") + temp_list1 = [int(i.strip()) for i in temp_list0] + assert(len(temp_list1) == 4) + for i in range(4): + performance_list[i].append(temp_list1[i]) + + return performance_list + + assert(len(beg_list) == len(end_list)) + perfs_lists = [] + for i in range(len(beg_list)): + temp_lines = lines[beg_list[i]: end_list[i] + 1] + assert temp_lines[0].startswith("NAME") + assert temp_lines[-1].startswith("BENCH") + temp_perf = get_performance_list(temp_lines) + perfs_lists.append(temp_perf) + + def built_temp_list(single_perf_list: List, op: int, k: int): + """[summary] + + Args: + single_perf_list (List): [description] + op (int): [description] + k (int): [description] + + Returns: + [Lists of lists]: [Each cell in the list, is ] + """ + # single_perf_list[Run][Operation][Round] + # temp_l == [Operation][Round][Run(0);Run(last)] + runs = len(single_perf_list) + assert len(single_perf_list) == runs + temp_l = [single_perf_list[i][op][k] for i in range(runs)] + return temp_l + + assert len(perfs_lists[0]) == 4 + operations = len(perfs_lists[0]) + rounds = len(perfs_lists[0][0]) + + def built_raw_single_list(): + fl = [[0] * rounds for _ in range(operations)] + assert operations == 4 + for op in range(operations - 1): + for k in range(rounds): + temp_med = built_temp_list(perfs_lists, op, k) + fl[op][k] = temp_med + return fl + + med_fl_list = built_raw_single_list() + return med_fl_list + + +def get_op_divisors(lines: List[str]): + # a = find_line_index(lines, "NAME") + b = find_line_index(lines, "FILTER_MAX_CAPACITY") + c = find_line_index(lines, "NUMBER_OF_LOOKUP") + + # name = lines[a].split()[1] + filter_max_cap = int(lines[b].split()[1]) + lookup_reps = int(lines[c].split()[1]) + return filter_max_cap, lookup_reps + + +def get_y_values(filters_names: List[str], lists_of_lists: List[List], divisor, op_name: str, units=1e9): + assert (len(filters_names) == len(lists_of_lists)) + fl_y = [] + for temp_y_vals in lists_of_lists: + y_range = temp_y_vals + y_range = [divisor / (i / units) if i != 0 else 0 for i in y_range] + fl_y.append(y_range) + return fl_y + + +def get_raw_all_data(f_list: list): + lines_list = [] + names_list = [] + for temp_file in f_list: + temp_lines = get_lines(temp_file) + lines_list.append(temp_lines) + names_list.append(get_filter_name_from_lines(temp_lines)) + + perf_lists = [] + + for temp_lines in lines_list: + # temp_perf == [Operation][Round][Run(0);Run(last)] + temp_perf = get_all_values_from_perf_list(temp_lines) + perf_lists.append(temp_perf) + + def get_all_diviate_list(l): + def ratio(x, denom): + assert(denom != 0) + return (x-denom)/denom + t_med = median(l) + fl = [ratio(i, t_med) for i in l] + return fl + + flat_div_list = [] + filters_num = len(perf_lists) + operation_num = len(perf_lists[0]) + rounds = len(perf_lists[0][0]) + for op in range(3): + for t_filter in range(filters_num): + for t_round in range(rounds): + temp_l = perf_lists[t_filter][op][t_round] + # print(op, t_filter, t_round, end=":\t") + # print(temp_l) + # if temp_l == 0: + temp_res = get_all_diviate_list(temp_l) + flat_div_list += temp_res + # print() + return flat_div_list + + +def final_diver(f_list: list) -> None: + flat_diviate = get_raw_all_data(f_list) + s_fd = sorted(flat_diviate) + above_05 = [i for i in s_fd if abs(i) > 0.005] + above_1 = [i for i in s_fd if abs(i) > 0.01] + r1 = len(above_1)/len(s_fd) + r05 = len(above_05)/len(s_fd) + print( + "fraction of elements that are <=1% from median (in thier category) \t{:}".format(r1)) + print( + "fraction of elements that are <=0.5% from median (in thier category)\t{:}".format(r05)) + print("min & max diviations:", s_fd[0], s_fd[-1]) + + +def get_data(f_list: list): + lines_list = [] + names_list = [] + for temp_file in f_list: + temp_lines = get_lines(temp_file) + lines_list.append(temp_lines) + names_list.append(get_filter_name_from_lines(temp_lines)) + + perf_lists = [] + + for temp_lines in lines_list: + temp_perf = [] + if (USE_MEDIAN): + assert(not USE_AVERAGE) + temp_perf = get_median_performance_list(temp_lines) + elif (USE_AVERAGE): + temp_perf = get_average_performance_list(temp_lines) + else: + assert(0) + perf_lists.append(temp_perf) + + filter_max_cap, lookup_reps = get_op_divisors(lines_list[0]) + rounds_num = len(perf_lists[0][0]) + add_step = round(filter_max_cap / rounds_num) + find_step = round(lookup_reps / rounds_num) + + ########################################### + ins_list = [temp_perf[0] for temp_perf in perf_lists] + uni_list = [temp_perf[1] for temp_perf in perf_lists] + yes_list = [temp_perf[2] for temp_perf in perf_lists] + ins_arg = (names_list, ins_list, add_step, "Insertions") + uni_arg = (names_list, uni_list, find_step, "Uni-Lookups") + yes_arg = (names_list, yes_list, add_step, "Yes-Lookups") + ########################################### + + args = [ins_arg, uni_arg, yes_arg] + fl_y_list = [get_y_values(*temp_arg) for temp_arg in args] + rounds = len(ins_list[0]) + x_range = [round((i + 1) / rounds, 4) for i in range(rounds)] + filters_names = [name_dict(t) for t in names_list] + + def sorter(): + size = len(filters_names) + temp_for_sort = [(filters_names[i], fl_y_list[0][i],fl_y_list[1][i],fl_y_list[2][i]) for i in range(size)] + temp_for_sort.sort() + flatted_data = [] + for op in range(4): + temp = [temp_for_sort[i][op] for i in range(size)] + flatted_data.append(temp[:]) + + new_fl_y_list = flatted_data[1:] + new_filters_names = flatted_data[0] + return new_fl_y_list, x_range, new_filters_names + + return sorter() + # return fl_y_list, x_range, filters_names + + +def get_paths_from_base_names(base_names: List[str]): + return [os.path.join("Inputs", i) for i in base_names] + + +def get_ba_limits(op_ll: list): + filter_num = len(filters_names) + if filter_num != len(op_ll): + print(filter_num, len(op_ll)) + assert filter_num == len(op_ll) + min_max_bbf = [] + min_others = 1e10 + max_others = 0 + for i in range(filter_num): + temp_filter_name = filters_names[i] + # y_range = [i] + y_range = op_ll[i] + if (temp_filter_name == "BBF"): + min_max_bbf = min(y_range), max(y_range) + else: + max_others = max(max_others, max(y_range)) + min_others = min(min_others, min(y_range)) + return *min_max_bbf, min_others, max_others + + +def get_ba_limits_all(op_ll: list): + filter_num = len(filters_names) + if filter_num != len(op_ll): + print(filter_num, len(op_ll)) + assert filter_num == len(op_ll) + min_max_bbf = [1e10, 0] + min_others = 1e10 + max_others = 0 + for i in range(filter_num): + temp_filter_name = filters_names[i] + # y_range = [i] + y_range = op_ll[i] + if (temp_filter_name.startswith("BBF")): + if (temp_filter_name == "BBF-Flex"): + min_max_bbf[0] = min(y_range) + elif (temp_filter_name == "BBF"): + min_max_bbf[1] = max(y_range) + else: + print(temp_filter_name) + assert 0 + + # min_max_bbf = min(y_range), max(y_range) + else: + max_others = max(max_others, max(y_range)) + min_others = min(min_others, min(y_range)) + return *min_max_bbf, min_others, max_others + + +def fig3_ba_gridspec_all(data, name="", set_fontsize: int = 14): + y_lll, x_range, filters_names = data + # fig = plt.subplots(figsize=(15,5)) + fig = plt.figure(figsize=(15, 5)) + sps1, sps2, sps3 = GridSpec(1, 3, figure=fig) + spec_list = [sps1, sps2, sps3] + baxs = [] + op_names_list = ["(a) Insertions", "(b) Uniform lookups", + "(c) Yes lookups"] + + def get_ba_limits_all(op_ll: list): + bbfs_names = ["BBF", "BBF-Flex", "Impala"] + assert len(filters_names) == len(op_ll) + indexes = [] + for i in range(len(filters_names)): + t_name = filters_names[i] + for prefix in bbfs_names: + if t_name.startswith(prefix): + indexes.append(i) + break + + min_max_bbf = [1e10, 0] + min_others = 1e10 + max_others = 0 + + for i in range(len(filters_names)): + if i not in indexes: + y_range = op_ll[i] + max_others = max(max_others, max(y_range)) + min_others = min(min_others, min(y_range)) + + # min_max_bbf = [1e10, 0] + if len(indexes): + min_max_bbf[0] = min([min(op_ll[i]) for i in indexes]) + min_max_bbf[1] = max([max(op_ll[i]) for i in indexes]) + return *min_max_bbf, min_others, max_others + + for fig_index in range(len(y_lll)): + yba_lim = get_ba_limits_all(y_lll[fig_index]) + y_delim = ((yba_lim[2]*0.9, yba_lim[3] * 1.04), + (yba_lim[0]*0.98, yba_lim[1]*1.02)) + if fig_index == 1: + bax = brokenaxes(subplot_spec=spec_list[fig_index]) + else: + bax = brokenaxes(ylims=y_delim, d=0.005, + subplot_spec=spec_list[fig_index]) + bax.set_title(op_names_list[fig_index], fontsize=18) + bax.set_xlabel("Load", fontsize=14) + bax.set_ylabel("ops/sec", fontsize=14) + for i in range(len(y_lll[fig_index])): + yv = y_lll[fig_index][i] + marker_shape = get_marker_type(filters_names[i]) + bax.plot( + x_range, yv, label=filters_names[i], marker=marker_shape, markersize=2) + # bax.grid(axis='both', which='major', ls='-',linewidth=1) + # bax.grid(axis='both', which='minor', ls='--',linewidth=0.4) + bax.grid(axis='y', which='major', ls='-', linewidth=1) + bax.grid(axis='y', which='minor', ls='--', linewidth=0.4) + baxs.append(bax) + # axes[fig_index].plot(x_range, yv, label=filters_names[i], marker=marker_shape, markersize=3) + plt.tight_layout() + plt.subplots_adjust(top=0.88) + for bax in baxs: + for handle in bax.diag_handles: + handle.remove() + bax.draw_diags() + bax.minorticks_on() + # plt.show() + # return + # plt.show() + + handles, labels = baxs[0].axs[0].get_legend_handles_labels() + # labels, handles = zip(*sorted(zip(labels, handles), key=lambda t: t)) + plt.legend(handles, labels, loc='upper center', + bbox_to_anchor=(-0.6, -0.1), ncol=(len(filters_names) + 1)//2) + # plt.legend(handles, labels, loc='upper center', bbox_to_anchor=(-0.6, -0.05), ncol=5) + # plt.tight_layout() + file_name = name + if not len(name): + file_name = "bench-median-lables-" + str(set_fontsize) + ".pdf" + else: + file_name += ".pdf" + plt.savefig(file_name, dpi=400, bbox_inches="tight") + # plt.show() + + +def fig3_no_brokenaxis_local_arg(y_lll, x_range, filters_names, name: str = "default"): + fig = plt.figure(figsize=(15, 5)) + sps1, sps2, sps3 = GridSpec(1, 3, figure=fig) + spec_list = [sps1, sps2, sps3] + baxs = [] + op_names_list = ["(a) Insertions", "(b) Uniform lookups", + "(c) Yes lookups"] + + for fig_index in range(len(y_lll)): + bax = brokenaxes(subplot_spec=spec_list[fig_index]) + bax.set_title(op_names_list[fig_index]) + for i in range(len(y_lll[fig_index])): + yv = y_lll[fig_index][i] + marker_shape = get_marker_type(filters_names[i]) + bax.plot( + x_range, yv, label=filters_names[i], marker=marker_shape, markersize=2) + bax.grid(axis='y', which='major', ls='-', linewidth=1) + bax.grid(axis='y', which='minor', ls='--', linewidth=0.4) + baxs.append(bax) + plt.tight_layout() + plt.subplots_adjust(top=0.88) + for bax in baxs: + for handle in bax.diag_handles: + handle.remove() + bax.draw_diags() + bax.minorticks_on() + + handles, labels = baxs[0].axs[0].get_legend_handles_labels() + plt.legend(handles, labels, loc='upper center', + bbox_to_anchor=(-0.6, -0.05), ncol=len(filters_names)//3) + + plt.savefig(name + ".pdf", dpi=400, bbox_inches="tight") + plt.show() + + +def fig3_no_brokenAxis(name: str = "default"): + fig = plt.figure(figsize=(15, 5)) + sps1, sps2, sps3 = GridSpec(1, 3, figure=fig) + spec_list = [sps1, sps2, sps3] + baxs = [] + op_names_list = ["(a) Insertions", "(b) Uniform lookups", + "(c) Yes lookups"] + + for fig_index in range(len(y_lll)): + bax = brokenaxes(subplot_spec=spec_list[fig_index]) + bax.set_title(op_names_list[fig_index]) + for i in range(len(y_lll[fig_index])): + yv = y_lll[fig_index][i] + marker_shape = get_marker_type(filters_names[i]) + bax.plot( + x_range, yv, label=filters_names[i], marker=marker_shape, markersize=2) + # bax.grid(axis='both', which='major', ls='-',linewidth=1) + # bax.grid(axis='both', which='minor', ls='--',linewidth=0.4) + bax.grid(axis='y', which='major', ls='-', linewidth=1) + bax.grid(axis='y', which='minor', ls='--', linewidth=0.4) + baxs.append(bax) + # axes[fig_index].plot(x_range, yv, label=filters_names[i], marker=marker_shape, markersize=3) + plt.tight_layout() + plt.subplots_adjust(top=0.88) + for bax in baxs: + for handle in bax.diag_handles: + handle.remove() + bax.draw_diags() + bax.minorticks_on() + # plt.show() + # return + # plt.show() + + handles, labels = baxs[0].axs[0].get_legend_handles_labels() + # labels, handles = zip(*sorted(zip(labels, handles), key=lambda t: t)) + plt.legend(handles, labels, loc='upper center', + bbox_to_anchor=(-0.6, -0.05), ncol=len(filters_names)//3) + # plt.tight_layout() + plt.savefig(name + ".pdf", dpi=400, bbox_inches="tight") + plt.show() + + +def old_main(): + """ + sys.argv[1] = path + """ + + def main_helper(path, name): + chosen_files = os.listdir(path) + files_list = [os.path.join(path, i) + for i in chosen_files if not i.endswith(".csv")] + files_list.sort() + data = get_data(files_list) + final_diver(files_list) + fig3_ba_gridspec_all(data, name) + + argc: int = len(sys.argv) + if argc == 1: + path = os.path.abspath(os.getcwd()) + path = os.path.join(path, "Inputs") + assert os.path.isdir(path) + name = "bench{:}".format(get_time()) + main_helper(path, name) + elif argc == 2: + path = sys.argv[1] + name = "bench{:}".format(get_time()) + main_helper(path, name) + else: + print("Too many arguments where given ({:})".format(argc)) + + +old_main() diff --git a/scripts/build-csv-parser.py b/scripts/build-csv-parser.py new file mode 100755 index 0000000..123c3f7 --- /dev/null +++ b/scripts/build-csv-parser.py @@ -0,0 +1,133 @@ +#!/usr/bin/env python3 + +from typing import * +import matplotlib.pyplot as plt +import pandas as pd + +import os +from matplotlib import cm +import numpy as np +from statistics import median +from Naming import name_dict, get_time + +Def_COLOR = cm.inferno_r(np.linspace(.4, .8, 30)) + +dummy = [] +dummy_names = [] +dummy_tuple_list = [] + + +def built_plot_bar(filters_names: List[str], built_time_list_ns: List[int], divisor, units=1e9): + # print("Here!") + built_time = [i / units for i in built_time_list_ns] + filters_names = [name_dict(t.strip()) for t in filters_names] + + tuples_list = [(built_time[_], filters_names[_]) + for _ in range(len(built_time))] + tuples_list.sort() + dummy_tuple_list.append(tuples_list) + s_BT = [i[0] for i in tuples_list] + s_names = [i[1] for i in tuples_list] + + line = "{:30}:\t{:.7f}" + for i in tuples_list: + print(line.format(i[1], i[0])) + + s = pd.Series( + s_BT, + index=s_names, + # Title = "tomer" + ) + factor = 100 + # temp_color = cm.inferno_r(np.linspace(0.1, .7, len(filters_names) + 2)) + # temp_color = cm.RdYlGn(np.linspace(0, 1, len(filters_names) + 2))[::-1] + # color_plate = cm.RdYlGn(np.linspace(0, 1, factor + 1))[::-1] + color_plate = cm.RdYlGn(np.linspace(0.2, 0.8, factor + 1))[::-1] + + def get_index_in_range(x): + r_min, r_max = min(built_time), max(built_time) + assert r_min <= x <= r_max + shifted = x - r_min + normalized = shifted / (r_max - r_min) + index = round(normalized*factor) + assert index <= factor + return index + + color_indexes = [get_index_in_range(i[0]) for i in tuples_list] + final_colors = [color_plate[i] for i in color_indexes] + s.plot( + kind='bar', + stacked=True, + color=final_colors, + # ylabel = "Seconds" + # title="Built Time", + + # colormap='Paired', + ) + plt.grid(which="major", linestyle='--', linewidth=.8, axis='y') + plt.grid(which="minor", linestyle='-', linewidth=.4, axis='y') + # plt.set_title("Built Time", fontsize = 18) + plt.minorticks_on() + plt.ylabel("Seconds", fontsize=14) + # plt.yticks() + # s.set_axis() + pic_dir = "Built-time-median-({:}).pdf".format(get_time()) + plt.savefig(pic_dir, format="pdf", bbox_inches='tight') + # plt.show() + plt.clf() + + +def get_lines(file_name: str) -> list: + # file_name = os.path.basename(dir) + # RunAll_path = os.getcwd() + # main_path = os.path.dirname(RunAll_path) + # path = os.path.join(main_path, "scripts") + # path = os.path.join(path, file_name) + f = open(file_name, "r") + lines = f.readlines() + f.close() + return lines + + +def process_list_of_files(csv_file: list): + lines = get_lines(csv_file) + first_line = 0 + for i in range(-1, -len(lines) - 1, -1): + if lines[i].startswith("n ="): + first_line = i + break + assert first_line != 0 + lines = lines[first_line:] + div = int(lines[0].split("=")[1]) + values_list = [] + names_list = [] + for line in lines[1:]: + split_l = line.split(",") + names_list.append(split_l[0]) + temp = [int(i) for i in split_l[1:-1]] + values_list.append(temp) + + built_time_ns_list = [] + for i in values_list: + temp_built = median(i) + built_time_ns_list.append(temp_built) + + filter_max_cap = div + + built_plot_bar(names_list, built_time_ns_list, filter_max_cap) + + +def get_paths_from_base_names(base_names: List[str]): + return [os.path.join("Built-Inputs", i) for i in base_names] + + +def main(): + filename_list = [i for i in os.listdir("../scripts/") if i.startswith("build-all") and i.endswith(".csv")] + #print("filename_list:",filename_list) + assert len(filename_list) == 1 + filename = filename_list[0] + path = os.path.join("../scripts/", filename) + process_list_of_files(path) + + +main() diff --git a/scripts/fpp-parser-server.py b/scripts/fpp-parser-server.py new file mode 100755 index 0000000..7ce4fd3 --- /dev/null +++ b/scripts/fpp-parser-server.py @@ -0,0 +1,108 @@ +#!/usr/bin/env python3 + +# from typing import * +# import matplotlib.pyplot as plt +# import numpy as np +import os +from typing import * +import matplotlib.pyplot as plt +import matplotlib +import pandas as pd +import time +import os + +import numpy as np + + +headers = ["Filter", "Size in bytes", "Ratio of yes-queries", + "bits per item (average)", "optimal bits per item (w.r.t. yes-queries)", + "difference of BPI to optimal BPI", "ratio of BPI to optimal BPI"] + +headers2 = ["Filter", "Size in bytes", "yes-queries ratio", + "BPI (average)", "opt BPI", + "Difference", "Ratio"] + +headers3 = ["Filter", "bytes size", "PR ratio", + " BPI", "opt BPI", "Difference", " Ratio"] + + +def get_lines(path: str) -> list: + # file_name = os.path.basename(dir) + f = open(path, "r") + lines = f.readlines() + f.close() + return lines + + +def parse_line(line: str) -> list: + assert len(line) + assert not line.startswith("#") + # print(line) + + temp_data = line.split(",") + temp_data1 = [i.strip() for i in temp_data] + + fl = [] + fl += [temp_data1[0], int(temp_data1[1])] + fl += [float(i) for i in temp_data1[2:]] + assert (len(fl) == len(headers)) + return fl + + +def beauty_table(my_table): + names = ['CF-8', + 'CF-8-Flex', + 'CF-12', + 'CF-12-Flex', + 'CF-16', + 'CF-16-Flex', + '\\midrule', + 'PF[CF-12-Flex]', + 'PF[TC]', + 'PF[Impala512]', + '\\midrule', + 'BBF', + 'BBF-Flex', + 'Impala512', + 'Bloom-8[k=6]', + 'Bloom-12[k=8]', + 'Bloom-16[k=10]', + '\\midrule', + 'TC'] + + size = len(my_table) + assert size >= len(names) - 3 + offset = 0 + + for i in range(size): + if names[i + offset] == '\\midrule': + print("\\midrule") + offset += 1 + + if names[i + offset] != my_table[i][0].strip(): + print(names[i + offset], my_table[i][0].strip()) + assert 0 + + line = "{:}\t & {:<.4f} & {:<.2f} & {:<.2f}& {:<.2f} & {:<.3f} \\\\" + arg = names[i + offset], my_table[i][2]*100, *my_table[i][3:] + print(line.format(*arg)) + + +def main(path): + lines = get_lines(path) + table = [] + for line in lines: + line = line.strip() + to_skip = (len(line) == 0) or (line.startswith("#")) + if to_skip: + continue + temp_fl = parse_line(line) + table.append(temp_fl) + + beauty_table(table) + return table + + +path = os.path.join(os.getcwd(), "fpp-pseudo.csv") +# path = "scripts/fpp-pseudo.csv" +res = main(path)