jrl-umi3218 / sch-core

Implementation and computation algorithms for the convex hulls
BSD 2-Clause "Simplified" License
13 stars 16 forks source link

Moving to Eigen #5

Open bchretien opened 8 years ago

bchretien commented 8 years ago

The subject of SCH's port to Eigen was raised yesterday, so here's an issue to keep track of any related information (cc @francois-keith ). IIRC, this was not investigated much more because of a possible impact on performance (the benchmark_eigen branch is still available).

francois-keith commented 8 years ago

I had a version a bit more advanced than the one in the benchmark_eigen, that I rebased on the current jrl-umi3218/sch-core/master here: https://github.com/francois-keith/sch-core/tree/eigen3

Be aware that the shared_tests must also be updated. I didn't push on https://github.com/jrl-umi3218/sch-shared-tests, so you'll have to pull it manually (or import the commit into this repo). francois-keith/sch-shared-tests@c81bf19

Please note that one all the eigen-related optimizations may not have been added in the commit francois-keith/sch-core@ccf05008f2a759, and that one of the unit test is failing because of a precision issue.

(Edit: correct markdown)

gergondet commented 8 years ago

To ease the test/development of this branch I've pushed a eigen3 branch on both sch-core and sch-shared-tests. example 2 is failing on eigen3 but I'm not sure why (when I run the test itself I don't get any errors)

For the moment, the difference in performance is significant.

This is what I get on my machine for sch-core master branch:

Running tests...
/usr/bin/ctest --force-new-ctest-process 
Test project /tmp/sch-core/build
    Start 1: example0
1/7 Test #1: example0 .........................   Passed    0.00 sec
    Start 2: example1
2/7 Test #2: example1 .........................   Passed    0.00 sec
    Start 3: example2
3/7 Test #3: example2 .........................   Passed    0.02 sec
    Start 4: test_animation
4/7 Test #4: test_animation ...................   Passed    1.74 sec
    Start 5: test_precision
5/7 Test #5: test_precision ...................   Passed    1.65 sec
    Start 6: test_general
6/7 Test #6: test_general .....................   Passed    0.02 sec
    Start 7: test_random
7/7 Test #7: test_random ......................   Passed   27.62 sec

100% tests passed, 0 tests failed out of 7

Total Test time (real) =  31.05 sec

And on the eigen3 branch

Running tests...
/usr/bin/ctest --force-new-ctest-process 
Test project /home/gergondet/devel-src/multi-contact/sch-core/build
    Start 1: example0
1/7 Test #1: example0 .........................   Passed    0.00 sec
    Start 2: example1
2/7 Test #2: example1 .........................***Failed    0.00 sec
    Start 3: example2
3/7 Test #3: example2 .........................   Passed    0.02 sec
    Start 4: test_animation
4/7 Test #4: test_animation ...................   Passed    3.59 sec
    Start 5: test_precision
5/7 Test #5: test_precision ...................   Passed    3.65 sec
    Start 6: test_general
6/7 Test #6: test_general .....................   Passed    0.02 sec
    Start 7: test_random
7/7 Test #7: test_random ......................   Passed   83.43 sec

86% tests passed, 1 tests failed out of 7

Total Test time (real) =  90.72 sec

The following tests FAILED:
          2 - example1 (Failed)
Errors while running CTest

Both were built using CMAKE_BUILD_TYPE=Release and no further options.

gergondet commented 8 years ago

See also, the travis build on eigen3 branch (with a more explicit error on example2):

https://travis-ci.org/jrl-umi3218/sch-core/builds/114952762

And the latest master build:

https://travis-ci.org/jrl-umi3218/sch-core/builds/94802666

This exhibits similar performance differences.

bchretien commented 8 years ago

A quick comparison with valgrind/perf may help pinpoint which matrix operation leads to such differences.

gergondet commented 8 years ago

After running further tests, the difference in performance mainly comes down to differences in IO performance for Eigen and sch own matrix type. See this simple benchmark.

I disable the OUTPUT_FILE feature by default in shared-tests since the files are not used for the tests and I get comparable results on my machine for both branches.

Finer tests are required to know estimate the performance impact (if any).

@bchretien also evoked the idea of checking sch-core code for FPE, this might give more information to go one way or the other

gergondet commented 8 years ago

I've cleaned up the eigen3 branch quite a bit.