[eigen] Re: splitting tests into smaller executables |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/eigen Archives
]
- To: eigen <eigen@xxxxxxxxxxxxxxxxxxx>
- Subject: [eigen] Re: splitting tests into smaller executables
- From: Benoit Jacob <jacob.benoit.1@xxxxxxxxx>
- Date: Mon, 19 Oct 2009 15:25:10 -0400
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:content-type :content-transfer-encoding; bh=ihLH4iZv9JB1HlGaZtk54i6sPoNJco4CPM7TyIKfkeM=; b=gVJrG2/TLlsGGcHUxjarvLnlytdWdvV18KJTHMLdiR5UB6xA0g8e91BjWCvG1U0l5k mo8uJ3uwVw34anZ+6LCKVBkf2wAi35dDaMewJPCv8OrMN45qFWpVILUwN6hdP3yI9sJW EkL/TFfCBGqviKcMeGPM0AAqZQgd9LcdgQJs4=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; b=nRLw4xQwU+twQTNX/kJJuHVHeWBatXQNWjh8vHAZ55CYgjfuSYWcXN9UFeN48vCeId ++BF4vmw6BXPq53mjGk9z5Uw3y8oecE9Zr0Zjr9O1CVifaxhUbvES34YZIern7BjDRQn g2a9tLxtk1OMJ41pa+JD1q8STqMcUaSU+Uf1I=
I forgot to say that you still have per-test targets like
make test_lu
they build all the smaller executables.
So the big advantage is that now, when you want to build only 1 test,
you can already take advantage of your multi-core CPU!
So proud owners of 4-core machines can do
make -j5 test_lu
and have that completed in a few seconds!
Benoit
2009/10/19 Benoit Jacob <jacob.benoit.1@xxxxxxxxx>:
> 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
>