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

[CI] Add Windows GPU to Jenkins CI pipeline #4463

Merged
merged 12 commits into from
May 14, 2019
Merged

Conversation

hcho3
Copy link
Collaborator

@hcho3 hcho3 commented May 13, 2019

1. Add Windows GPU to Jenkins CI pipeline (see #4234). All pull requests will now be tested to ensure compatibility with Windows platform.

2. Fix #4462: Use /MT flag consistently so that MSVC builds don't fail

Background: Microsoft Visual C++ (MSVC) offers multiple options for the C++ runtime: /MT (static runtime) and /MD (shared DLL runtime). XGBoost has traditionally used /MT to compile all sources. The utility function msvc_use_static_runtime() is defined in cmake/Utils.cmake to replace all occurrences of /MD with /MT.

Diagnosis of #4462: Recently, #4323 revised CMakeLists.txt extensively so as to incorporate CUDA as a first-class language. The same pull request also split off objxgboost target as a separate CMake module. For some unknown reasons, objxgboost was using /MD, whereas the rest of XGBoost was using /MT.

Fix (more of a hack actually): Call msvc_use_static_runtime() multiple times to completely remove /MD.

Fixes #4462.

@hcho3 hcho3 requested review from RAMitchell and trivialfis May 13, 2019 05:48
@hcho3 hcho3 changed the title Fix #4462: Use /MT flag consistently for MSVC target [CI] Use /MT flag consistently for MSVC target May 13, 2019
@hcho3 hcho3 mentioned this pull request May 13, 2019
18 tasks
Copy link
Member

@RAMitchell RAMitchell left a comment

Choose a reason for hiding this comment

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

Bit strange having to call it more than once. Maybe these flags get reset in places. Works on my local machine. This will do for now though so we can get 0.9 out.

Copy link
Member

@trivialfis trivialfis left a comment

Choose a reason for hiding this comment

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

Let's stay with this hack for now. Looks good to me except for whether is MSVC getting the right c++ version.

src/CMakeLists.txt Show resolved Hide resolved
@hcho3 hcho3 changed the title [CI] Use /MT flag consistently for MSVC target [CI] Add Windows GPU to Jenkins CI pipeline May 13, 2019
@hcho3 hcho3 requested review from trivialfis and RAMitchell May 13, 2019 07:26
@hcho3
Copy link
Collaborator Author

hcho3 commented May 13, 2019

@RAMitchell @trivialfis I'm asking you to review again, now that I added a CI pipeline for Windows GPU target. See example at https://xgboost-ci.net/blue/organizations/jenkins/xgboost-win64/detail/PR-4463/10/pipeline

Copy link
Member

@trivialfis trivialfis left a comment

Choose a reason for hiding this comment

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

Looks good to me.

Copy link
Member

@RAMitchell RAMitchell left a comment

Choose a reason for hiding this comment

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

Looks good thanks Philip! Do you plan to add tests, or should we do this later?

@hcho3
Copy link
Collaborator Author

hcho3 commented May 13, 2019

@RAMitchell I'll add tests in a follow-up pull request.

@hcho3
Copy link
Collaborator Author

hcho3 commented May 14, 2019

I keep seeing the error

LINK : fatal error LNK1104: cannot open file 'C:/Jenkins/workspace/xgboost-win64_PR-4463/build/Release/xgboost.lib'

(https://xgboost-ci.net/blue/organizations/jenkins/xgboost-win64/detail/PR-4463/17/pipeline)

And the funny thing is that the error goes away when I run msbuild multiple times (https://xgboost-ci.net/blue/organizations/jenkins/hcho3-xgboost-ci-test/detail/jenkins_refactor/29/pipeline/)

@hcho3
Copy link
Collaborator Author

hcho3 commented May 14, 2019

This is interesting: apache/mxnet#12563. NMake JOM is supposedly faster than MSBuild. Let me try it.

@hcho3
Copy link
Collaborator Author

hcho3 commented May 14, 2019

Actually I'm seeing the same issue with JOM. And I'm not seeing any significant build speedup with JOM. For now, I'm resorting to running msbuild 3 times to stamp out spurious errors like LNK1104.

@hcho3
Copy link
Collaborator Author

hcho3 commented May 14, 2019

Looks like running MSBuild 3 times fixed the issue for now. I'll merge this after all tests pass.

@RAMitchell
Copy link
Member

You can fix this issue by adding a dependency between targets that are conflicting: https://cmake.org/cmake/help/v3.8/command/add_dependencies.html

This forces certain operations to finish before others.

@hcho3
Copy link
Collaborator Author

hcho3 commented May 14, 2019

@RAMitchell Nice. Thanks for the pointer. I spent quite some time to try to fix the issue.

Indeed, the old CMakeLists.txt used to have add_dependencies():

add_dependencies(xgboost runxgboost)

I'll go ahead and add it back.

@hcho3
Copy link
Collaborator Author

hcho3 commented May 14, 2019

@RAMitchell Yes! The LNK1104 error is now fixed for good. I can now sleep better tonight

@hcho3 hcho3 merged commit c6f2a7e into dmlc:master May 14, 2019
@hcho3 hcho3 deleted the fix_win_cmake_rt branch May 14, 2019 04:45
@hcho3
Copy link
Collaborator Author

hcho3 commented May 14, 2019

Merged. Thanks all

@lock lock bot locked as resolved and limited conversation to collaborators Aug 12, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BLOCKING] Latest XGBoost with CUDA fails to compile on Windows
3 participants