-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
[R-package] speed up installation with Visual Studio #2965
[R-package] speed up installation with Visual Studio #2965
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Huh, fake project, nice hack!
@Laurae2 @StrikerRUS could you have another look? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see any issues in logic in this PR. But please wait for an approval of R-maintainers 🙂 .
note to self: per #2936 (comment), I think that in CI we need to add If it isn't in our installation instructions already, we should make it clear there that |
Now that #2936, I'll get this updated tonight and add CI support for Visual Studio builds. I'll request new reviews after that. |
@jameslamb Please remove all speedups ( |
@StrikerRUS I will do that, but I'm pretty confident we're going to decide not to use Toggling the timestamps, I can see 22 minutes of that is just the install: UPDATE: looking closer, it takes 10+ minutes between "build files have been written" and the first compilation log message
I'm going to experiment a big on my fork to not take up our CI capacity. Will report back. I'll keep updating this comment. Will let you know when I reach a conclusion.
NOTE: I can see on the builds on my fork that we're now getting failures on non-Windows like this: * checking compilation flags used ... WARNING
Compilation used the following non-portable flag(s):
‘-Wno-ignored-attributes’ ‘-Wno-return-type’ ‘-Wno-unknown-pragmas’
including flag(s) suppressing warnings I think it's because I'm temporarily echoing |
I have been trying on my fork and cannot get the build times for R + MSVC under 24 minutes. They run very fast ( I have narrowed down the slowness with a lot of print debugging...it takes 10 minutes between when this line appears in the log
and when compilation starts. Even for the test project that has no source files and whose That means I've at least narrowed it down to that, which rules out build-time flags like Theories I tried which were not correct:
My last guess here is that because |
What about |
Hmm, I've noticed that current R builds with MinGW on Windows have interesting variance:
|
Taking a quick look at those, if you click
This is kind of a manual and painful process though, I'm sure if we looked across all builds we'd find other sources of variability. Maybe I'll try writing a script tonight that does that, so I know where to focus my effort. |
Nice investigation! But I think that the main goal now is to try to minimize actual building time of R package. Can you please clarify that? |
right sorry, let me clarify:
Things I tried to fix this, which did not work:
Things I'm going to try next:
|
There is a lot of information I'm reading through in this answer: https://stackoverflow.com/a/37327661 |
The situation looks even worse on AppVeyor. I cancelled this build after 34 minutes 😱 https://ci.appveyor.com/project/jameslamb/lightgbm/builds/32675576 I ran again with https://ci.appveyor.com/project/jameslamb/lightgbm/builds/32675702 You can see from the timestamps on the logs there that it takes about 2 and a half minutes to get to the point where |
Ok I might be making progress! To investigate my theory that this is about disk I/O (since Get-CimInstance Win32_PerfRawData_PerfDisk_LogicalDisk
NOTE: There is no AppVeyor log: https://ci.appveyor.com/project/jameslamb/lightgbm/builds/32676579?fullLog=true This is exciting, and I think it's good evidence of what's happening!
I'm going to see if moving to but wait...why hasn't this been a problem for Python builds? I don't think we ever test using the Visual Studio generator ( LightGBM/python-package/setup.py Lines 136 to 148 in 18c706d
|
Short SummaryDisk throughput does the difference between install times on CI and my laptop, but moving from How I reached this conclusionBased on #2965 (comment), I tried adding some logic that says "if you are on Azure, work in I tested on my fork. I tried 5 builds with copying to All builds below are already using the configuration of Test Resultswith (build link) median: 26m22s without median: 25m53s Conclusion
Next StepIt might be possible to cut one of the This is the only other idea I have, so I'll try that tomorrow. If it doesn't work or we decide it introduces too much complexity, I think 25-minute builds will be something we have to live with to prevent things like #2995 and #2997 from re-emerging. |
f9057c3
to
596b5ef
Compare
Got it down to 16 minutes!I know this PR has a lot of long comments, I apologize. Wanted to document the investigation as I went, since it reveals a lot about how we're building the R package and the project in general. I now have the MSVC builds down to 16 minutes! What Changed?I tried this idea from #2965 (comment)
I did 5 builds |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Something went wrong during merging branches.
I'm very confused about what could have happened. Trying to figure it out. I don't understand why changes like #3078 are showing up in the diff, since they already exist on |
513684e
to
ebfbacc
Compare
Ok I think I fixed the conflicts! I still have no idea how we got into this state...the danger of long-lived feature branches, I guess 😬 I am also very unsure how this PR only has one commit now. I only Either way, I think this PR is back to the state it was as of all previous reviews, including the most recent suggestion (#2965 (comment)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jameslamb
Great improvement! Thanks a lot!
One comment for your consideration.
Thanks for the reviews everyone! I'll merge this when it builds. |
Ok well now it's ✅ but I can see the |
this link is definitely valid though: https://github.com/microsoft/LightGBM/blob/master/python-package/README.rst#build-from-sources |
I hope that with |
* fix conflicts * Update R-package/src/install.libs.R * empty commit
* fix conflicts * Update R-package/src/install.libs.R * empty commit
* fix conflicts * Update R-package/src/install.libs.R * empty commit
This pull request has been automatically locked since there has not been any recent activity since it was closed. To start a new related discussion, open a new issue at https://github.com/microsoft/LightGBM/issues including a reference to this. |
This is another PR that contributes to #2936 , but which I think has standalone value.
Right now on Windows, to figure out which version of Visual Studio is available we try to build
lib_lightgbm
by generating and executing the correspondingCMake
Makefile for the 3 most recent versions of VS. This is pretty expensive, and means that you have to buildlib_lightgbm
.I went into this thinking that this is why r-package CI builds on Azure Devops with Visual Studio take 20 minutes...and it seems like it! I tested merging these changes into #2936 on my fork, and it takes the build time down from 20 minutes to about 9 minutes.