[CMake] Does Makefile generated by CMake support make -jN?

Raymond Wan rwan.work at gmail.com
Tue Jul 12 23:01:11 EDT 2016


Hi Chao,


On Wed, Jul 13, 2016 at 10:54 AM, Chaos Zhang <zcsd2012 at gmail.com> wrote:
> I was trying to compile my project using CMake, after CMake generated
> Makefile.
> I used `/usr/bin/time -v make` to make the Makefile,  got the result:
> 'Percent of CPU this job got: 96%'.
> Then i used `/usr/bin/time -v make -j8` to make the Makefile, the result of
> CPU used is  'Percent of CPU this job got: 648%'.
> So i wonder if Makefile generated by CMake support make -jN, BTW my CPU is
> I7-4790, and after i use 'cat /proc/cpuinfo', there are 8 processors.


I'm not sure what you are asking...

You ran make with -j 8 and you got a percentage greater than 96% ...
this implies that the Makefile does support -jN, doesn't it?  If you
got 96% both times, then I would say there's a problem.

Is what you're wondering why it is 648% and not 800%?  I think that
depends on the dependencies in your Makefile.  It's possible that some
of them depend on each other in such a way that 8 parallel threads is
not possible.

Also, I can't remember the value returned by /usr/bin/time -v, but I
guess 648% is the average and not maximum.  So, perhaps there are
parts within the Makefile that only one thread could be used and then
it gets averaged out?

Ray


More information about the CMake mailing list