vocabtree  0.0.1
compute_search_simple.cxx
Go to the documentation of this file.
1 #include "tests_config.hpp"
2 
3 #include <utils/filesystem.hpp>
4 #include <utils/numerics.hpp>
5 #include <utils/dataset.hpp>
6 #include <utils/vision.hpp>
7 #include <utils/logger.hpp>
10 
11 #include <iostream>
12 
13 #if ENABLE_MULTITHREADING && ENABLE_OPENMP
14 #include <omp.h>
15 #endif
16 #if ENABLE_MULTITHREADING && ENABLE_MPI
17 #include <mpi.h>
18 #endif
19 
20 _INITIALIZE_EASYLOGGINGPP
21 
22 int main(int argc, char *argv[]) {
23 #if ENABLE_MULTITHREADING && ENABLE_MPI
24  MPI::Init(argc, argv);
25  int rank = MPI::COMM_WORLD.Get_rank();
26  if(rank == 0) {
27 #endif
28  const uint32_t num_clusters = 512;
29 
31  LINFO << simple_dataset;
32 
33  std::stringstream index_output_file;
34  index_output_file << simple_dataset.location() << "/index/" << num_clusters << ".index";
35  InvertedIndex ii(index_output_file.str());
36 
37  for(uint32_t i=0; i<3; i++) {
38  std::shared_ptr<InvertedIndex::MatchResults> matches =
39  std::static_pointer_cast<InvertedIndex::MatchResults>(ii.search(simple_dataset, nullptr, simple_dataset.image(i) ));
40  LINFO << "Query " << i << ": " << *matches;
41  }
42 #if ENABLE_MULTITHREADING && ENABLE_MPI
43  }
44  MPI::Finalize();
45 #endif
46  return 0;
47 }