Navigation Menu

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gccgo: build process should not be serial bottlenecked #24962

Closed
ppbrown opened this issue Apr 20, 2018 · 6 comments
Closed

gccgo: build process should not be serial bottlenecked #24962

ppbrown opened this issue Apr 20, 2018 · 6 comments

Comments

@ppbrown
Copy link

ppbrown commented Apr 20, 2018

this is for the gcc 7.3.0 codebase.

I have a 100 cpu-thread box.
I'm running with gmake -j 50

It hits some part of the go build stage.. and then grinds to a crawl.

here is a snippet of some of the crazy long output at this point:

f=echo net/smtp.lo | sed -e 's/.lo$/.o/'; gobjcopy -j .go_export $f net/smtp.s-gox.tmp; /bin/sh ../../../../libgo/mvifdiff.sh net/smtp.s-gox.tmp echo net/smtp.s-gox | sed -e 's/s-gox/gox/'
echo timestamp > net/smtp.s-gox

sorry I'm not a GNU makefile expert, so cant suggest a patch :(
I just know that when it builds normal C or C++ based libs, it does the nice massively parallel compiles, but when it hits that stage of compling, with
libtool (blahblah) gccgo blahblah..

suddenly, it seems to stop parallelizing for a long time, comparatively speaking

@gopherbot gopherbot added this to the Gccgo milestone Apr 20, 2018
@ppbrown
Copy link
Author

ppbrown commented Apr 20, 2018

Eh... perhaps I was premature in opening this.
in rerunning the build, seems like there are other places where gcc isnt so parallel.
So probably unfair to single out the libgo part of things.

@ppbrown ppbrown closed this as completed Apr 20, 2018
@ianlancetaylor
Copy link
Contributor

The way to approach this is to run ps uwww when the build seems to be stuck, to see which jobs are running.

Note that Go is not C/C++. Although Go often compiles faster, it is more prone to serial bottlenecks.

@ppbrown
Copy link
Author

ppbrown commented Apr 20, 2018

oops.. well since you commented, seems fair to add a reply...
yes I understand that normally, go has its own build engine and rules.
However, the driver behind gccgo/libgo compilation appears to be more specifically GNUmake driven.
so my guess is that the slowdown area has more to do with gmake logic.
After all, there are 1137 non-test related ".go" files.
So, even if there is some amount of required dependancy in the mix, it still seems like better parallelism should be achievable.
But.. meh. oh well.

@ianlancetaylor
Copy link
Contributor

Whether building with gccgo or the go tool, the Go compilation model has serialization that the C/C++ model does not. In C/C++ a dependency is expressed by #include a .h file. In Go a dependency is expressed by importing a package. In C/C++ the .h file is already present in the source tree. In Go the imported package must be compiled. The effect is that C/C++ compilation does much more work overall: the .h file is read and parsed many times. But on the other hand the C/C++ compilation is more parallelizable, in that you can compile code immediately without having to wait for the dependencies to be compiled.

@ppbrown
Copy link
Author

ppbrown commented Apr 20, 2018 via email

@ianlancetaylor
Copy link
Contributor

The libgo build is parallelizable and it is parallelized. But you still hit a roadblock. In my experience the problem is the net/http package, which is one of the most complex packages and also has a great deal of dependencies. So you have to build most of libgo, and only then do you get to build net/http, and then you block until that specific build is complete, and then you build in parallel a few remaining packages that depend on net/http.

The build trigger for PACKAGES is simply that it appears in $(libgo_go_objs) which is an input to libgo.la.

@golang golang locked and limited conversation to collaborators Apr 20, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants