-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Consider defaulting to linkshared
for libraries when bazel-building on Linux to improve debug build performance
#5752
Comments
I've also had this on my mind for a while; glad to have it in issue for now. I've wondered if we might be able to nibble away at this, by e.g. making RigidBodyTree and/or RigidBodyPlant (and maybe the parsers) into shared libraries, but leaving other things alone. Their object code is exceedingly huge, so once we shove it out of the way, everything else might be okay for a while. I'm not sure if getting 1..3 libraries working is any easier or harder that getting them all working, but maybe it's a worthwhile experiment. |
Related: #5900 |
All issues must have owners; feel free to reassign elsewhere as needed (or close), etc. |
This is floating nearer to the top of things I might work on. What I'm stuck on now is some good benchmarking regime. Which conops should we work on? Cold cache building from scratch? Change something in Which machine types should we benchmark? The TRI 48 vCPU workstations? Lenovo laptops? Some representative 4 vCPU student laptop? (I'm assuming we'll keep the optimizations guarded as Linux-only, given the OS X fragility.) |
This should have a more noticeable effect for Debug builds since the generated static libraries are much bigger. I suspect the result will be very noticeable in my 8 CPU VMWare Ubuntu with limited RAM and disk. I can run smallish benchmarks but I can't actually build all of Drake from scratch in this box without crashing if all the RigidBodyTree mega-modules try to compile in parallel. |
Proposed scenarios:
For each scenario, separately measure:
Proposed configurations:
Proposed platforms:
|
If I'm reading bazelbuild/bazel#492 correctly, if we remove |
For the record, I think this will get bumped off my plate, though hopefully the ideas above are a good starting point. Might also be worth testing using the newest released Bazel, instead of 0.4.5. |
I started a few experiments with this today. A few hints to help guide the exploration:
|
Per #6760, it looks like this may be an easy switch over. The main caveat to look out for is when deploying things via |
This is a temporary solution pending a more long-term solution to have `find_resource` be its own shared library (RobotLocomotion#5752 + RobotLocomotion#7294); it is difficult at present to carve out `find_resource` as it has upstream dependencies that would need to be carved out into shared libraries.
This is a temporary solution pending a more long-term solution to have `find_resource` be its own shared library (RobotLocomotion#5752 + RobotLocomotion#7294); it is difficult at present to carve out `find_resource` as it has upstream dependencies that would need to be carved out into shared libraries.
Closing this for now. This is a low-level incantation of trying to address #6760; best handled by that issue. |
Er, I guess also for size optimization, but it has not been readily cited as an acute pain point yet. |
If building a set of tests or binaries in debug mode using bazel, you may notice slow read warnings such as this when linking or executing binaries:
This could possibly be mitigated by defaulting to shared libraries on Linux.
Spoke to @david-german-tri, and the rationale for using static libraries was to make things simpler on Mac OSX and avoid issues such as #4952 and bazelbuild/bazel#507.
He mentioned that this could be accomplished with a
select
switch inside thedrake_cc_*
macros intools/drake.bzl
.The workaround in this case is to follow the standard workflow to generally build in release mode (without
-c dbg
in your~/.bazelrc
or bazel command), and only build in debug mode when needed.The text was updated successfully, but these errors were encountered: