RainerKuemmerle / g2o

g2o: A General Framework for Graph Optimization
3.1k stars 1.11k forks source link

how to run the benchmark? #708

Closed xshen053 closed 1 year ago

xshen053 commented 1 year ago

I set flag in CMakeLists of benchmark to ON, but looks like it cannot find it.

CMake Warning at CMakeLists.txt:532 (find_package):
  By not providing "Findbenchmark.cmake" in CMAKE_MODULE_PATH this project
  has asked CMake to find a package configuration file provided by
  "benchmark", but CMake did not find one.

  Could not find a package configuration file provided by "benchmark" with
  any of the following names:

    benchmarkConfig.cmake
    benchmark-config.cmake

  Add the installation prefix of "benchmark" to CMAKE_PREFIX_PATH or set
  "benchmark_DIR" to a directory containing one of the above files.  If
  "benchmark" provides a separate development package or SDK, be sure it has
  been installed.

CMake Warning at CMakeLists.txt:536 (message):
  G2O_BUILD_BENCHMARKSwassettotrue,butthebenchmarklibrarycannotbefound
xshen053 commented 1 year ago

Solved, reason is I didn't install google benchmark

xshen053 commented 1 year ago

This benchmark cannot be compiled

 1355 |   FunctionBenchmark(const std::string& name, Function* func)
      |                                              ~~~~~~~~~~^~~~
/home/ubuntu/xiaxi/g2o/benchmarks/jacobian_timing_tests.cpp:239:3: error: no matching function for call to ‘benchmark::internal::FunctionBenchmark::FunctionBenchmark(const char [31], <unresolved overloaded function type>)’
  239 |   BENCHMARK_TEMPLATE2(M, F, 3);         \
      |   ^~~~~~~~~~~~~~~~~~~
/home/ubuntu/xiaxi/g2o/benchmarks/jacobian_timing_tests.cpp:257:1: note: in expansion of macro ‘BENCHMARK_FIXED_DIMENSION’
  257 | BENCHMARK_FIXED_DIMENSION(BM_StaticEigenMatrix, double)
      | ^~~~~~~~~~~~~~~~~~~~~~~~~
/usr/local/include/benchmark/benchmark.h:1355:3: note: candidate: ‘benchmark::internal::FunctionBenchmark::FunctionBenchmark(const string&, void (*)(benchmark::State&))’
 1355 |   FunctionBenchmark(const std::string& name, Function* func)
      |   ^~~~~~~~~~~~~~~~~
/usr/local/include/benchmark/benchmark.h:1355:56: note:   no known conversion for argument 2 from ‘<unresolved overloaded function type>’ to ‘void (*)(benchmark::State&)’
 1355 |   FunctionBenchmark(const std::string& name, Function* func)
      |                                              ~~~~~~~~~~^~~~
/home/ubuntu/xiaxi/g2o/benchmarks/jacobian_timing_tests.cpp:240:3: error: no matching function for call to ‘benchmark::internal::FunctionBenchmark::FunctionBenchmark(const char [31], <unresolved overloaded function type>)’
  240 |   BENCHMARK_TEMPLATE2(M, F, 6);         \
      |   ^~~~~~~~~~~~~~~~~~~
/home/ubuntu/xiaxi/g2o/benchmarks/jacobian_timing_tests.cpp:257:1: not
RainerKuemmerle commented 1 year ago

The benchmark focus on a very particular aspect on how to allocate an array. Might not provide much insights into things like which linear solver is faster depending on the size of problem or other aspects. I will fix the benchmark that it can be compiled.