xgboost icon indicating copy to clipboard operation
xgboost copied to clipboard

[CI] Build and Test XGBoost GPU algorithm with Microsoft Visual Studio 2019

Open hcho3 opened this issue 4 years ago • 6 comments

There have been a user report saying that Visual Studio 2019 could not compile XGBoost from the source. See https://discuss.xgboost.ai/t/installing-xgboost-with-gpu-support-for-r-on-windows-build-does-not-complete/2227/15. The issue surfaces when the GPU support is enabled with -DUSE_CUDA=ON.

Currently, our CI uses Visual Studio 2017 to build and test the GPU algorithm.

hcho3 avatar Jun 06 '21 01:06 hcho3

Just tried building XGBoost with Visual Studio 2019 + CUDA 11.3, and the build fails with cryptic error

identifier "_Verify_range" is undefined

System information:

  • Windows Server 2019
  • Visual Studio 2019 version 16.10.1
  • CUDA 11.3

It would be best if we find the combination of compiler versions that are known to work on the Windows platform, as CUDA can be finicky about the version of the host compiler.

hcho3 avatar Jun 09 '21 20:06 hcho3

Known to work: Visual Studio 2017 + CUDA 10.1

hcho3 avatar Jun 09 '21 20:06 hcho3

I have just tested 2019 + cuda 11.4 and didn't see the error. After adding proper includes in some test files I was able to build XGBoost in this configuration.

trivialfis avatar Aug 23 '21 10:08 trivialfis

I pushed the changes to https://github.com/dmlc/xgboost/pull/7180 .

trivialfis avatar Aug 23 '21 14:08 trivialfis

I believe I am that user. I continue to have issues with VS 2022, 2019, and 2017, althouh error now is not the same as before and it is the same for each. I am using WIndows 10 64 bit and CUDA 11.7.

D:\xgboost\src\tree\gpu_hist\histogram.cu(315): note: see reference to function template instantiation 'auto xgboost::tree::BuildGradientHistogram::<lambda_6d0a0949a274b91398442d30e87cb3ab>::operator ()<void(__cdecl *)(x gboost::EllpackDeviceAccessor,xgboost::tree::FeatureGroupsAccessor,xgboost::common::Span<const uint32_t,18446744073709551615>,GradientSumT *__restrict ,const xgboost::GradientPair *__restrict ,xgboost::tree::HistRounding <GradientSumT>)>(void (__cdecl )(xgboost::EllpackDeviceAccessor,xgboost::tree::FeatureGroupsAccessor,xgboost::common::Span<const uint32_t,18446744073709551615>,GradientSumT _restrict ,const xgboost::GradientPair *re strict ,xgboost::tree::HistRounding<GradientSumT>)) const' being compiled with [ GradientSumT=xgboost::detail::GradientPairInternal ] D:\xgboost\src\tree\gpu_hist\histogram.cu(323): note: see reference to function template instantiation 'void xgboost::tree::BuildGradientHistogram<xgboost::detail::GradientPairInternal>(const xgboost::EllpackDevi ceAccessor &,const xgboost::tree::FeatureGroupsAccessor &,xgboost::common::Span<const xgboost::detail::GradientPairInternal,18446744073709551615>,xgboost::common::Span<const uint32_t,18446744073709551615>,xgboost: :common::Span<xgboost::detail::GradientPairInternal,18446744073709551615>,xgboost::tree::HistRounding<xgboost::detail::GradientPairInternal>,bool)' being compiled D:\xgboost\src\tree\gpu_hist\histogram.cu(298): error C2131: expression did not evaluate to a constant [D:\xgboost\buildgpu\src\objxgboost.vcxproj] D:\xgboost\src\tree\gpu_hist\histogram.cu(298): note: failure was caused by a read of a variable outside its lifetime D:\xgboost\src\tree\gpu_hist\histogram.cu(298): note: see usage of 'this' D:\xgboost\src\tree\gpu_hist\histogram.cu(299): warning C4267: 'initializing': conversion from 'size_t' to 'int', possible loss of data [D:\xgboost\buildgpu\src\objxgboost.vcxproj] **C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\VC\VCTargets\BuildCustomizations\CUDA 11.7.targets(790,9): error MSB3721: The command ""C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.7
bin\nvcc.exe" -gencode=arch=compute_86,code="sm_86,compute_86" -gencode=arch=compute_86,code="compute_86,compute_86" -gencode=arch=compute_86,code="sm_86,compute_86" --use-local-env -ccbin "C:\Program Files (x86)\Mic rosoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.16.27023\bin\HostX86\x64" -x cu -ID:\xgboost\include -I"D:\xgboost\dmlc-core\include" -ID:\xgboost\rabit\include -ID:\xgboost\gputreeshap -I"D:\xgboost\buildgpu\dml c-core\include" -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.7\include" --keep-dir x64\Release -maxrregcount=0 --machine 64 --compile -cudart static --expt-extended-lambda --expt-relaxed-constexpr -Xfatb in=-compress-all -lineinfo -std=c++14 -Xcompiler="/EHsc -Ob2 -openmp /utf-8" -D_WINDOWS -DNDEBUG -D_CRT_SECURE_NO_WARNINGS -D_CRT_SECURE_NO_DEPRECATE -DXGBOOST_USE_CUDA=1 -DDMLC_LOG_CUSTOMIZE=1 -DXGBOOST_MM_PREFETCH_PRES ENT=1 -D__USE_XOPEN2K8 -DDMLC_CORE_USE_CMAKE -DDMLC_USE_CXX11=1 -DXGBOOST_STRICT_R_MODE=1 -DXGBOOST_CUSTOMIZE_GLOBAL_PRNG=1 -DDMLC_LOG_BEFORE_THROW=0 -DDMLC_DISABLE_STDIN=1 -DRABIT_CUSTOMIZE_MSG
-DRABIT_STRICT_CXX98
-D"C MAKE_INTDIR="Release"" -D_MBCS -DWIN32 -D_WINDOWS -DNDEBUG -D_CRT_SECURE_NO_WARNINGS -D_CRT_SECURE_NO_DEPRECATE -DXGBOOST_USE_CUDA=1 -DDMLC_LOG_CUSTOMIZE=1 -DXGBOOST_MM_PREFETCH_PRESENT=1 -D__USE_XOPEN2K8 -DDMLC_CORE_USE CMAKE -DDMLC_USE_CXX11=1 -DXGBOOST_STRICT_R_MODE=1 -DXGBOOST_CUSTOMIZE_GLOBAL_PRNG=1 -DDMLC_LOG_BEFORE_THROW=0 -DDMLC_DISABLE_STDIN=1 -DRABIT_CUSTOMIZE_MSG -DRABIT_STRICT_CXX98
-D"CMAKE_INTDIR="Release"" -Xcompiler "/ EHsc /W3 /nologo /O2 /Fdobjxgboost.dir\Release\objxgboost.pdb /FS /MT /GR" -o objxgboost.dir\Release\histogram.obj "D:\xgboost\src\tree\gpu_hist\histogram.cu"" exited with code 2. [D:\xgboost\buildgpu\src\objxgboost.vcxp roj]

aadler avatar Aug 18 '22 22:08 aadler

According to Visual Studio, rhe error comes from line 298 in histogram.cu which reads:

constexpr int kMinItemsPerBlock = kItemsPerTile;

If that helps.

aadler avatar Aug 19 '22 16:08 aadler

I think it's fixed in 1.7.

trivialfis avatar Nov 04 '22 19:11 trivialfis