我要评分
获取效率
正确性
完整性
易理解

Examples

Obtain the test framework code from the source code obtained in 1. Assume that the source code is stored in /path/to/scann/sra_scann_adapter and the test framework code is stored in /path/to/scann/sra_scann_adapter/ann-benchmarks. The following uses the sift-128-euclidean.hdf5 dataset as an example.

Obtain a dataset.

1
2
3
cd /path/to/scann/sra_scann_adapter/ann-benchmarks
mkdir data && cd data
wget http://ann-benchmarks.com/sift-128-euclidean.hdf5 --no-check-certificate
The directory structure of the main files is as follows:
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
├── ann-benchmarks
├── data                                                      // Dataset
            └── sift-128-euclidean.hdf5
      ├── ann_benchmarks
            └── algorithms
                  └── scann
                        └── cpp_test
                        └── config-sift-128-euclidean.config  // Dataset configuration file
            └── test_cpp.sh                                         // Test script
├── scann
            ├── CMakeLists.txt                                      // Compilation configuration file
            ├── eval.cpp                                            // Test code
            └── cmdline.h                                           // Header file of the command line argument parsing library
project.sh                                                             // Compilation script

Procedure:

  1. Check that libscann_cc.so has been compiled in 8.
  2. Install CMake.
    yum install cmake
  3. Install the dependencies.
    yum install numactl numactl-devel hdf5 hdf5-devel gtest-devel gcc-toolset-12-libstdc++-static
  4. Install the Python dependencies.
    1
    2
    3
    cd /path/to/scann/sra_scann_adapter/ann-benchmarks
    pip install -r requirements.txt
    pip install treelite==4.2.1 tl2cgen
    
  5. Install protobuf.
    wget https://github.com/protocolbuffers/protobuf/archive/refs/tags/v3.21.9.tar.gz --no-check-certificate
    tar -xzf v3.21.9.tar.gz
    cd protobuf-3.21.9
    mkdir build && cd build
    cmake .. -Dprotobuf_BUILD_TESTS=OFF -DCMAKE_INSTALL_PREFIX=/usr/local/protobuf-3.21.9
    make install
    export PATH=/usr/local/protobuf-3.21.9/bin:$PATH
    export LD_LIBRARY_PATH=/usr/local/protobuf-3.21.9/lib:$LD_LIBRARY_PATH
  6. Install Abseil.
    wget https://storage.googleapis.com/mirror.tensorflow.org/github.com/abseil/abseil-cpp/archive/fb3621f4f897824c0dbe0615fa94543df6192f30.tar.gz --no-check-certificate
    tar -xvzf fb3621f4f897824c0dbe0615fa94543df6192f30.tar.gz
    cd abseil-cpp-fb3621f4f897824c0dbe0615fa94543df6192f30
    mkdir build && cd build
    cmake .. && make -j
    make install
  7. Install Eigen.
    git clone https://gitlab.com/libeigen/eigen.git
    cd eigen
    git checkout 33d0937c6bdf5ec999939fb17f2a553183d14a74
    mkdir build && cd build
    cmake .. -DCMAKE_INSTALL_PREFIX=/usr/local/eigen-3.3.7
    make -j && make install
  8. Build the executable file.
    cd /path/to/scann/sra_scann_adapter
    sh project.sh --build_eval_cmake_sve

    project.sh contains the following compilation options. You can select them as required:

    • --prepare: Installs Python dependencies.
    • --build_eval_cmake_sve: Builds the executable file of the SVE instruction version using libscann_cc.so through cmake.
    • --build_eval_cmake_neon: Builds the executable file of the NEON instruction version using libscann_cc.so through cmake.
    • --build_eval_bazel_sve: Builds the executable file of the SVE instruction version using the source code through bazel.
    • --build_eval_bazel_neon: Builds the executable file of the NEON instruction version using the source code through bazel.
  9. Run the test script.
    1
    sh test_cpp.sh 
    

    The execution result is as follows: