On 06/15/2014 04:46 AM, Pierre Labastie wrote:
Le 15/06/2014 04:52, Dan McGhee a écrit :
I need to check my understanding and maybe gain new knowledge about building.
From the book or list I remember a caution that some packages don't build well
with parallel building. In the books, I seem to remember in the instructions
some words about this--to make sure the build went OK.
Now that I've enabled the whole capability of my CPU--quad core--I think I
need to be aware of this situation. When building is it the "-j" option of
<make> that controls this? The make man page says that "-j" controls the
number of "jobs" that can occur simultaneously. I think I know that
hyperthreading is not parallel building. This seems like it could come under
the control of "-j" also. Could someone clarify this for me or point me to a
document that discusses the situation?
During my last LFS build, 7.4, I discovered that "-j" was set to 8 somehow.
Is this an environment variable. I don't remember what I did to find this.
This concept and "-j" have now become important to me and I'd like to learn
some more before I start.
Thanks,
Dan
The -j flag of "make" tells how many processes (jobs) "make" is allowed to
launch. It can be set in the environment variable MAKEFLAGS. It may be
activated even on a single core CPU (sometimes with some performance gain,
because even single core single CPU machines can compute and access disks in
parallel). Of course, a multicore CPU (or multi CPU mothercard) allows to
speed up things, because of the possibility of running processes truly in
parallel, but there is no conceptual difference with a single core single CPU
machine.
I didn't know that. But now that you've said it, it seems reasonable
based on my limited knowledge of how processors, caches and memory work.
The reason why -jN is sometimes harmful comes from the way "make" does its job:
In the Makefile, there are "targets" (files to generate) associated to
"dependencies" (files which should exist before the "target" is generated).
Those target-dependency rules are read sequentially by "make" when only one
process is activated, which allows for rules lacking some dependencies. When
several processes are launched, rules may be read out of order, and lacking
dependencies may break the good ordering of the building process.
I'm not certain of the knowledge level I'm seeking. Certainly I don't
want to become a PhD in make. I think what I'm looking for is, "How do
I maximize the capability of my machine and eliminate or minimize build
failures or problems that result from this 'lack of dependencies?'" I
see conceptually what you are saying: the interplay between a number of
targets, each of which can have an indeterminate number of sub and
sub-sub targets.
I know--this is the way LFS is wired--to follow the book precisely. Then
all should be well. If, however, I have a make failure whose cause I
can't determine from the log, how can I recognize it as a failure based
on too many jobs running at the same time? Or, better, failure based on
a target completion before its dependencies are complete.
I found it interesting in reading the man page and the manual, which
Bruce was kind enough to point out, that if -j is not set, evaluated at
0, then make can do whatever it wants.
Thanks, Pierre.
Dan
--
http://lists.linuxfromscratch.org/listinfo/lfs-support
FAQ: http://www.linuxfromscratch.org/blfs/faq.html
Unsubscribe: See the above information page