Changeset aebd449 for chapter04


Ignore:
Timestamp:
11/13/2023 11:30:18 PM (8 months ago)
Author:
Thomas Trepl <thomas@…>
Branches:
multilib
Children:
18d1f6f
Parents:
fbc1e90 (diff), e3ae067 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Automatic merge of trunk into multilib

Location:
chapter04
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • chapter04/aboutsbus.xml

    rfbc1e90 raebd449  
    3838
    3939  <note>
    40     <para>For many modern systems with multiple processors (or cores) the
    41     compilation time for a package can be reduced by performing a "parallel
    42     make" by either setting an environment variable or telling the
    43     <command>make</command> program how many processors are available.  For
    44     instance, an Intel i5-6500 CPU can support four simultaneous processes with:</para>
    45 
    46     <screen role="nodump"><userinput>export MAKEFLAGS='-j4'</userinput></screen>
    47 
    48     <para>or by building with:</para>
    49 
    50     <screen role="nodump"><userinput>make -j4</userinput></screen>
    51 
    5240    <para>When multiple processors are used in this way, the SBU units in the
    5341    book will vary even more than they normally would.  In some cases, the make
  • chapter04/settingenviron.xml

    rfbc1e90 raebd449  
    210210  </important>
    211211
     212  <para>
     213    For many modern systems with multiple processors (or cores) the
     214    compilation time for a package can be reduced by performing a "parallel
     215    make" by telling the make program how many processors are available via
     216    a command line option or an environment variable.  For instance, an Intel
     217    Core i9-13900K processor has 8 P (performance) cores and
     218    16 E (efficiency) cores, and a P core can simultaneously run two threads
     219    so each P core are modeled as two logical cores by the Linux kernel.
     220    As the result there are 32 logical cores in total.  One obvious way to
     221    use all these logical cores is allowing <command>make</command> to spawn
     222    up to 32 build jobs.  This can be done by passing the
     223    <parameter>-j32</parameter> option to <command>make</command>:
     224  </para>
     225
     226  <screen role='nodump'><userinput>make -j32</userinput></screen>
     227
     228  <para>
     229    Or set the <envar>MAKEFLAGS</envar> environment variable and its
     230    content will be automatically used by <command>make</command> as
     231    command line options:
     232  </para>
     233
     234  <screen role='nodump'><userinput>export MAKEFLAGS=-j32</userinput></screen>
     235
     236  <important>
     237    <para>
     238      Never pass a <parameter>-j</parameter> option without a number to
     239      <command>make</command> or set such an option in
     240      <envar>MAKEFLAGS</envar>.  Doing so will allow <command>make</command>
     241      to spawn infinite build jobs and cause system stability issue.
     242    </para>
     243  </important>
     244
     245  <para>
     246    To use all logical cores available for building packages in
     247    <xref linkend='chapter-cross-tools'/> and
     248    <xref linkend='chapter-temporary-tools'/>, set <envar>MAKEFLAGS</envar>
     249    now in <filename>.bashrc</filename>:
     250  </para>
     251
     252<screen><userinput>cat &gt;&gt; ~/.bashrc &lt;&lt; "EOF"
     253<literal>export MAKEFLAGS=-j<replaceable>$(nproc)</replaceable></literal>
     254EOF</userinput></screen>
     255
     256  <para>
     257    Replace <replaceable>$(nproc)</replaceable> with the number of logical
     258    cores you want to use if you don't want to use all the logical cores.
     259  </para>
     260
    212261  <para>Finally, to ensure the environment is fully prepared for building the
    213262  temporary tools, force the <command>bash</command> shell to read
Note: See TracChangeset for help on using the changeset viewer.