Comparing build times for flang

I’ve been playing around with the scripts I use to build flang in and out of tree. I don’t think I used to be able to do this, but I can now build the front end by only specifying “flang” in the define for “DLLVM_ENABLE_PROJECTS”. Here’s my full build script for doing in in-tree build of the front end:

#!/bin/bash

cmake -G Ninja …/llvm \

-DCMAKE_BUILD_TYPE=Release \

-DFLANG_ENABLE_WERROR=On \

-DLLVM_ENABLE_PROJECTS=“flang” \

-DCMAKE_CXX_STANDARD=17 \

-DLLVM_TARGETS_TO_BUILD=host \

-DLLVM_LIT_ARGS=-v \

-DLLVM_INSTALL_UTILS=On \

-DCMAKE_INSTALL_PREFIX=…/install

When I build clang, flang, and mlir, it takes 6 minutes, 8 seconds and produces an install area of 1.9 GB. When I do in in-tree build of just the flang front end, it takes 4 minutes, 33 seconds and produces an install area of 1.3 GB. When I do an out-of-tree build, it takes 1 minute 52 seconds, and produces a build area of 651 MB.

All of these times are running on a powerful lab machine using the GNU C++ compiler.

Pete

Thank you for the comparison. Could you provide some more details? How
many threads/cores does the "powerful lab machine have"? How much
memory does the build use? What version of gcc?

Michael

I forgot to mention this, but note that I share this machine with other users, so these times vary with the load on the machine.

I use gcc 8.3.

I use the build tool Ninja with no options to do my builds. That is, after running cmake, I do a build with the command:

  (time ninja) >build.log 2>&1 &

Ninja has some magic to determine how many threads it will use that (I assume) is based on the machine on which it's running. Here's a fragment of the contents of /proc/cpuinfo for my build machine:
vendor_id : GenuineIntel
cpu family : 6
model : 85
model name : Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz
stepping : 4
microcode : 0x2006906
cpu MHz : 2276.007
cache size : 28160 KB
physical id : 0
siblings : 40
core id : 0
cpu cores : 20

I've never monitored memory usage during a build, but here's a fragment of the contents of /proc/meminfo for my build machine:
MemTotal: 394871304 kB
MemFree: 208450524 kB
MemAvailable: 385842340 kB
Buffers: 1768 kB

As other points of reference, when I do an incremental build after modifying a .cpp file on which no other files depend, my time for a recent build was 1 minute 5 seconds. Ninja just takes 0.046 seconds to determine that a build is not needed if I try to do a build after changing nothing.

Pete