@@ -276,29 +276,6 @@ TEST(HistUitl, DeviceSketchWeights) {
276276 }
277277}
278278
279- TEST (HistUtil, DeviceSketchBatches) {
280- auto ctx = MakeCUDACtx (0 );
281- int num_bins = 256 ;
282- int num_rows = 5000 ;
283- auto batch_sizes = {0 , 100 , 1500 , 6000 };
284- int num_columns = 5 ;
285- for (auto batch_size : batch_sizes) {
286- auto x = GenerateRandom (num_rows, num_columns);
287- auto dmat = GetDMatrixFromData (x, num_rows, num_columns);
288- auto cuts = DeviceSketch (&ctx, dmat.get (), num_bins, batch_size);
289- ValidateCuts (cuts, dmat.get (), num_bins);
290- }
291-
292- num_rows = 1000 ;
293- size_t batches = 16 ;
294- auto x = GenerateRandom (num_rows * batches, num_columns);
295- auto dmat = GetDMatrixFromData (x, num_rows * batches, num_columns);
296- auto cuts_with_batches = DeviceSketch (&ctx, dmat.get (), num_bins, num_rows);
297- auto cuts = DeviceSketch (&ctx, dmat.get (), num_bins, 0 );
298- ValidateCuts (cuts_with_batches, dmat.get (), num_bins);
299- ValidateCuts (cuts, dmat.get (), num_bins);
300- }
301-
302279TEST (HistUtil, DeviceSketchMultipleColumnsExternal) {
303280 auto ctx = MakeCUDACtx (0 );
304281 auto bin_sizes = {2 , 16 , 256 , 512 };
@@ -682,14 +659,13 @@ class DeviceSketchWithHessianTest
682659 }
683660
684661 void CheckReg (Context const * ctx, std::shared_ptr<DMatrix> p_fmat, bst_bin_t n_bins,
685- HostDeviceVector<float > const & hessian, std::vector<float > const & w,
686- std::size_t n_elements) const {
662+ HostDeviceVector<float > const & hessian, std::vector<float > const & w) const {
687663 auto const & h_hess = hessian.ConstHostVector ();
688664 auto & h_weight = p_fmat->Info ().weights_ .HostVector ();
689665 h_weight = w;
690666
691667 HistogramCuts cuts_hess =
692- DeviceSketchWithHessian (ctx, p_fmat.get (), n_bins, hessian.ConstDeviceSpan (), n_elements );
668+ DeviceSketchWithHessian (ctx, p_fmat.get (), n_bins, hessian.ConstDeviceSpan ());
693669
694670 // merge hessian
695671 ASSERT_EQ (h_weight.size (), h_hess.size ());
@@ -698,7 +674,7 @@ class DeviceSketchWithHessianTest
698674 }
699675 ValidateCuts (cuts_hess, p_fmat.get (), n_bins, kMaxWeightedNormalizedRankError );
700676
701- HistogramCuts cuts_wh = DeviceSketch (ctx, p_fmat.get (), n_bins, n_elements );
677+ HistogramCuts cuts_wh = DeviceSketch (ctx, p_fmat.get (), n_bins);
702678 ValidateCuts (cuts_wh, p_fmat.get (), n_bins, kMaxWeightedNormalizedRankError );
703679 ASSERT_EQ (cuts_hess.Values ().size (), cuts_wh.Values ().size ());
704680 for (std::size_t i = 0 ; i < cuts_hess.Values ().size (); ++i) {
@@ -711,8 +687,7 @@ class DeviceSketchWithHessianTest
711687 protected:
712688 Context ctx_ = MakeCUDACtx(0 );
713689
714- void TestLTR (Context const * ctx, bst_idx_t n_samples, bst_bin_t n_bins,
715- std::size_t n_elements) const {
690+ void TestLTR (Context const * ctx, bst_idx_t n_samples, bst_bin_t n_bins) const {
716691 auto x = GenerateRandom (n_samples, n_features_);
717692
718693 std::vector<bst_group_t > gptr;
@@ -730,7 +705,7 @@ class DeviceSketchWithHessianTest
730705 std::vector<float > w (n_groups_, 1 .0f );
731706 p_fmat->Info ().weights_ .HostVector () = w;
732707 HistogramCuts cuts_hess =
733- DeviceSketchWithHessian (ctx, p_fmat.get (), n_bins, hessian.ConstDeviceSpan (), n_elements );
708+ DeviceSketchWithHessian (ctx, p_fmat.get (), n_bins, hessian.ConstDeviceSpan ());
734709 // make validation easier by converting it into sample weight.
735710 p_fmat->Info ().weights_ .HostVector () = h_hess;
736711 p_fmat->Info ().group_ptr_ .clear ();
@@ -742,8 +717,7 @@ class DeviceSketchWithHessianTest
742717 // test with random group weight
743718 w = GenerateRandomWeights (n_groups_);
744719 p_fmat->Info ().weights_ .HostVector () = w;
745- cuts_hess =
746- DeviceSketchWithHessian (ctx, p_fmat.get (), n_bins, hessian.ConstDeviceSpan (), n_elements);
720+ cuts_hess = DeviceSketchWithHessian (ctx, p_fmat.get (), n_bins, hessian.ConstDeviceSpan ());
747721 // make validation easier by converting it into sample weight.
748722 p_fmat->Info ().weights_ .Resize (n_samples);
749723 for (std::size_t i = 0 ; i < h_hess.size (); ++i) {
@@ -760,23 +734,22 @@ class DeviceSketchWithHessianTest
760734 auto gidx = dh::SegmentId (Span{gptr.data (), gptr.size ()}, i);
761735 p_fmat->Info ().weights_ .HostVector ()[i] = w[gidx] * h_hess[i];
762736 }
763- auto cuts = DeviceSketch (ctx, p_fmat.get (), n_bins, n_elements );
737+ auto cuts = DeviceSketch (ctx, p_fmat.get (), n_bins);
764738 ValidateCuts (cuts, p_fmat.get (), n_bins, kMaxWeightedNormalizedRankError );
765739 ASSERT_EQ (cuts.Values ().size (), cuts_hess.Values ().size ());
766740 for (std::size_t i = 0 ; i < cuts.Values ().size (); ++i) {
767741 EXPECT_NEAR (cuts.Values ()[i], cuts_hess.Values ()[i], 1e-4f );
768742 }
769743 }
770744
771- void TestRegression (Context const * ctx, bst_idx_t n_samples, bst_bin_t n_bins,
772- std::size_t n_elements) const {
745+ void TestRegression (Context const * ctx, bst_idx_t n_samples, bst_bin_t n_bins) const {
773746 auto x = GenerateRandom (n_samples, n_features_);
774747 auto p_fmat = GetDMatrixFromData (x, n_samples, n_features_);
775748 std::vector<float > w = GenerateRandomWeights (n_samples);
776749
777750 auto hessian = this ->GenerateHessian (ctx, n_samples);
778751
779- this ->CheckReg (ctx, p_fmat, n_bins, hessian, w, n_elements );
752+ this ->CheckReg (ctx, p_fmat, n_bins, hessian, w);
780753 }
781754};
782755
@@ -799,11 +772,9 @@ TEST_P(DeviceSketchWithHessianTest, DeviceSketchWithHessian) {
799772 auto n_samples = std::get<1 >(param);
800773 auto n_bins = std::get<2 >(param);
801774 if (std::get<0 >(param)) {
802- this ->TestLTR (&ctx_, n_samples, n_bins, 0 );
803- this ->TestLTR (&ctx_, n_samples, n_bins, 512 );
775+ this ->TestLTR (&ctx_, n_samples, n_bins);
804776 } else {
805- this ->TestRegression (&ctx_, n_samples, n_bins, 0 );
806- this ->TestRegression (&ctx_, n_samples, n_bins, 512 );
777+ this ->TestRegression (&ctx_, n_samples, n_bins);
807778 }
808779}
809780
0 commit comments