January 27th, 2021

Seamlessly Accelerate CMake Projects in Visual Studio with Incredibuild

Visual Studio 2017 shipped with first-class CMake support. Since then, we’ve continued to improve our CMake support by adding new features based on your feedback. We previously blogged about the built-in Incredibuild support for accelerating and visualizing your vcxproj projects, and many of you asked to get this same level of support for your CMake projects. We’re happy to announce that Incredibuild can now be used to accelerate the Windows builds of your CMake projects from within Visual Studio.

Incredibuild Recap

The backbone of Incredibuild’s offering, Virtualized Distributed Processing™ enables a workload that consists of multiple, concurrent processes to be automatically and dynamically distributed to hundreds, and even thousands of idle CPUs on remote machine across your network or public cloud. Because CMake builds consist of hundreds of compilation tasks that can be executed in parallel, having hundreds of cores at your disposal can highly accelerate build times, which is exactly what distributed computing offers.

Virtualized Distributed Processing™ can even use idle CPUs on remote machines while users are working on them – operating in the background. In organizations that have hundreds of machines, the aggregated number of idle CPUs in any given moment can easily be in the thousands. These are wasted cores that Incredibuild recaptures to accelerate time consuming workloads in need of computing power.

Incredibuild runs processes on remote machines in a secure sandbox. Everything a process requires to run properly is dynamically emulated by Incredibuild from the local host to the remote machine. This means all you need to install on remote machines is the Incredibuild Agent – there’s no need to install Visual Studio, nor your source code or any other build tools. Any output generated by the remotely executed process – std output, errors, return codes, files generated, etc. – is automatically synched back to the local host, as if the process had been executed locally.

Using Visual Studio + CMake + Incredibuild

In the Visual Studio Installer, ensure that the checkboxes for “C++ CMake tools for Windows” and “IncrediBuild – Build Acceleration” are selected:

The checklist of optional features to install, including CMake Tools and Incredibuild

Once installed, an Incredibuild toolbar and menu appear in the Visual Studio development environment, offering Incredibuild’s distributed Build and Rebuild operations.

Animated gif showing Incredibuild building a project in a distributed fashion on many cores

Visualizing your build with Incredibuild’s Build Monitor

Another benefit of Incredibuild that you can take advantage of from directly within the IDE is the Incredibuild Build Monitor tool. This build visualization tool replaces your old text output with a sleek, intuitive graphic UI, transforming your build into a visual entity you can easily engage with, and helps you spot long durations, errors, warnings, bottlenecks, and dependencies.

Let’s take a look at the standard text output we’re all used to working with:

Plain text output

Now take a look at how a build looks like with Incredibuild’s Build Monitor tool, seamlessly integrated into the Visual Studio experience:

Visual build monitor, showing passed tasks, tasks with warning, and a system utilization graph on a timeline

Each color represents the build task status, allowing you to immediately identify which build tasks were executed without a problem and which require your attention. The bar width represents the duration of a specific task, and the side navigation bar lays out the specific machine and core on which the task was executed.

For more information, refer to the previous blog post on Incredibuild’s Build Monitor.

How much faster are CMake builds with Incredibuild?

The following data is based on running CMake with MSBuild by compiling the popular core OpenCV open-source project to establish a known base line. This example uses the Ninja generator, but all the Visual Studio generators are supported. Here are the results with Incredibuild:

Graph showing the following results of number of machines and cores against build time: 1 machine, 8 cores took 16 minutes. 4 machines, 22 cores took 6:26. 5 machines, 30 cores took 4:42. 10 machines, 112 cores took 1:42.

Here is what the CMake OpenCV build looks like in the Build Monitor.

Animated gif showing the build monitor for a large build, with the tasks being distributed across many machines

All in all, there is a 9.5X performance boost which means developers can spend more time building great code in the zone and less time waiting for code to build. In this specific use-case, adding additional cores to the Incredibuild pool, on top of the 100 cores used in this example, will result in even better compile time.

Continuous integration, Continuous improvement

You can use the same Incredibuild infrastructure to accelerate your CMake project under your CI/CD of choice for the full experience and to also accelerate unit tests that are part of your build or other compute intensive processes such as code analysis, code signing, various test types and more.

Talk To Us

We encourage you to download Visual Studio 2019 and try the Incredibuild functionality. We can be reached via the comments below or via email (visualcpp@microsoft.com). If you encounter other problems with Visual Studio or have other suggestions you can use the Report a Problem tool in Visual Studio or head over to the Visual Studio Developer Community. You can also find us on Twitter (@VisualC).

 

 

Author

Nick Uhlenhuth is a Program Manager on the Visual Studio team responsible for C++ IntelliSense and Productivity features.

3 comments

Discussion is closed. Login to edit/delete existing comments.

  • Ben Craig

    In the first build monitor picture, why are there big pauses between 0:20-0:22 and 0:50-0:57? Those all appear to be compilations, and the compilation of a .cpp shouldn’t ever need to depend on the linking of a previous binary.

  • Ian Ringrose

    Is there any addational licance cost on top of the visual studio licance?

    How well does this cope when people are working from home and hence cinnect to a very fast office nstwork?

  • chuck buck · Edited

    So is this only applicable to users that are part of a larger organization? How does one acquire a whole bunch of remotes to install the agent on?