16 ms·
Threadripper 3990X: The Quest To Compile 1B Lines Of C++ On 64 Cores
- Yuioup 6y agoEmbarcadero? Are they still around?
- colejohnson66 6y agoThey’re still selling Delphi, for what it’s worth
- ahepp 6y ago>C++Builder with TwineCompile is a powerful productivity solution for multi-core machines compiling 1 million lines of code very quickly and can work better than the MAKE/GCC parallel compilation Jobs feature due to it’s deep IDE integration You're claiming this plugin has deeper IDE integration than `make`? I find that really, really difficult to believe. And if it's true, it seems like the solution is to either use a better IDE, or improve IDE support for the de facto standard tools that already exist, as opposed to writing a plugin for the -j flag.
- klodolph 6y agoMake forces you to choose between being able to do full parallel builds or using recursive make, you can’t do both.
- StillBored 6y agoI might be misunderstanding something, but the common gnumake does no such thing. https://www.gnu.org/software/make/manual/html_node/Job-Slots.html https://www.gnu.org/software/make/manual/html_node/Job-Slots...
- klodolph 6y agoI didn’t go into great detail of the reasons, but the jobserver doesn’t address the problem except for the most trivial cases—the core problem is that you can’t cross to a recursive make invocation via multiple edges. This is fairly common in larger projects, so you end up having to do some hackery to manually sequence make invocations if you want to use recursive make (which is pretty awful). Honestly, for large projects, Make is an insane choice, notwithstanding the fact that people who are sufficiently savvy at Make can sometimes make it work. (If your tools are bad, you can make up for it with extra staff time and expertise.)
- ChuckMcM 6y agoThat is a really excellent observation. My experience is that "larger projects" to the investment in their build infrastructure to maximize parallelism in order to reduce build times because it pays dividends in terms of turn around time and thus productivity. One of the joys of working with someone who has been building large projects for a while, is that they just design the build system from the start to be as parallel as practical.
- StillBored 6y agoMake isn't great, but if you look at the opensource world the vast majority of the large projects are make based. The backbone of your average distro is a thin layer on top of what is mostly automake/autoconf in the individual projects. That is because while I can create a toy project that builds with make in a half dozen lines, big projects can extend it to cover those odd edge cases that break a lot of other "better" build systems. Particularity, when a project starts including a half dozen different languages. So, while i'm not a make fan, I'm really tired of people pissing on solutions (c also comes to mind) that have been working for decades because of edge cases or problems of their own creation because they don't understand the tool. A well understood tool is one where people know where the problems lie and work around them. Most "perfect" tools are just project crashing dragons hiding under pretty marketing of immature tooling.
- klodolph 6y ago
- zajio1am 6y agoWhy would you do recursive make? That is setup discouraged for decades ...
- ahepp 6y ago(for reference: "Recursive Make Considered Harmful", https://accu.org/journals/overload/14/71/miller_2004/ https://accu.org/journals/overload/14/71/miller_2004/)
- klodolph 6y agoBecause it can be hard to maintain non-recursive make systems for large projects. Just because recursive make is discouraged does not mean that the alternative is without its own drawbacks.
- Too 6y agoBecause you included a third-party project into your build which is not compatible with your build system and you don't want to rewrite all their ninjafiles into makefiles to match. Someone should really formalize a standard for declaring dependencies which build systems can share between each other.
- klodolph 6y agoA “standard for declaring dependencies” is, itself, a build system without the execution engine. The execution engine is not actually the hard part about making a build system. So, what you’re asking for is really just a standardized build system.
- fmxexpress 6y agoYes, it could be as simple as having Dev-C++ run a build every time a file is saved. Currently it does not do this. Remember, Dev-C++ didn't have -j support at all until I added it. TwineCompile does do this (background compile). Therefore the IDE is providing this functionality and has nothing really do to with make or the compiler. TwineCompile is not a plugin wrapping the -j flag. It is a separate thing entirely unique to C++Builder. It does offer integration with MSBuild though. The second part of that was the fall off. With the 1 million size files it only ever used half of the cores and each successive round of core compiles it would use even less cores. TwineCompile didn't seem to have that problem but this post was not about TwineCompile vs. MAKE -j so I did not investigate this farther. I was expecting MAKE/GCC to blow me away and use all 64 cores full bore until complete and it did not do this.
- formerly_proven 6y ago[Not "real" C++ code, benchmark is for compiling 14492754 copies of a fairly simple C function]
- jandrese 6y agoSeems like he tried more complex examples too, but ran into roadblocks like a 2GB limit on executables and running into a commandline length limit restriction that dates back to early DOS days which made it impossible to link. Both of those problems seemed solvable if he was willing to chunk up his application into libraries, maybe 1024 files per library then linked to the main application.
- simcop2387 6y agoI believe this is one of the reasons for object libraries (or archives, the foo.a files on linux/unix), you can then link in all of the object files from one of those at link time without having to list them all at once. That won't get past the 2GB limit on executables but it will get past the command line length.
- jandrese 6y agoI was going to suggest that, but he's running on Windows and I don't know if they are supported there. I guess they probably are since they're a compiler feature.
- com2kid 6y agoThis is correct, a .lib file on Windows has a bunch of .obj files in it that you can then link together. You can also use command files[1] to pass options in instead of using the command line. [1] https://docs.microsoft.com/en-us/cpp/build/reference/linking?view=msvc-160 https://docs.microsoft.com/en-us/cpp/build/reference/linking... to pass
- deleted 6y ago[deleted]
- coliveira 6y agoIt is a good thing that Embarcadero is keeping alive this technology to create desktop apps from the early 2000s that was abandoned by MS and other large companies in favor of complex Web-based apps.
- dvfjsdhgfv 6y agoIf only they had made Delphi Community Edition available a decade earlier...
- cosmotic 6y agoSomeone has to build the native electron wrapper
- dvfjsdhgfv 6y agoIf you mean wrapping native widgets, this wouldn't solve much - you would still need some language to take care of the logic, like a JavaScript engine. At this point just using Electron is simply easier for devs, and as much as we hate it, realistically speaking it's still better than nothing.
- phendrenad2 6y agoQt is still around and doing well. Some people still need desktop apps.
- realolokunmama 6y agoHello!! I hope my contact brings you inspiration and joy to your day! As you can see, I’m a spiritual spell caster i have herbal cure for CANCER and more i also cast spells such as Health Restoration Spell Dismiss Depression Spell Love spell Ex Back spell Lost Love spell Attractive spell Divorce spell Financial spell Promotion spell Marriage spell Protection spell pregnancy spell Job spell Grow your business spell Lottery spell Fertility spell Court Case spell Diabetes Lupus kindly contact me And don't forget that problem shared is a problem solved. Email: realolokunmama12@gmail.com
- trhway 6y agoLucky sons of gun. We are stuck with Xeons. Have to wait 3 hours for our 20M C/C++ on the 2x14cores Xeon machine after a pull/rebase. Ryzen/TR would probably be faster 2-3x times for the same money, yet it is a BigCo, so no such luck (and our product is certified only for Xeons, so our customers can't run AMD too - thus we're de-facto part of the Great Enterprise Wall blocking AMD from on-premise datacenter).
- maccard 6y agoI upgraded from 2x 12 core xeons to a 64 core thread ripper - compile times dropped from 45m to 12m
- AshamedCaptain 6y agoIndustrial software will always grow in size to use all available compilation time ... I have seen large Xeon distcc farms and the total build walltime was still measured in hours...
- deleted 6y ago[deleted]
- smoldesu 6y agono, the macos compositor
- PragmaticPulp 6y agoFun experiment. The more pedestrian 5950X or the now bargain 3950X are great for anyone doing a lot of compiling. With the right motherboard they even have ECC RAM support. Game changer for workstations in the $1000–$2000 range. The more expensive Threadripper parts really shine when memory bandwidth becomes a bottleneck. In my experience, compiling code hasn’t been very memory bandwidth limited. However, some of my simulation tools don’t benefit much going from 8 to 16 cores with regular Ryzen CPUs because they’re memory constrained. Threadripper has much higher memory bandwidth.
- ska 6y agoI suspect the biggest (build time) benefit to most c++ workflows and toolchains was the move to ubiquitous SSD. Prior to that in my experience excepting expensive RAID array dedicated build machines, it was really easy to build a system that would always be IO bound on builds. There of course were tricks to improve things but you still tended to hit that wall unless your CPUs were really under spec. edit: to be clearer, I'm not thinking of dedicated build machines here (hence RAID comment) but over all impact on dev time by getting local builds a lot faster.
- trhway 6y agoi (and some teamates) actually put HDDs on some workstations as SSD just die after 2-3 years of active build on them and with modern HDDs you have practically unlimited storage while you can have only limited number of 400G builds on SSD (the org has psychological barriers to having more than 1-2Tb SSD in a machine) and the SSD start to have perf issues when at 70-80% capacity . With HDD the build time didn't change much - the machines have enough memory for the system to cache a lot (256-512G RAM).
- outworlder 6y ago> i actually put HDDs on some workstations as SSD just die after 2-3 years of active build on them That sounds very low for modern SSDs, even consumer-grade. Have you tried different vendors?
- barkingcat 6y agothere's something much easier to bring 64 cores to its knees - chromium takes a loooong time to compile.
- mrlonglong 6y agoTwo and half hours on my trusty Threadripper 2920x. Firefox only takes 20 mins.
- renewiltord 6y agoHahaha, fuck me, CPUs are fast. That's wicked. 15 mins. A billion lines of C. Insane. Wonder if there's some IO speed to be gained from ramdisking the inputs.
- titzer 6y ago17,300 lines/sec per core. That's embarrassingly slow IMHO.
- bserge 6y agoWhat can perform better?
- viktorcode 6y agoOther languages do perform better
- Cyph0n 6y agoAs a huge Rust fan: not Rust :)
- bjoli 6y agoTCC is fast enough that you can recompile the kernel every time you boot up. I remember playing with TCC-boot back in 2015, and on a relatively beefy machine at the time I could compile the kernel in 5 seconds (or about 37mb/s iirc).
- rbanffy 6y agoBesides being fast, I imagine that one could implement every application ever developed in 1 billion lines of APL. I'll show myself out.
- josephg 6y agoGo, Jai, V8 (weirdly), some hobbyist C compilers.
- dboreham 6y agoThey finally got around to reusing mainframe model numbers.
- tester756 6y agoJust try to compile LLVM - maybe not 1b of LoC, but that's definitely going to be challenging
- czbond 6y ago1B Lines? And this is just from a "rails new" command. Had to for some levity.
- hikerclimber 6y agohopefully the virus continues evolving ever second all over the world so we can never have any cure and it never stops. hopefully billionaires lose all there money.
- bullen 6y agoIn my experience multi-core compilation does not work. make -j>3 just locks the process and fails.
- jcelerier 6y agoYou just need more ram. I 'ever compile at less than -j$(ncpu). Hard with less than 32 GB tho - a single clang instance can easily eat upwards of 1gb of ram
- bullen 6y agoAha, I only compile on ARM so I got no room to increase RAM... Is it the same with g++? I have 4GB so I should be able to compile with 4 cores, but the processes only fill 2-3 cores even when I try make -j8 on a 8 core machine and then locks the entire OS until it craps out?! Something is fishy...
- ahepp 6y agoWhy are you compiling on ARM with only 4GB RAM? Wouldn't it make more sense to cross compile from a machine with more resources, if you cared about build speed? (maybe there's a good reason not to do that, idk) If it's crapping out when you give it -j8, that seems to strongly suggest you're running into limited resources somewhere. I'm no expert in the intricacies of parallel builds, but as far as I know you can still have dependencies between targets that will limit parallelism.
- drmpeg 6y agoA swap file is your friend.
- bullen 6y agoActually, you win, swap was set to 0 by default! :D Also I only have 2GB (in 32-bit though)! Xo High karma HN users are toxic downers.
- gm 6y agoThat article mentioned Delphi and Object Pascal, and it brought back many fond memories. I absolutely LOVED Delphi and Object Pascal back in the day. So clean and so fun to program in. If Borland hadn't f-ed it up and had stayed around until now, I'd be the biggest Delphi fanboy. Alas, that was not to be. Modern languages are fun and all, but not Delphi-back-in-the-day level fun :-).
- nick__m 6y ago2 actively maintained version of Delphi still exist, the original one maintained by Embarcadero, and an open-source one available at https://www.lazarus-ide.org/ https://www.lazarus-ide.org/ .
- dboat 6y agoAfter liking this article, I wanted to check out others on the site, and am shocked at the terrible usability of their front page. I can't finish reading the titles of their articles before the page just keeps moving things around on me. It is so frustrating, which is unfortunate because I would otherwise have been interested to see more of their content. Experience completely ruined by awful design judgment.
- solinent 6y ago> 1B Lines of C++ Seems like our code is inflating quite rapidly. I remember when 1M was the biggest project. /snark
- zelly 6y agoOn Linux I would just use Bazel. It can burn through 1B lines of code on all cores.
- muststopmyths 6y agoInteresting. It would be cool to compare this against Visual Studio + Incredibuild, in my experience the most solid distributed C++ compilation tool.
- einpoklum 6y agoA Billion lines, eh? int main () { /* _______ _ _ _ _ |__ __| | (_) (_) | | | | | |__ _ ___ _ ___ __ _ | | ___ _ __ __ _ _ __ _ __ ___ __ _ _ __ __ _ _ __ ___ | | | '_ \| / __| | / __| / _` | | |/ _ \| '_ \ / _` | | '_ \| '__/ _ \ / _` | '__/ _` | '_ ` _ \ | | | | | | \__ \ | \__ \ | (_| | | | (_) | | | | (_| | | |_) | | | (_) | (_| | | | (_| | | | | | | |_| |_| |_|_|___/ |_|___/ \__,_| |_|\___/|_| |_|\__, | | .__/|_| \___/ \__, |_| \__,_|_| |_| |_| __/ | | | __/ | |___/ |_| |___/ */ return 0; }
- andy_ppp 6y agoDoes anyone have reviews of this on their JS test suite. The quicker the tests run the better my life, I have around 2000 quite slow tests... 76s MacBook 15” 2016, 30s M1 Apple Silicon Mac Mini, what should I expect with loads more cores like this?
- nevi-me 6y agoHow parallel do the tests run? The Threadrippers have massive number of cores, but their per-core performance is lower than say a Ryzen 9.
- throwaway81523 6y agoHow many times are they going to repeat the search phrases like "one billion lines"? It's reached the point where SEO obstructs human readability. It was cool that Object Pascal (maybe a descendant of Turbo Pascal) compiled 1e9 lines of Pascal in 5 minutes on the 64 core box. Scrolling way through the article, it looks like they had enough trouble setting up their parallel Windows C++ build environment on 64 cores that they ended up running 4 instances on 16 cores each, and splitting the source files among the instances. The build then took about 15 minutes on 64 cores, which is faster than I'd have expected. This all seems kind of pointless since distributed C++ compilation has been a thing for decades, so they could have used a cluster of Ryzens instead of "zowie look at our huge expensive single box".
- Daho0n 6y agoGreat article but for the love of god don't use Passmark. They are extremely bad on AMD scores. Now this is luckily two CPU's from AMD so it isn't bad but it is a bad comparison site as they heavily favour Intel.
- Tade0 6y agoThe images remind me of "Bad Apple!" as displayed on a CPU load graph of a 896 core machine: https://youtu.be/RY5_gutA_Vw https://youtu.be/RY5_gutA_Vw
- deleted 6y ago[deleted]
- ianhanschen 6y agoGreat read. I wonder if the make -j modification wasn’t scaling things across all cores because it was using the physical core count (number of cores) versus the logical core count (number of core threads). Or perhaps the code wasn’t modified to spread the work across all processor core groups (a Windows thing to support more than 64 logical cores). https://bitsum.com/general/the-64-core-threshold-processor-groups-and-windows/ https://bitsum.com/general/the-64-core-threshold-processor-g...
- robinei 6y agoThis shows that if you are making a not-very-fast compiler (most compilers these days), then the much maligned C compilation model has some serious advantages on modern and future hardware, due to its embarrassingly parallell nature.
- peter_d_sherman 6y agoThis seems to be a little bit related to this quest for fast compilation: The "mold" linker: https://github.com/rui314/mold https://github.com/rui314/mold >"Concretely speaking, I wanted to use the linker to link a Chromium executable with full debug info (~2 GiB in size) just in 1 second. LLVM's lld, the fastest open-source linker which I originally created a few years ago, takes about 12 seconds to link Chromium on my machine. So the goal is 12x performance bump over lld. Compared to GNU gold, it's more than 50x."