MCPcopy Create free account
hub / github.com/catboost/catboost / Y_UNIT_TEST

Function Y_UNIT_TEST

catboost/cuda/gpu_data/ut/test_uniform_binarization.cpp:20–57  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

18
19Y_UNIT_TEST_SUITE(TGridBuilderPerftest) {
20 Y_UNIT_TEST(TestUniformBuilder) {
21 TSetLogging inThisScope(ELoggingLevel::Debug);
22 auto stopCudaManagerGuard = StartCudaManager();
23 {
24 ui64 tries = 20;
25 TRandom rand(0);
26 TCudaProfiler& profiler = NCudaLib::GetCudaManager().GetProfiler();
27 SetDefaultProfileMode(EProfileMode::ImplicitLabelSync);
28
29 NCatboostOptions::TBinarizationOptions binarizationDescription;
30 binarizationDescription.BorderCount = 64;
31 binarizationDescription.BorderSelectionType = EBorderSelectionType::Uniform;
32 TCudaStream stream = GetStreamsProvider().RequestStream();
33 for (ui32 size = 100; size < 1000000001; size *= 10) {
34 TVector<float> vecCpu;
35 for (ui64 i = 0; i < size; ++i) {
36 vecCpu.push_back(abs(rand.NextUniform()) + 0.01);
37 }
38
39 auto mapping = TSingleMapping(0, size);
40 auto resultMapping = TSingleMapping(0, binarizationDescription.BorderCount + 1);
41 auto cudaVec = TSingleBuffer<float>::Create(mapping);
42 auto result = TSingleBuffer<float>::Create(resultMapping);
43 cudaVec.Write(vecCpu);
44 for (ui32 k = 0; k < tries; ++k) {
45 auto guard = profiler.Profile(TStringBuilder() << "Calculate Uniform grid for #" << size << " elements");
46 NKernel::ComputeUniformBorders(
47 cudaVec.At(0).Get(),
48 cudaVec.At(0).Size(),
49 result.At(0).Get(),
50 binarizationDescription.BorderCount,
51 stream
52 );
53 stream.Synchronize();
54 }
55 }
56 }
57 }
58}

Callers

nothing calls this directly

Calls 15

StartCudaManagerFunction · 0.85
SetDefaultProfileModeFunction · 0.85
NextUniformMethod · 0.80
absFunction · 0.50
TSingleMappingClass · 0.50
CreateFunction · 0.50
TStringBuilderClass · 0.50
RequestStreamMethod · 0.45
push_backMethod · 0.45
WriteMethod · 0.45
ProfileMethod · 0.45
GetMethod · 0.45

Tested by

no test coverage detected