[CMake] parallel builds for ctest

David Cole david.cole at kitware.com
Sat Feb 16 11:11:50 EST 2008


On 2/15/08, Alan W. Irwin <irwin at beluga.phys.uvic.ca> wrote:
>
> David, I may be leaping to conclusions here, but it appears from what you
> have said that it is a reasonable hypothesis that the ctest commmand works
> through the cmake generator backend.


True


When that is "make" (the default for
> Unix systems), then it further appears you can use a parallel version of
> make.  That would be a wonderful feature to have for ctest.


You can and it is. :-)

Also, when you use Visual Studio 2005 or 2008, builds happen in parallel
automatically according to your options, just as they do when you initiate
them through the UI. No need for a custom MAKECOMMAND.


However, assuming the above suppositions are all true, I don't particularly
> like the somewhat clumsy hardwired mechanism above which won't work very
> well for machines with more than two processors or for systems where you
> want to do your tests in parallel, but you might not want to do your build
> in parallel (since parallel builds are difficult to get right with cmake
> for
> projects with complicated dependencies).


You cannot do the tests in parallel via ctest. It runs all the tests it's
going to run sequentially. And although parallel builds may be difficult to
"get right," you are much more likely to get them right if you run nightly
dashboards using this technique and observing the results every day. When
there's a dependency issue, it usually shows up as a sporadic dashboard
failure unrelated to the changes made for the day....


One way to do this smoothly is allow ctest to pass any arguments to
> the backend that the user desires.
>
> Also, didn't "make test" work for early versions of cmake-2.4.x?  I find
> it
> is a no-op now.  (I was thinking that "make -j N test" might be a slick
> way
> to get parallel tests.)


Parallel tests are only going to be possible if you can guarantee that all
tests are independent of all other tests, or if you specify explicit
dependencies between tests somehow. (Which would introduce the same sort of
complexity you complain about above for build steps...)

"make test" should still work. What happens when you do "ctest -N" in the
binary directory? "make test" should be equivalent to running "ctest" from
the binary directory... If it seems to be a no-op, perhaps you do not have
an ENABLE_TESTING() call in your CMakeLists.txt?

HTH,
David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://public.kitware.com/pipermail/cmake/attachments/20080216/4f7ee9cb/attachment.htm


More information about the CMake mailing list