[llvm-dev] Multi-Threading Compilers
Neil Nelson via llvm-dev
llvm-dev at lists.llvm.org
Sun Mar 1 01:29:45 PST 2020
This is a recent desktop.
Compiling for 10.0.0 clang and llvm. See below.
For this test, running 14 processors in a gui VM. The cores are
hyperthreaded, processors are twice the cores, but all the cores before
the run are showing negligible activity.
compile_commands.json has 3022 entries.
The ninja compile run lasted 7 minutes and 43 seconds with 99% all
processor usage throughout.
We then have 7*60+43 = 463 seconds.
Compile seconds per compile line in compile_commands.json 463/3022 =
0.1532 seconds. Average compile time per processor would be about
cmake -G Ninja -DLLVM_ENABLE_PROJECTS="clang;llvm" -DLLVM_USE_LINKER=lld
-DRUN_HAVE_THREAD_SAFETY_ATTRIBUTES=0 -Wno-dev ../llvm &>
ninja &> /home/nnelson/Documents/ninja.log
Here are some useful pages from Threading Building Blocks.
Appendix A Costs of Time Slicing
When the number of compiles exceeds the number of cores such that all
the cores are utilized, nothing is gained by trying to multi-thread the
individual compiles. In fact, loading up the cores with more threads or
tasks than there are cores will reduce compiling efficiency because of
time slicing. And sequencing through more tasks than less when the cores
are not overloaded will reduce compiling efficiency because more tasks
have to be loaded and unloaded to the cores.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the llvm-dev