<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Sep 16, 2016 at 6:17 PM, Mehdi Amini <span dir="ltr"><<a href="mailto:mehdi.amini@apple.com" target="_blank">mehdi.amini@apple.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class=""><br>
> On Sep 16, 2016, at 6:13 PM, Carsten Mattner <<a href="mailto:carstenmattner@gmail.com">carstenmattner@gmail.com</a>> wrote:<br>
><br>
> On Sat, Sep 17, 2016 at 2:07 AM, Teresa Johnson via llvm-dev<br>
> <<a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a>> wrote:<br>
><br>
>> Yes and to add on - the ThinLTO backend by default will<br>
>> kick off  std::thread::hardware_<wbr>concurrency # of threads, which I'm finding is<br>
><br>
> Is it just me or does that sound not very intuitive or at least a<br>
> little unexpected?<br>
> It's good that it uses the resources eagerly, but in terms of build systems this<br>
> is certainly surprising if there's no control of that parameter via<br>
> make/ninja/xcode.<br>
<br>
</span>You can control the parallelism used by the linker, but the option is linker dependent<br>
(On MacOS:   -Wl,-mllvm,-threads=1)<br></blockquote><div><br></div><div>Wait - this is to control the ThinLTO backend parallelism, right? In which case you wouldn't want to use 1, but rather the number of physical cores.</div><div><br></div><div>When using gold the option is -Wl,-plugin-opt,jobs=N, where N is the amount of backend parallel ThinLTO jobs that will be issued in parallel. So you could try with the default, but if you have HT on then you might want to try with the number of physical cores instead.</div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<span class=""><br>
><br>
>> too much for machines with hyperthreading. If that ends up being an issue I can<br>
>> give you a workaround (I've been struggling to find a way that works on various<br>
>> OS and arches to compute the max number of physical cores to fix this in the source).<br>
><br>
> I've been using ninja -jN so far. I suppose when building with ThinLTO I should<br>
> run ninja -j1. Would that<br>
><br>
> What's the workaround?<br>
<br>
</span>Seems like you missed my previous email: : cmake -DLLVM_PARALLEL_LINK_JOBS=1<br>
Also, ninja is parallel by default, so no need to pass -j.<br>
<br>
This way you get nice parallelism during the compile phase, and ninja will issue only one link job at a time.<br>
<br>
—<br>
<span class="HOEnZb"><font color="#888888">Mehdi<br>
<br>
<br>
<br>
</font></span></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><span style="font-family:Times;font-size:medium"><table cellspacing="0" cellpadding="0"><tbody><tr style="color:rgb(85,85,85);font-family:sans-serif;font-size:small"><td nowrap style="border-top-style:solid;border-top-color:rgb(213,15,37);border-top-width:2px">Teresa Johnson |</td><td nowrap style="border-top-style:solid;border-top-color:rgb(51,105,232);border-top-width:2px"> Software Engineer |</td><td nowrap style="border-top-style:solid;border-top-color:rgb(0,153,57);border-top-width:2px"> <a href="mailto:tejohnson@google.com" target="_blank">tejohnson@google.com</a> |</td><td nowrap style="border-top-style:solid;border-top-color:rgb(238,178,17);border-top-width:2px"> 408-460-2413</td></tr></tbody></table></span></div>
</div></div>