Giter Club home page Giter Club logo

prefix-filter's Introduction

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).

Short talk abouth the Prefix Filter: https://www.youtube.com/watch?v=KMVtvACSGo0

Prerequisites

  • Compiler: A C++17 compiler such as GNU G++ or LLVM Clang++.
  • CMake (Version 3.10 or higher).
  • System: Linux.
  • Hardware: Intel. Support of AVX512 is a must.
Python Packages To Produce The Graphs
  • matplotlib
  • brokenaxes (From here).
  • 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:

#include "Tests/wrappers.hpp"

int main(){
    using spare = TC_shortcut; // Any incremental filter can replace TC_shortcut.
    using prefixFilter = Prefix_Filter<spare>; 

    size_t filter_max_capacity = 1'000'000; // Choose any size.
    prefixFilter example_filter = FilterAPI<prefixFilter>::ConstructFromAddCount(filter_max_capacity);

    uint64_t x1 = 0x0123'4567'89ab'cdef;
    FilterAPI<prefixFilter>::Add(x1, &example_filter); // Insertions of an item x1. Insertion can be performed only one step at a time.

    bool res = FilterAPI<prefixFilter>::Contain(x1, &example_filter); // Lookup of x1.
    assert(res); //No false negative.
    
    uint64_t y1 = ~0x0123'4567'89ab'cdef;
    bool res2 = FilterAPI<prefixFilter>::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

prefix-filter's People

Contributors

theholyjoker avatar tomereven avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

prefix-filter's Issues

when run t="measure_perf measure_built measure_fpp"; time cmake --build ./ --target $t -j 20,there are some problems,this may relate Intel. Support of AVX512 is a must.

xsh@xsh-virtual-machine:~/Prefix-Filter/build$ t="measure_perf measure_built measure_fpp"; time cmake --build ./ --target $t -j 20
[ 28%] Building CXX object CMakeFiles/measure_perf.dir/Tests/smart_tests.cpp.o
[ 28%] Building CXX object CMakeFiles/measure_perf.dir/Prefix-Filter/min_pd256.cpp.o
[ 57%] Building CXX object CMakeFiles/measure_perf.dir/Prefix-Filter/Shift_op.cpp.o
[ 57%] Building CXX object CMakeFiles/measure_perf.dir/cuckoofilter/src/printutil.cc.o
[ 71%] Building CXX object CMakeFiles/measure_perf.dir/TC-Shortcut/tc-sym.cpp.o
[ 85%] Building CXX object CMakeFiles/measure_perf.dir/main-perf.cpp.o
In file included from /home/xsh/Prefix-Filter/TC-Shortcut/tc-sym.cpp:1:
/home/xsh/Prefix-Filter/TC-Shortcut/tc-sym.hpp: In function ‘__m512i tc_sym::shift_right(__m512i)’:
/home/xsh/Prefix-Filter/TC-Shortcut/tc-sym.hpp:271:41: warning: AVX512F vector return without AVX512F enabled changes the ABI [-Wpsabi]
271 | inline __m512i shift_right(__m512i a) {
| ^
In file included from /home/xsh/Prefix-Filter/Tests/../Tests/../TC-Shortcut/TC-shortcut.hpp:7,
from /home/xsh/Prefix-Filter/Tests/../Tests/wrappers.hpp:20,
from /home/xsh/Prefix-Filter/Tests/smart_tests.hpp:5,
from /home/xsh/Prefix-Filter/main-perf.cpp:1:
/home/xsh/Prefix-Filter/Tests/../Tests/../TC-Shortcut/./tc-sym.hpp: In function ‘__m512i tc_sym::shift_right(__m512i)’:
/home/xsh/Prefix-Filter/Tests/../Tests/../TC-Shortcut/./tc-sym.hpp:271:41: warning: AVX512F vector return without AVX512F enabled changes the ABI [-Wpsabi]
271 | inline __m512i shift_right(__m512i a) {
| ^
In file included from /home/xsh/Prefix-Filter/Tests/../Tests/../TC-Shortcut/TC-shortcut.hpp:7,
from /home/xsh/Prefix-Filter/Tests/../Tests/wrappers.hpp:20,
from /home/xsh/Prefix-Filter/Tests/smart_tests.hpp:5,
from /home/xsh/Prefix-Filter/Tests/smart_tests.cpp:1:
/home/xsh/Prefix-Filter/Tests/../Tests/../TC-Shortcut/./tc-sym.hpp: In function ‘__m512i tc_sym::shift_right(__m512i)’:
/home/xsh/Prefix-Filter/Tests/../Tests/../TC-Shortcut/./tc-sym.hpp:271:41: warning: AVX512F vector return without AVX512F enabled changes the ABI [-Wpsabi]
271 | inline __m512i shift_right(__m512i a) {
| ^
/home/xsh/Prefix-Filter/Tests/../Tests/../TC-Shortcut/./tc-sym.hpp:271:20: note: the ABI for passing parameters with 64-byte alignment has changed in GCC 4.6
271 | inline __m512i shift_right(__m512i a) {
| ^~~~~~~~~~~
In file included from /usr/lib/gcc/x86_64-linux-gnu/11/include/immintrin.h:73,
from /home/xsh/Prefix-Filter/Tests/../Tests/../Bloom_Filter/../hashutil.h:20,
from /home/xsh/Prefix-Filter/Tests/../Tests/../Bloom_Filter/bloom.hpp:9,
from /home/xsh/Prefix-Filter/Tests/../Tests/wrappers.hpp:15,
from /home/xsh/Prefix-Filter/Tests/smart_tests.hpp:5,
from /home/xsh/Prefix-Filter/main-perf.cpp:1:
/usr/lib/gcc/x86_64-linux-gnu/11/include/avx512vbmivlintrin.h: In function ‘__m256i min_pd::shift_right(__m256i)’:
/usr/lib/gcc/x86_64-linux-gnu/11/include/avx512vbmivlintrin.h:103:1: error: inlining failed in call to ‘always_inline’ ‘__m256i _mm256_permutexvar_epi8(__m256i, __m256i)’: target specific option mismatch
103 | _mm256_permutexvar_epi8 (__m256i __A, __m256i __B)
| ^~~~~~~~~~~~~~~~~~~~~~~
In file included from /home/xsh/Prefix-Filter/Tests/../Tests/wrappers.hpp:19,
from /home/xsh/Prefix-Filter/Tests/smart_tests.hpp:5,
from /home/xsh/Prefix-Filter/main-perf.cpp:1:
/home/xsh/Prefix-Filter/Tests/../Tests/../Prefix-Filter/min_pd256.hpp:159:46: note: called from here
159 | __m256i res = _mm256_permutexvar_epi8(idx, a);
| ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~
gmake[3]: *** [CMakeFiles/measure_perf.dir/build.make:146: CMakeFiles/measure_perf.dir/main-perf.cpp.o] Error 1
gmake[3]: *** Waiting for unfinished jobs....
gmake[2]: *** [CMakeFiles/Makefile2:311: CMakeFiles/measure_perf.dir/all] Error 2
gmake[1]: *** [CMakeFiles/Makefile2:318: CMakeFiles/measure_perf.dir/rule] Error 2
gmake: *** [Makefile:228: measure_perf] Error 2

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.