6.3 Decreasing compilation time with num-comps-file and num-build-cpus

The --num-comps-file SimGen command-line option sets the maximum number of components for each C++ file. If the build system has multiple processors, you can use --num-build-cpus to distribute the build.

The --num-comps-file option specifies how many components SimGen places into each C++ file. The default is 1, which means SimGen places each component in a separate C++ file, along with generic code. For development work, where you frequently modify the source, setting --num-comps-file to 1 can reduce the compilation time after each change, because SimGen recompiles only the changed file.

Increasing the value of --num-comps-file reduces the total amount of generic code, so that the total time to compile the whole project is less. For example, if you increase --num-comps-file to a setting of 1000, then the first 1000 components go into the first file, the second 1000 components go into the second file, and so on until all components are in files.


Large systems might be larger than the compiler can place in one C++ file. In this case, increase the value of --num-comps-file.

The --num-build-cpus option sets the maximum number of groups of files to split the build into. Have one group for each build system processor in order to fully use each processor. This makes the build quicker.

For example, if there are 40 components, and --num-build-cpus is set to 4, and --num-comps-file is set to 25, then SimGen produces four groups of files, each with 10 components. This is less than --num-comps-file, so each group contains only one C++ file. So:

  • SimGen produces four C++ files.

  • Each C++ file has 10 components instead of the maximum value of 25.

Using only the --num-comps-file option to calculate the components per file would result in two C++ files, with one file containing 25 components and the second file containing 15. This split would only use two build system processors. Accurately setting --num-build-cpus allows SimGen to fully use all processors.

Non-ConfidentialPDF file icon PDF version100965_1105_00_en
Copyright © 2014–2018 Arm Limited or its affiliates. All rights reserved.