MCPcopy Create free account
hub / github.com/antmachineintelligence/mtgbmcode / LGBM_DatasetPushRowsByCSR

Function LGBM_DatasetPushRowsByCSR

src/c_api.cpp:563–592  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

561}
562
563int LGBM_DatasetPushRowsByCSR(DatasetHandle dataset,
564 const void* indptr,
565 int indptr_type,
566 const int32_t* indices,
567 const void* data,
568 int data_type,
569 int64_t nindptr,
570 int64_t nelem,
571 int64_t,
572 int64_t start_row) {
573 API_BEGIN();
574 auto p_dataset = reinterpret_cast<Dataset*>(dataset);
575 auto get_row_fun = RowFunctionFromCSR(indptr, indptr_type, indices, data, data_type, nindptr, nelem);
576 int32_t nrow = static_cast<int32_t>(nindptr - 1);
577 OMP_INIT_EX();
578 #pragma omp parallel for schedule(static)
579 for (int i = 0; i < nrow; ++i) {
580 OMP_LOOP_EX_BEGIN();
581 const int tid = omp_get_thread_num();
582 auto one_row = get_row_fun(i);
583 p_dataset->PushOneRow(tid,
584 static_cast<data_size_t>(start_row + i), one_row);
585 OMP_LOOP_EX_END();
586 }
587 OMP_THROW_EX();
588 if (start_row + nrow == static_cast<int64_t>(p_dataset->num_data())) {
589 p_dataset->FinishLoad();
590 }
591 API_END();
592}
593
594int LGBM_DatasetCreateFromMat(const void* data,
595 int data_type,

Callers

nothing calls this directly

Calls 5

RowFunctionFromCSRFunction · 0.70
omp_get_thread_numFunction · 0.50
PushOneRowMethod · 0.45
num_dataMethod · 0.45
FinishLoadMethod · 0.45

Tested by

no test coverage detected