[eigen] splitting tests into smaller executables |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/eigen Archives
]
- To: eigen <eigen@xxxxxxxxxxxxxxxxxxx>
- Subject: [eigen] splitting tests into smaller executables
- From: Benoit Jacob <jacob.benoit.1@xxxxxxxxx>
- Date: Mon, 19 Oct 2009 14:51:07 -0400
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:date:message-id:subject :from:to:content-type; bh=SatmM8R0+aga98FePGZ/ci2vcsA6KrrhRy9lFRA/ArY=; b=LQ9F/hXtvbIRlp1VbzMb6So0ZOTzNzkSuPAd5wNlAO+t8C1NejGdNrB6nfxo1lmI4W vjLHaiiv7S9UuNU0Im/MqdCs+1ELHL7b4/YRoQe8IKzudh7kEFk37d1bvffk3lGaa6TH Jd3AJb9NJai2j7rF/Xi5nK8l0NgiyPQBuXnRU=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=HJxyxCH4dbcdfE/eetO8d9PS7/lF/zH9LpgvnBhyG4z6tT+WURMeISeLYWn+IYurdD fcS/d/1F2JicX+gIZhq8QVtwnFMCytFbVfeuJp8W8RNw9ZvOW84VPD9RCmM2pb3Yo6Lr Op6Jv1EgvfSh1eZxfAi8GSiLF6uguXSAlJ+NQ=
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