Search code examples
visual-studiogpuxgboostlnk

Xgboost gpu install fatal error LNK1181


I am trying to install xgboost gpu support version by follow the follow instructions. xgboost-gpu-support

I use windows 10, visual studio 2017. The not-gpu-support version works fine. But for gpu-support version,when I release mode from Visual studio, it output error that LINK : fatal error LNK1181: cannot open input file “Release\gpuxgboost.lib”.

Everything go on well in previous steps. How can I slove this problem? Thanks in advance.

(my project is D:\Software\xgboost\xgboost\build\ALL_BUILD.vcxproj, there is not space. So this solution does not work. lnk1181-error-message-when-you-build-a-manag


Solution

  • As I have seen many people struggling to correctly build the xgboost library with GPU support, and given that, in my opinion, the documentation on this matter is at least incomplete, I decided to share my experience on this. First of all, this process was successful on a Windows 10 x64 platform. The tools I used were:

    1. Microsoft Visual Studio 2015 Express, https://www.visualstudio.com/vs/visual-studio-express/
    2. Cmake, https://cmake.org/
    3. Git (Git for Windows), https://git-for-windows.github.io/

    In order to build the xgboost library with GPU support, you should first check the compatibility of your graphics card with the xgboost requirements. The xgboost supports CUDA version for 8.0 and up. A graphics card with computing capability from 3.0 and up meets this requirement. You can check this here:

    https://developer.nvidia.com/cuda-gpus

    Then you have to download and install the appropriate CUDA SDK for your system. You can find it here:

    https://developer.nvidia.com/cuda-downloads

    You can use the sample projects coming with the SDK, to check if they can be built and run correctly in your system.

    This step is essential (at least it was in my case) for building the library with GPU support. Go to the installation directory of Microsoft Visual Studio 2015 at the subdirectory VC/bin. In this:

    1. Copy all the contents of the subdirectory x86_amd64 to the subdirectory amd64.

    2. Inside the amd64 subdirectory, rename the file vcvarsx86_amd64.bat to vcvars64.bat.

    Then, open Git Bash, and type the following commands:

    1. git clone --recursive https://github.com/dmlc/xgboost
    2. cd xgboost
    3. git submodule init
    4. git submodule update
    5. mkdir build
    6. cd build
    7. cmake .. -G"Visual Studio 14 2015 Win64" -DUSE_CUDA=ON

    After cmake is finished, open ALL_BUILD.vcxproj with Visual Studio 2015. Choose Solution Configurations ‘Release’ and Solution Platforms ‘x64’. Build->Build Solution. When the build process is finished, the xgboost.dll library file will be located in xgboost/lib directory.

    Finally, you can proceed with the Python package or R package installation.