[eigen] splitting tests into smaller executables

[ Thread Index | Date Index | More lists.tuxfamily.org/eigen Archives ]


Hi,

I've implemented a new system in the refactor_solve_api fork. It
allows to split tests into smaller executables. It is optional,
requires a few changes for each test to take effect, and can be
globally disabled.

When you have a unit test that does:

   CALL_SUBTEST((foo(MatrixXf(20,20))));
   CALL_SUBTEST((foo(MatrixXf(50,50))));
   CALL_SUBTEST((foo(MatrixXd(20,20))));
   CALL_SUBTEST((foo(MatrixXd(50,50))));
   CALL_SUBTEST((foo(MatrixXcf(20,20))));

All you need to do to benefit from this, is to add little suffixes
1,2,3... to specify how to split this into separate executables. Do:

   CALL_SUBTEST1((foo(MatrixXf(20,20))));
   CALL_SUBTEST1((foo(MatrixXf(50,50))));
   CALL_SUBTEST2((foo(MatrixXd(20,20))));
   CALL_SUBTEST2((foo(MatrixXd(50,50))));
   CALL_SUBTEST3((foo(MatrixXcf(20,20))));

If you want something more generic, you can test for the preprocessor
symbol EIGEN_TEST_PART_<N> being defined, for N=1,2,3... , for example
if you have

   foo<MatrixXf>();
   foo<MatrixXd>();

you can also do:

#if defined EIGEN_TEST_PART_1
   foo<MatrixXf>();
#elif defined EIGEN_TEST_PART_1
   foo<MatrixXd>();
#endif

It works as follows: ei_add_test parses the source file for the
greatest occurence N, then generates N targets for 1...N each with
EIGEN_TEST_PART_i defined.

If you want to disable this and get the old behavior, set the option
EIGEN_SPLIT_LARGE_TESTS to OFF.

Here, this allows my little laptop to build tests with -j2 without
swapping, while it used to swap a lot already with -j1. Tests build
much faster here.

Benoit



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/