[cuda] make NCCL optional for single-GPU builds (USE_NCCL)#30
Open
Shraman123 wants to merge 1 commit into
Open
[cuda] make NCCL optional for single-GPU builds (USE_NCCL)#30Shraman123 wants to merge 1 commit into
Shraman123 wants to merge 1 commit into
Conversation
NCCL has no official distribution for Windows, but USE_CUDA has
unconditionally required find_package(NCCL REQUIRED) and linked
NCCL::NCCL even when only a single GPU is used and no multi-GPU
collective ever runs. That makes it impossible to build the CUDA
backend on Windows at all, single GPU or not.
Add a USE_NCCL option (default ON, matching prior behavior on
Linux/macOS). When turned OFF:
- NCCL is no longer find_package()'d or linked.
- nccl_gbdt.cpp/NCCLGBDT (the multi-GPU boosting path) is excluded
from the build; Boosting::CreateBoosting falls back to a regular
single-GPU GBDT with a warning if num_gpu > 1 is requested anyway.
- cuda_utils.hu substitutes minimal stand-in types/functions for the
handful of NCCL symbols (ncclComm_t, NCCLAllReduce, ...) that the
single-GPU tree learner's shared NCCLInfo base class references
even when no communicator is ever created (nccl_communicator_
stays nullptr, so these are compiled but never invoked).
Verified: cmake -DUSE_CUDA=ON -DUSE_NCCL=OFF configures and builds
cleanly on Windows (MSVC + CUDA 12.5), and single-GPU CUDA training
runs end-to-end on a GTX 1650.
2 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
USE_CUDA=ONunconditionally requiresfind_package(NCCL REQUIRED)and linksNCCL::NCCL, even for a single GPU where no multi-GPU collective ever runs. NCCL has no official distribution for Windows, so this makes it impossible to build the CUDA backend on Windows at all - single GPU or not.Adds a
USE_NCCLoption (defaultON, so existing Linux/macOS builds are unaffected). When-DUSE_NCCL=OFF:find_package()'d or linked.nccl_gbdt.cpp/NCCLGBDT(the multi-GPU boosting path) is excluded from the build;Boosting::CreateBoostingfalls back to a regular single-GPUGBDTwith a warning ifnum_gpu > 1is requested anyway.cuda_utils.husubstitutes minimal stand-in types/functions for the handful of NCCL symbols (ncclComm_t,NCCLAllReduce, ...) that the single-GPU tree learner's sharedNCCLInfobase class references even when no communicator is ever created (nccl_communicator_staysnullptr, so these are compiled but never invoked -NCCLCHECKreports a clear fatal error in the unreachable case where one somehow is).Test plan
cmake -DUSE_CUDA=ON -DUSE_NCCL=OFF -DCMAKE_CUDA_ARCHITECTURES=75 ...configures cleanly on Windows without NCCL installedexamples/binary_classification,device_type=cuda) - logloss decreased and AUC improved over 10 iterations as expected