[robg adds: Although this option is listed in the man page, it's not at all clear that it will use the second processor for the additional job...]
|
|
|
Users who build open source software from source (aka the configure; make; make install method) on dual CPU Macs can take advantage of the the second CPU by adding -j 2 as an argument to the make command. The -j 2 argument tells make to compile two source files at the same time for the duration of the build, with each source file being compiled by one of the processors.
[robg adds: Although this option is listed in the man page, it's not at all clear that it will use the second processor for the additional job...]
•
[12,081 views]
Hint Options
Leverage Dual CPU's with GNU Make
The reason the man page doesn't mention multiple CPUs is because make has no way of determining this. -j 2 simply tells make to start two compiling processes. It's up to the OS to figure out how to effectively run both simultaneous processes, and the usual method is to put them on different CPUs.
Leverage Dual CPU's with GNU Make
I use this every day -- works fantastically for me. If you have a DP machine you may want to change your .cshrc file by adding the line:
Leverage Dual CPU's with GNU Make
Unfortunately, if you added that alias to your shell then it will break many instances of "make install". It did for me at least. Most makefile writers don't take the time to write the install target correctly, so -j2 will try to install files before the directories have been created. :-/ YMMV
Better yet...
A good general way of handling this sort of thing is to take the number of processors times two and put that in the -j option.
Better yet...
Some place... don't remember where... but I read the ideal setting would be -j(n*2) where n is the number of processors...
-pipe
You can also use the -pipe flag with gcc. That tells gcc to use pipes between compilation stages instead of temporary files.
Leverage Dual CPU's with GNU Make
This hint is not complete-- timkingman got to it first. The -j flag will help on single processor machines as well.
Leverage Dual CPU's with GNU Make
Very comprehensive, but I'd still add that it may all also depend on (a) version of make in use; (b) OS in use; (c) what is being compiled. On my FreeBSD machine, buildworld/buildkernel runs with -j10 (it is a dual Celery 466). Can't say it is x10 viz. no -j flag, but it is pretty fast. However, I never compile any ports with -j flag, as sources are really tailored well for parallel make. Pitty, since I would not mind recompile of KDE to take even 50% less than current c.a. 10 hours...
Leverage Dual CPU's with GNU Make
Well, you can *be* nice by *using* nice:
Marketing Slang
The verb "to leverage" has only one meaning, "to use credit to
enhance speculative capacity."
The usage in your title is strangely out-of-place marketing slang (GNU and marketing slang are an odd combination). I suggest "use", "make use of", or "take advantage of" as an alternative. Main Entry: leverage Function: transitive verb Inflected Form(s): -aged; -agĀ·ing : to provide (as a corporation) or supplement (as money) with leverage; also : to enhance as if by supplying with financial leverage
Marketing Slang
Dictionary.com also defines (def 2) leverage as:
Beware - this may break things!
Beware, however, that not all makefiles can be used with -j, although the likelihood of encountering such a Makefile today would be rare.
And unfortunately, such breakage will sometimes be undetectable, and random. The worst kind of breakage. In a past life, I was a test engineer at the first company to use commodity hardware for a symmetric multiprocessing system (Sequent), and when we started "parallelizing" Makefiles, many of them broke big time because of fixed-name temp files for some of the steps.
Beware - this may break things!
In a past life, I was a test engineer at the first company to use commodity hardware for a symmetric multiprocessing system (Sequent),
Don't listen to him! He's an old dinosaur! What does he know about MacOSX? This is the new world of UNIX!!! I wonder if you feel so very, very old as I do :-)
distcc
Why settle for using two processors when you can use all of them? This is also what Xcode uses behind the scenes to do its distributed compiling magic.
Leverage Dual CPU's with GNU Make
Or use "-j -l 10" to allow the number of threads to run away into the hundreds, but be capped by system load, in this instance, 10. |
SearchFrom our Sponsor...Latest Mountain Lion HintsWhat's New:HintsNo new hintsComments last 2 daysLinks last 2 weeksNo recent new linksWhat's New in the Forums?
Hints by TopicNews from Macworld
From Our Sponsors |
|
Copyright © 2014 IDG Consumer & SMB (Privacy Policy) Contact Us All trademarks and copyrights on this page are owned by their respective owners. |
Visit other IDG sites: |
|
|
|
Created this page in 0.12 seconds |
|