SlideShare a Scribd company logo
Toolchain Independent
Distributed Compilation
Dietmar Hauser
Head of Console Technology
Sproing Interactive Media GmbH
http://xkcd.com/303/
Is it possible?
Input
●
1 cpp/c source file
●
Many h/hpp header files
“→ Compilation Unit” (“CU”)
Output
●
1 obj/o binary file
●
(Misc. helper files)
Research previous solutions
IncrediBuild
●
The de-facto standard
●
Easy setup, works well
●
Pretty, but pricey
●
Limited platforms
●
Coordinated load balancing
distcc
●
Free, but narrow focus
●
Needs homogenous setup
●
Two methods:
●
Preprocess & distribute
●
Analyse & distribute
The Plan
Send input files
●
Start with .cpp/.c
●
Find required .h/.inl/...
●
Precompiled Header (PCH)
●
Compiler executable(s)
●
Calculate hash for every file
Receive output files
●
Main .obj binary file
●
Misc .ti/.sbr/.d/... files
●
Log output
●
Cache inputs using hash
●
Cache output by
combining input hashes
Finding all input files
Preprocess Method
●
Run Preprocessor locally
●
Distribute Result
●
Easy to do
●
Less parallelisation
●
Input file cache not possible
●
No PCH support possible
Analyse Method
●
Analyse .cpp file
●
Find all dependencies
●
Sounds simple, but is tricky
●
Slightly more data to send
●
Good cache behaviour
●
PCH support possible
Precompiled Header Files
●
Speeds up compilation
●
Contains “global” includes
●
Is included in every CU
●
Proprietary format
●
Often very big
●
Contains extra dependency
information
●
May not be deterministic
Source: http://www.ogre3d.org
Fun with preprocessor directives
●
Directory search order
●
<> vs. “” includes
●
Multi line includes
●
Case mismatches
●
Conditional includes
●
PP constants in includes
●
PP macros in includes
●
Conservative approach
●
Find all possible dependencies
●
Reasonable overhead
●
Cache dependencies locally
●
Still a world of pain
●
Trial & Error
Putting it all together
●
Collect all input files
●
Send them if needed (zipped)
●
Build directory structure in Temp
●
Cache & Compile
●
Collect all output files
●
Cache & Send back (zipped)
●
???
●
Profit!
It kinda works...
Little problems:
●
PCH files don't work
●
Long & deeply nested file
names
●
Absolute paths
●
Some compilers need registry
●
Issues with parallel jobs
●
And some more...
Big problem:
●
Debug info stores absolute
paths to source files!
Sandboxie to the rescue
●
Virtual file system
●
Recreate original paths
●
No concurrency issues
●
Simple clean up
●
Virtual registry
●
Not free (~€10-25 per user)
●
Does not solve all problems
●
But it's good enough!
Miscellaneous titbits
●
“Screen Saver” mode
●
Automatic server updates
●
Output file cache (~ccache)
●
Data compression woes
●
100 MBit/s vs. 1 Gbit/s
●
Local compilation server
●
Parallel local compilation
●
Parallel linking experiment
So, is it worth the hassle?
●
Measuring this is tricky
●
Real projects
●
In a live environment
●
34 servers, ~17 available
●
Maximum speed up: ~17
●
Uncached: 0.6 – 6.68
●
Cached: 1.06 – 13.13
Sproing's Codebase (21 Projects)
Schlag den Raab 2 (1 Project)
3rd
Party Codebase (64 Projects)
Conclusions
It's possible distribute compilation with any compiler
Speed up is highly dependent on the environment and use case
Speed up is almost always positive, often greatly
What's next?
●
Get other developers involved?
●
Leverage an external cloud?
●
Distribute other processes? (Asset conversion,...)
●
Find a better solution for PCH?
●
Improve or unify front end with LLVM & Clang?
●
Distributed linking?
Thank you for your attention!
dietmar.hauser@sproing.com
@Rattenhirn
http://www.sproing.com
http://fb.me/sproing
Questions?

More Related Content

PDF
Practical SystemTAP basics: Perl memory profiling
ODP
Lcna example-2012
PDF
Breaking the RpiDocker challenge
PDF
Python的50道陰影
PDF
Vikentsi Lapa - Tools for testing
PDF
P99CONF — What We Need to Unlearn About Persistent Storage
PDF
Inter-process communication on steroids
PPTX
MongoDB backup service overview Boston MUG
Practical SystemTAP basics: Perl memory profiling
Lcna example-2012
Breaking the RpiDocker challenge
Python的50道陰影
Vikentsi Lapa - Tools for testing
P99CONF — What We Need to Unlearn About Persistent Storage
Inter-process communication on steroids
MongoDB backup service overview Boston MUG

What's hot (20)

PDF
Like loggly using open source
PDF
Introduction to protocol buffer
PDF
[POSS 2019] OVirt and Ceph: Perfect Combination.?
ODP
Gluster d thread_synchronization_using_urcu_lca2016
ODP
Rust Primer
PDF
Rust's Journey to Async/await
PDF
Object Compaction in Cloud for High Yield
PPTX
Rust programming-language
PDF
Performance optimization for all flash based on aarch64 v2.0
PDF
Fluentd Project Intro at Kubecon 2019 EU
PDF
Redis vs Infinispan | DevNation Tech Talk
PDF
Sdc 2012-challenges
PDF
.NET Memory Primer (Martin Kulov)
PDF
Fluentd and Distributed Logging at Kubecon
PDF
Rust Is Safe. But Is It Fast?
PDF
High-Performance Networking Using eBPF, XDP, and io_uring
PDF
Asynchronous IO in Rust - Enrico Risa - Codemotion Rome 2017
PDF
Fluentd 101
PDF
Kraken mesoscon 2018
PDF
Whoops! I Rewrote It in Rust
Like loggly using open source
Introduction to protocol buffer
[POSS 2019] OVirt and Ceph: Perfect Combination.?
Gluster d thread_synchronization_using_urcu_lca2016
Rust Primer
Rust's Journey to Async/await
Object Compaction in Cloud for High Yield
Rust programming-language
Performance optimization for all flash based on aarch64 v2.0
Fluentd Project Intro at Kubecon 2019 EU
Redis vs Infinispan | DevNation Tech Talk
Sdc 2012-challenges
.NET Memory Primer (Martin Kulov)
Fluentd and Distributed Logging at Kubecon
Rust Is Safe. But Is It Fast?
High-Performance Networking Using eBPF, XDP, and io_uring
Asynchronous IO in Rust - Enrico Risa - Codemotion Rome 2017
Fluentd 101
Kraken mesoscon 2018
Whoops! I Rewrote It in Rust
Ad

Viewers also liked (10)

DOCX
PDF
Marmorarias manual de_referencia
DOC
Dara puspita
PPTX
รายได้ 4 ทางจาก 4life
DOCX
Diseño material-educativo-digital
PPTX
Cytokines and obesity
PDF
Pitch Deck-Format-NinzaBiz.com | investment Deck for Fund Raising
PPTX
persentasi melalui power point
PPTX
Microsoft azure edited
Marmorarias manual de_referencia
Dara puspita
รายได้ 4 ทางจาก 4life
Diseño material-educativo-digital
Cytokines and obesity
Pitch Deck-Format-NinzaBiz.com | investment Deck for Fund Raising
persentasi melalui power point
Microsoft azure edited
Ad

Similar to Toolchain Independent Distributed Compilation (20)

PDF
Tracing Software Build Processes to Uncover License Compliance Inconsistencies
PDF
LCA 2014 project-builder.org presentation
PDF
Embedded Systems: Lecture 13: Introduction to GNU Toolchain (Build Tools)
PDF
Chromium: NaCl and Pepper API
PDF
Embedded Linux - Building toolchain
PDF
Joe Damato
PDF
Version Control != Dependency Management
PDF
Version Control != Dependency Management
PDF
Eclipse Con US 2013 - Buildroot Eclipse Bundle : A powerful IDE for Embedded ...
PPT
scaling compiled applications - highload 2013
PPTX
Getting started with Emscripten – Transpiling C / C++ to JavaScript / HTML5
PPTX
Aleksandr Kutsan "Managing Dependencies in C++"
PDF
GNU Compiler Collection - August 2005
PDF
Tracing Software Build Processes to Uncover License Compliance Inconsistencie...
PPTX
C++ on the Web: Run your big 3D game in the browser
PDF
An Empirical Study of Unspecified Dependencies in Make-Based Build Systems
PDF
Eclipse Che - A Revolutionary IDE for Distributed & Mainframe Development
PDF
{py}gradle
ODP
Software Build processes and Git
Tracing Software Build Processes to Uncover License Compliance Inconsistencies
LCA 2014 project-builder.org presentation
Embedded Systems: Lecture 13: Introduction to GNU Toolchain (Build Tools)
Chromium: NaCl and Pepper API
Embedded Linux - Building toolchain
Joe Damato
Version Control != Dependency Management
Version Control != Dependency Management
Eclipse Con US 2013 - Buildroot Eclipse Bundle : A powerful IDE for Embedded ...
scaling compiled applications - highload 2013
Getting started with Emscripten – Transpiling C / C++ to JavaScript / HTML5
Aleksandr Kutsan "Managing Dependencies in C++"
GNU Compiler Collection - August 2005
Tracing Software Build Processes to Uncover License Compliance Inconsistencie...
C++ on the Web: Run your big 3D game in the browser
An Empirical Study of Unspecified Dependencies in Make-Based Build Systems
Eclipse Che - A Revolutionary IDE for Distributed & Mainframe Development
{py}gradle
Software Build processes and Git

More from Dietmar Hauser (13)

PPTX
Expedition to Mount Competence !i!i!i!i!
PPTX
The Case Against Human Readability
PPTX
More Intuitive Programming Through Better Code Completion
PPTX
Data Compression 2020
PPTX
The Abstraction Trap
PPTX
The Settlers Returns
PPTX
Going Rogue - 8 Months On My Own
PPTX
The Rocky Road to KISS Rock City
PPTX
A Half Life in Game Development
PPTX
Devil Dentist
PPT
The Unusual Rendering Pipeline of Sigils - Battle for Raios
PPT
The Difficulty of Going Mobile
PPT
Handling Many Platforms with a Small Development Team
Expedition to Mount Competence !i!i!i!i!
The Case Against Human Readability
More Intuitive Programming Through Better Code Completion
Data Compression 2020
The Abstraction Trap
The Settlers Returns
Going Rogue - 8 Months On My Own
The Rocky Road to KISS Rock City
A Half Life in Game Development
Devil Dentist
The Unusual Rendering Pipeline of Sigils - Battle for Raios
The Difficulty of Going Mobile
Handling Many Platforms with a Small Development Team

Recently uploaded (20)

PDF
17 Powerful Integrations Your Next-Gen MLM Software Needs
PPTX
Why Generative AI is the Future of Content, Code & Creativity?
DOCX
Greta — No-Code AI for Building Full-Stack Web & Mobile Apps
PDF
AutoCAD Professional Crack 2025 With License Key
PDF
Complete Guide to Website Development in Malaysia for SMEs
PDF
Designing Intelligence for the Shop Floor.pdf
PPTX
Advanced SystemCare Ultimate Crack + Portable (2025)
PPTX
L1 - Introduction to python Backend.pptx
PPTX
CHAPTER 2 - PM Management and IT Context
PPTX
Operating system designcfffgfgggggggvggggggggg
PPTX
Monitoring Stack: Grafana, Loki & Promtail
PPTX
assetexplorer- product-overview - presentation
PDF
Odoo Companies in India – Driving Business Transformation.pdf
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 41
PPTX
Log360_SIEM_Solutions Overview PPT_Feb 2020.pptx
PDF
Adobe Illustrator 28.6 Crack My Vision of Vector Design
PPTX
Embracing Complexity in Serverless! GOTO Serverless Bengaluru
PDF
How to Choose the Right IT Partner for Your Business in Malaysia
PDF
Tally Prime Crack Download New Version 5.1 [2025] (License Key Free
PDF
EN-Survey-Report-SAP-LeanIX-EA-Insights-2025.pdf
17 Powerful Integrations Your Next-Gen MLM Software Needs
Why Generative AI is the Future of Content, Code & Creativity?
Greta — No-Code AI for Building Full-Stack Web & Mobile Apps
AutoCAD Professional Crack 2025 With License Key
Complete Guide to Website Development in Malaysia for SMEs
Designing Intelligence for the Shop Floor.pdf
Advanced SystemCare Ultimate Crack + Portable (2025)
L1 - Introduction to python Backend.pptx
CHAPTER 2 - PM Management and IT Context
Operating system designcfffgfgggggggvggggggggg
Monitoring Stack: Grafana, Loki & Promtail
assetexplorer- product-overview - presentation
Odoo Companies in India – Driving Business Transformation.pdf
Internet Downloader Manager (IDM) Crack 6.42 Build 41
Log360_SIEM_Solutions Overview PPT_Feb 2020.pptx
Adobe Illustrator 28.6 Crack My Vision of Vector Design
Embracing Complexity in Serverless! GOTO Serverless Bengaluru
How to Choose the Right IT Partner for Your Business in Malaysia
Tally Prime Crack Download New Version 5.1 [2025] (License Key Free
EN-Survey-Report-SAP-LeanIX-EA-Insights-2025.pdf

Toolchain Independent Distributed Compilation

  • 1. Toolchain Independent Distributed Compilation Dietmar Hauser Head of Console Technology Sproing Interactive Media GmbH
  • 3. Is it possible? Input ● 1 cpp/c source file ● Many h/hpp header files “→ Compilation Unit” (“CU”) Output ● 1 obj/o binary file ● (Misc. helper files)
  • 4. Research previous solutions IncrediBuild ● The de-facto standard ● Easy setup, works well ● Pretty, but pricey ● Limited platforms ● Coordinated load balancing distcc ● Free, but narrow focus ● Needs homogenous setup ● Two methods: ● Preprocess & distribute ● Analyse & distribute
  • 5. The Plan Send input files ● Start with .cpp/.c ● Find required .h/.inl/... ● Precompiled Header (PCH) ● Compiler executable(s) ● Calculate hash for every file Receive output files ● Main .obj binary file ● Misc .ti/.sbr/.d/... files ● Log output ● Cache inputs using hash ● Cache output by combining input hashes
  • 6. Finding all input files Preprocess Method ● Run Preprocessor locally ● Distribute Result ● Easy to do ● Less parallelisation ● Input file cache not possible ● No PCH support possible Analyse Method ● Analyse .cpp file ● Find all dependencies ● Sounds simple, but is tricky ● Slightly more data to send ● Good cache behaviour ● PCH support possible
  • 7. Precompiled Header Files ● Speeds up compilation ● Contains “global” includes ● Is included in every CU ● Proprietary format ● Often very big ● Contains extra dependency information ● May not be deterministic Source: http://www.ogre3d.org
  • 8. Fun with preprocessor directives ● Directory search order ● <> vs. “” includes ● Multi line includes ● Case mismatches ● Conditional includes ● PP constants in includes ● PP macros in includes ● Conservative approach ● Find all possible dependencies ● Reasonable overhead ● Cache dependencies locally ● Still a world of pain ● Trial & Error
  • 9. Putting it all together ● Collect all input files ● Send them if needed (zipped) ● Build directory structure in Temp ● Cache & Compile ● Collect all output files ● Cache & Send back (zipped) ● ??? ● Profit!
  • 10. It kinda works... Little problems: ● PCH files don't work ● Long & deeply nested file names ● Absolute paths ● Some compilers need registry ● Issues with parallel jobs ● And some more... Big problem: ● Debug info stores absolute paths to source files!
  • 11. Sandboxie to the rescue ● Virtual file system ● Recreate original paths ● No concurrency issues ● Simple clean up ● Virtual registry ● Not free (~€10-25 per user) ● Does not solve all problems ● But it's good enough!
  • 12. Miscellaneous titbits ● “Screen Saver” mode ● Automatic server updates ● Output file cache (~ccache) ● Data compression woes ● 100 MBit/s vs. 1 Gbit/s ● Local compilation server ● Parallel local compilation ● Parallel linking experiment
  • 13. So, is it worth the hassle? ● Measuring this is tricky ● Real projects ● In a live environment ● 34 servers, ~17 available ● Maximum speed up: ~17 ● Uncached: 0.6 – 6.68 ● Cached: 1.06 – 13.13
  • 15. Schlag den Raab 2 (1 Project)
  • 17. Conclusions It's possible distribute compilation with any compiler Speed up is highly dependent on the environment and use case Speed up is almost always positive, often greatly
  • 18. What's next? ● Get other developers involved? ● Leverage an external cloud? ● Distribute other processes? (Asset conversion,...) ● Find a better solution for PCH? ● Improve or unify front end with LLVM & Clang? ● Distributed linking?
  • 19. Thank you for your attention! dietmar.hauser@sproing.com @Rattenhirn http://www.sproing.com http://fb.me/sproing Questions?

Editor's Notes

  • #15:   PC Xbox 360 Wii PS3 3DS WiiU iOS Non-distributive 170 161 348 466 533 1400 665 Clean Rebuild 281 (0,6) 223 (0,72) 230 (1,51) 362 (1,29) 224 (2,38) 392 (3,57) 260 (2,56) Rebuild 160 (1,06) 115 (1,4) 125 (2,78) 215 (2,17) 122 (4,37) 245 (5,71) 141 (4,72)
  • #16:   PC PS3 3DS Non-distributive 81 287 394 Clean Rebuild 47 (1,72) 59 (4,86) 59 (6,68) Rebuild 18 (4,5) 22 (13,05) 30 (13,13)
  • #17:   XBox Non-distributive 18320 Clean Rebuild 6667 (2,75) Rebuild 4903 (3,74)