floooh / fips

High-level build system for distributed, multi-platform C/C++ projects.
MIT License
471 stars 82 forks source link

Slow builds via cmd line #270

Closed fLindahl closed 3 years ago

fLindahl commented 3 years ago

When running fips build via the cmd line on Windows (MSVC, vs2019) the compiler runs on a single core, at maybe 20% capacity.

I've tried this with 3 different machines with different hardware, and this seems to always happen.

Any ideas?

floooh commented 3 years ago

Hmm, by default fips should do parallel builds by running cmake --parallel N where N is the number of parallel jobs.

To check, first run fips list settings, this should have a line "jobs", for instance on my MBP this shows 6 (default) and on my Windows machine it shows 10 (default). The default value is derived from the number of CPU cores (detected via python's multiprocessing.cpu_count() plus 2.

Then when running fips build you should see the cmake command line scroll by, which should show the --parallel argument, for instance on my Mac:

cmake --build . --parallel 6 --config Debug --

...so the first thing to check if this autodetected core count is somewhat correct. If not, you can override manually:

fips set jobs 32

When building the sokol-samples project (on the Windows command line, with the VStudio toolchain) I see activity on all cores (but the cores are not saturated, I guess it's mostly IO bound), this project contains many small targets though, I'm not sure how well Visual Studio can parallelize within a single target.

fLindahl commented 3 years ago

It's executing with --parallel 10, and the settings also tells me it's supposed to run 10 jobs.

=== building: vulkan-win64-vscode-debug
cmake --build . --parallel 10 --config Debug --

trying to build manually, it seems like the problem is somewhere in cmake, so this might not be the right forum for this... I'll close this for now.

Thanks anyways!

fLindahl commented 3 years ago

Actually, removing the --parallel seems to increase the build speed for me. This might be relevant to anyone else that is having the same issues...