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

Finish the bazel install before building addons #1135

Merged
merged 1 commit into from
Feb 24, 2020
Merged

Finish the bazel install before building addons #1135

merged 1 commit into from
Feb 24, 2020

Conversation

gabrieldemarmiesse
Copy link
Member

@gabrieldemarmiesse gabrieldemarmiesse commented Feb 22, 2020

When running a dockerfile, bazel doesn't get installed completely after running the tools/ci_build/install/bazel.sh. Actually, when running the first build, bazel does 3 things:

  • Unpacking the bazel install
  • Downloading the JDK
  • Downloading from http archives set in the WORKSPACE file.

This delayed install isn't really compatible with how docker build works, since those install steps are not cached.

To get around the bazel hack of delayed install, I made another hack (fighting fire with fire XD) which is to clone the master branch and do a dry run of bazel build in a previous layer.

In that way, when the cache gets invalidated at the COPY step, we already have a full bazel install, no need to download the ~300MB of additional stuff at every build.

Depending on your internet connection, it can make a big difference. For example, before, locally, running the sanity check took me 2-3 minutes (and my internet connection is ~10Mbps, quite good on the global scale). Now it takes me 20 seconds . I get a similar speedup when running the cpu/gpu tests with docker.

Copy link
Member

@seanpmorgan seanpmorgan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM thanks for this optimization.

# hack to have the dependecies in the docker cache
# and have much faster local build with docker
# can be removed once docker buildx/buildkit is stable
# and we'll use "RUN --mount=cache ..." instead
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just curious, any information about when this will be removed remove experimental? Docker 20?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No idea. This project is public since quite some time now 2 years if I remember well. I hope it gets released soon. It has many other goodies that I'm super interested in using.

@seanpmorgan seanpmorgan merged commit e2005e2 into tensorflow:master Feb 24, 2020
@gabrieldemarmiesse gabrieldemarmiesse deleted the faster_sanity_check branch March 8, 2020 16:32
jrruijli pushed a commit to jrruijli/addons that referenced this pull request Dec 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants