| 741 | } |
| 742 | |
| 743 | void TestColumnSplitWithArgs(std::string const& tree_method, bool use_gpu, Args const& args, |
| 744 | bool federated) { |
| 745 | auto p_fmat = MakeFmatForObjTest("", 10, 10, 0); |
| 746 | std::string device = use_gpu ? "cuda:0" : "cpu"; |
| 747 | auto model = GetModelWithArgs(p_fmat, tree_method, device, args); |
| 748 | |
| 749 | auto world_size{3}; |
| 750 | if (use_gpu) { |
| 751 | world_size = curt::AllVisibleGPUs(); |
| 752 | // Simulate MPU on a single GPU. Federated doesn't use nccl, can run multiple |
| 753 | // instances on the same GPU. |
| 754 | if (world_size == 1 && federated) { |
| 755 | world_size = 3; |
| 756 | } |
| 757 | } |
| 758 | if (federated) { |
| 759 | #if defined(XGBOOST_USE_FEDERATED) |
| 760 | collective::TestFederatedGlobal( |
| 761 | world_size, [&] { VerifyColumnSplitWithArgs(tree_method, use_gpu, args, model); }); |
| 762 | #else |
| 763 | GTEST_SKIP_("Not compiled with federated learning."); |
| 764 | #endif // defined(XGBOOST_USE_FEDERATED) |
| 765 | } else { |
| 766 | #if !defined(XGBOOST_USE_NCCL) |
| 767 | if (use_gpu) { |
| 768 | GTEST_SKIP_("Not compiled with NCCL."); |
| 769 | return; |
| 770 | } |
| 771 | #endif // defined(XGBOOST_USE_NCCL) |
| 772 | collective::TestDistributedGlobal( |
| 773 | world_size, [&] { VerifyColumnSplitWithArgs(tree_method, use_gpu, args, model); }); |
| 774 | } |
| 775 | } |
| 776 | |
| 777 | class ColumnSplitTrainingTest |
| 778 | : public ::testing::TestWithParam<std::tuple<std::string, bool, bool>> { |
no test coverage detected