Since I am compiling my C++ code on a very server box (32 or 64 cores in total), is there a way of tweaking compiler options to speed up the compilation times? E.g. to tell compiler to compile independent .cpp files using multiple threads.
views:
68answers:
3
+3
A:
This depends on what toolchain you're using.
If you're using GNU Make, then add -j 32
to your make invocation to tell Make to start 32 jobs (for example) in parallel. Just make sure that you're not exhausting RAM and thrashing your swap file as a result.
Josh Kelley
2010-07-09 01:20:55
+3
A:
Use something like Boost JAM which does this sort of multithreading for you - and from my experience much more efficiently than multi-threaded make.
Michael Dorgan
2010-07-09 01:37:29
+2
A:
Sun Studio includes parallel build support in the included dmake
version of make.
See the dmake manual on docs.sun.com for details.
alanc
2010-07-09 02:59:48
dmake -j 64 has reduced a compilation time from over two minutes to under 4 seconds... fantastic.
Steve
2010-07-09 03:21:59