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

Use ccache in github actions builds #3705

Merged

Conversation

scottwittenburg
Copy link
Collaborator

@scottwittenburg scottwittenburg commented Jul 20, 2023

Add an action available on the marketplace to GithubActions builds, which simplifies using ccache to speed up compilation. The table below shows the speed up for some of the affected builds (note: times are build times only, and do not include any of the other steps). On the first run, the cache was empty, so there was no benefit at all. On the second run, the cache hit rates were all around 100%, since I didn't change any source files in between.

                  Build Name                  |         Time To Build
                                              |   first run  |  second run
----------------------------------------------|-----------------------------
  linux_ubuntu (ubuntu20.04, gcc8, serial)    |     7m 28s   |      44s
  linux_ubuntu (ubuntu20.04, gcc8, ompi)      |    10m 30s   |   1m 36s
  linux_ubuntu (ubuntu20.04, gcc9, ompi)      |     9m 27s   |   1m 36s
  linux_ubuntu (ubuntu20.04, gcc10, ompi)     |    12m 36s   |   1m 29s
  linux_ubuntu (ubuntu20.04, gcc10, mpich)    |     9m  3s   |   1m 20s
  linux_ubuntu (ubuntu20.04, gcc11, ompi)     |     9m 13s   |   1m 25s
  linux_ubuntu (ubuntu20.04, clang6, serial)  |     4m 38s   |      40s
  linux_ubuntu (ubuntu20.04, clang6, ompi)    |     6m 58s   |   1m 31s
  linux_ubuntu (ubuntu20.04, clang10, ompi)   |     7m 22s   |   1m 20s

I pre-installed ccache in builds where we control the image being used, but ccache-action installs it if it doesn't exist.

As a follow-on, or even in this PR, we could consider using dependabot to keep this action (and any others we use, eg checkout, upload-artifact, etc) up to date. See here.

@scottwittenburg scottwittenburg changed the title Use ccache in ubuntu builds Use ccache in github actions builds Jul 20, 2023
@scottwittenburg
Copy link
Collaborator Author

Looking at one of the windows builds, I see this issue, where it isn't saving any cache files after the build.

It seems to be a known issue, see here.

@vicentebolea
Copy link
Collaborator

vicentebolea commented Jul 21, 2023

Looking at one of the windows builds, I see this issue, where it isn't saving any cache files after the build.

It seems to be a known issue, see here.

If this will halt this feature, we can come back later to add ccache to windows builds.

@vicentebolea
Copy link
Collaborator

@scottwittenburg let me know when you need review, I was asked to review automatically since I was listed in the codeowner.

@vicentebolea vicentebolea removed their request for review July 21, 2023 01:13
@scottwittenburg
Copy link
Collaborator Author

If this will halt this feature, we can come back later to add ccache to windows builds.

I don't see it halting the feature. We can disable it on windows for now, and as you suggest, come back to it later. Also, as an alternate option, I think we could leave it enabled, even though there's no benefit currently, since the cost is low (based on the times listed in the action log, only a few seconds to install ccache, no time to restore cache, and a second or something to print the message about not saving cache).

Do you have a preference? I can see pros/cons both ways, and am interested in your thoughts.

@vicentebolea
Copy link
Collaborator

Do you have a preference?

Disable it in Windows, using ccache we always incur in a overhead, cache miss + build TU is worse than build TU.

Copy link
Collaborator

@vicentebolea vicentebolea left a comment

Choose a reason for hiding this comment

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

Great that this is working! Thanks a lot! lets try to get rid of that gh action since we could replace it by a few env var exports.

.github/workflows/everything.yml Outdated Show resolved Hide resolved
.github/workflows/everything.yml Show resolved Hide resolved
.github/workflows/everything.yml Outdated Show resolved Hide resolved
@scottwittenburg
Copy link
Collaborator Author

@vicentebolea Please take a look when you get a chance. If you don't have any more suggestions, I will just rewrite the history into two commits, and then we can merge.

@vicentebolea
Copy link
Collaborator

vicentebolea commented Jul 31, 2023

@scottwittenburg I just rebased your branch so that it contains the latest commit that "fixes" the tests failures.

It seems intel recently came out with the 2023.2.0 versions of these
packages, and those were picked with the most recent build.  When
the newest versions were chosen, we could no longer load the "icc"
or "compiler" modules, so pin to the previous working version.
@scottwittenburg scottwittenburg merged commit 15374f2 into ornladios:master Aug 1, 2023
28 checks passed
@scottwittenburg scottwittenburg deleted the gha-ubuntu-builds-use-ccache branch August 1, 2023 16:06
@scottwittenburg
Copy link
Collaborator Author

Cache was not saved on any of the runs on master, see here for example.

In my PR testing, I exercised half of this conditional before adding the additional criteria github.ref_name == 'master', by re-running a workflow on the same sha and making sure that cache was not saved.

So I'm not sure yet why it didn't save cache. Here it says that the ${{ }} is not required in if: statements, but then it proceeds to use them everywhere in that documentation anyway. Maybe I need to add those?

@vicentebolea
Copy link
Collaborator

}} is

That is odd, I guess that we need to merge it to check it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants