-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
[cmake] source file globbing is done incorrectly #6267
Labels
Comments
Thanks for using LightGBM and for the excellent report! Would you like to submit a pull request with a fix? |
Ah I see you've already opened #6268. Thanks very much! |
jameslamb
pushed a commit
that referenced
this issue
Jan 12, 2024
This issue 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. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Description
The attempt to include CUDA sources files only when
USE_CUDA
is true is done incorrectly, which can cause errors when LightGBM is built as part of a CMake superproject. Nesting,if()
commands inside of afile(GLOB)
command is just addingif(USE_CUDA)
andendif()
as globbing patters, not filtering the patterns between them.Reproducible example
Running CMake with tracing will allow you to see that you are not removing anything with the above command
cmake --trace --trace-expand --trace-redirect=trace.log -B build -S .
Tracing the will reveal that filtering the file globbing command failed: the CUDA files are included in the list of sources for the
lightgbm_objs
library, even thoughUSE_CUDA
isOFF
./home/sbj/Sandbox/LightGBM/CMakeLists.txt(421): file(GLOB SOURCES src/boosting/*.cpp src/io/*.cpp src/metric/*.cpp src/objective/*.cpp src/network/*.cpp src/treelearner/*.cpp src/utils/*.cpp if ( USE_CUDA ) src/treelearner/*.cu src/boosting/cuda/*.cpp src/boosting/cuda/*.cu src/metric/cuda/*.cpp src/metric/cuda/*.cu src/objective/cuda/*.cpp src/objective/cuda/*.cu src/treelearner/cuda/*.cpp src/treelearner/cuda/*.cu src/io/cuda/*.cu src/io/cuda/*.cpp src/cuda/*.cpp src/cuda/*.cu endif ( ) ) /home/sbj/Sandbox/LightGBM/CMakeLists.txt(448): add_library(lightgbm_objs OBJECT /home/sbj/Sandbox/LightGBM/src/boosting/boosting.cpp;/home/sbj/Sandbox/LightGBM/src/boosting/cuda/cuda_score_updater.cpp;/home/sbj/Sandbox/LightGBM/src/boosting/cuda/cuda_score_updater.cu;/home/sbj/Sandbox/LightGBM/src/boosting/gbdt.cpp;/home/sbj/Sandbox/LightGBM/src/boosting/gbdt_model_text.cpp;/home/sbj/Sandbox/LightGBM/src/boosting/gbdt_prediction.cpp;/home/sbj/Sandbox/LightGBM/src/boosting/prediction_early_stop.cpp;/home/sbj/Sandbox/LightGBM/src/boosting/sample_strategy.cpp;/home/sbj/Sandbox/LightGBM/src/cuda/cuda_algorithms.cu;/home/sbj/Sandbox/LightGBM/src/cuda/cuda_utils.cpp;/home/sbj/Sandbox/LightGBM/src/io/bin.cpp;/home/sbj/Sandbox/LightGBM/src/io/config.cpp;/home/sbj/Sandbox/LightGBM/src/io/config_auto.cpp;/home/sbj/Sandbox/LightGBM/src/io/cuda/cuda_column_data.cpp;/home/sbj/Sandbox/LightGBM/src/io/cuda/cuda_column_data.cu;/home/sbj/Sandbox/LightGBM/src/io/cuda/cuda_metadata.cpp;/home/sbj/Sandbox/LightGBM/src/io/cuda/cuda_row_data.cpp;/home/sbj/Sandbox/LightGBM/src/io/cuda/cuda_tree.cpp;/home/sbj/Sandbox/LightGBM/src/io/cuda/cuda_tree.cu;/home/sbj/Sandbox/LightGBM/src/io/dataset.cpp;/home/sbj/Sandbox/LightGBM/src/io/dataset_loader.cpp;/home/sbj/Sandbox/LightGBM/src/io/file_io.cpp;/home/sbj/Sandbox/LightGBM/src/io/json11.cpp;/home/sbj/Sandbox/LightGBM/src/io/metadata.cpp;/home/sbj/Sandbox/LightGBM/src/io/parser.cpp;/home/sbj/Sandbox/LightGBM/src/io/train_share_states.cpp;/home/sbj/Sandbox/LightGBM/src/io/tree.cpp;/home/sbj/Sandbox/LightGBM/src/metric/cuda/cuda_binary_metric.cpp;/home/sbj/Sandbox/LightGBM/src/metric/cuda/cuda_pointwise_metric.cpp;/home/sbj/Sandbox/LightGBM/src/metric/cuda/cuda_pointwise_metric.cu;/home/sbj/Sandbox/LightGBM/src/metric/cuda/cuda_regression_metric.cpp;/home/sbj/Sandbox/LightGBM/src/metric/dcg_calculator.cpp;/home/sbj/Sandbox/LightGBM/src/metric/metric.cpp;/home/sbj/Sandbox/LightGBM/src/network/linker_topo.cpp;/home/sbj/Sandbox/LightGBM/src/network/linkers_mpi.cpp;/home/sbj/Sandbox/LightGBM/src/network/linkers_socket.cpp;/home/sbj/Sandbox/LightGBM/src/network/network.cpp;/home/sbj/Sandbox/LightGBM/src/objective/cuda/cuda_binary_objective.cpp;/home/sbj/Sandbox/LightGBM/src/objective/cuda/cuda_binary_objective.cu;/home/sbj/Sandbox/LightGBM/src/objective/cuda/cuda_multiclass_objective.cpp;/home/sbj/Sandbox/LightGBM/src/objective/cuda/cuda_multiclass_objective.cu;/home/sbj/Sandbox/LightGBM/src/objective/cuda/cuda_rank_objective.cpp;/home/sbj/Sandbox/LightGBM/src/objective/cuda/cuda_rank_objective.cu;/home/sbj/Sandbox/LightGBM/src/objective/cuda/cuda_regression_objective.cpp;/home/sbj/Sandbox/LightGBM/src/objective/cuda/cuda_regression_objective.cu;/home/sbj/Sandbox/LightGBM/src/objective/objective_function.cpp;/home/sbj/Sandbox/LightGBM/src/treelearner/cuda/cuda_best_split_finder.cpp;/home/sbj/Sandbox/LightGBM/src/treelearner/cuda/cuda_best_split_finder.cu;/home/sbj/Sandbox/LightGBM/src/treelearner/cuda/cuda_data_partition.cpp;/home/sbj/Sandbox/LightGBM/src/treelearner/cuda/cuda_data_partition.cu;/home/sbj/Sandbox/LightGBM/src/treelearner/cuda/cuda_gradient_discretizer.cu;/home/sbj/Sandbox/LightGBM/src/treelearner/cuda/cuda_histogram_constructor.cpp;/home/sbj/Sandbox/LightGBM/src/treelearner/cuda/cuda_histogram_constructor.cu;/home/sbj/Sandbox/LightGBM/src/treelearner/cuda/cuda_leaf_splits.cpp;/home/sbj/Sandbox/LightGBM/src/treelearner/cuda/cuda_leaf_splits.cu;/home/sbj/Sandbox/LightGBM/src/treelearner/cuda/cuda_single_gpu_tree_learner.cpp;/home/sbj/Sandbox/LightGBM/src/treelearner/cuda/cuda_single_gpu_tree_learner.cu;/home/sbj/Sandbox/LightGBM/src/treelearner/data_parallel_tree_learner.cpp;/home/sbj/Sandbox/LightGBM/src/treelearner/feature_parallel_tree_learner.cpp;/home/sbj/Sandbox/LightGBM/src/treelearner/gpu_tree_learner.cpp;/home/sbj/Sandbox/LightGBM/src/treelearner/gradient_discretizer.cpp;/home/sbj/Sandbox/LightGBM/src/treelearner/linear_tree_learner.cpp;/home/sbj/Sandbox/LightGBM/src/treelearner/serial_tree_learner.cpp;/home/sbj/Sandbox/LightGBM/src/treelearner/tree_learner.cpp;/home/sbj/Sandbox/LightGBM/src/treelearner/voting_parallel_tree_learner.cpp;/home/sbj/Sandbox/LightGBM/src/utils/openmp_wrapper.cpp )
Environment info
LightGBM
version or commit hash: 5516533Command(s) you used to install LightGBM
LigtGBM was cloned from github.com
Additional Comments
The following should fix the code:
The text was updated successfully, but these errors were encountered: