Skip to content
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

Fix distributed dbscan with empty partial results #657

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 28 additions & 5 deletions cpp/daal/src/algorithms/dbscan/dbscan_dense_default_distr_impl.i
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,16 @@ Status DBSCANDistrStep3Kernel<algorithmFPType, method, cpu>::compute(const DataC

DAAL_OVERFLOW_CHECK_BY_MULTIPLICATION(size_t, totalNRows, sizeof(algorithmFPType));

if (totalNRows == 0)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's better to move this if() before the overflow check.

{
WriteRows<algorithmFPType, cpu> splitRows(ntSplit, 0, 1);
DAAL_CHECK_BLOCK_STATUS(splitRows);
algorithmFPType * const split = splitRows.get();
split[0] = 0;
split[1] = (algorithmFPType)(-1);
return Status();
}

TArray<algorithmFPType, cpu> splitColumnArray(totalNRows);
DAAL_CHECK_MALLOC(splitColumnArray.get());
algorithmFPType * const splitColumn = splitColumnArray.get();
Expand Down Expand Up @@ -235,15 +245,22 @@ Status DBSCANDistrStep4Kernel<algorithmFPType, method, cpu>::compute(const DataC

int result = 0;

size_t splitDim = -1;
size_t splitDim = -1;
size_t valuedPart = 0;
for (size_t part = 0; part < nBlocks; part++)
{
NumericTablePtr ntPartialSplit = NumericTable::cast((*dcPartialSplits)[part]);
ReadRows<algorithmFPType, cpu> partialSplitRows(ntPartialSplit.get(), 0, 1);
DAAL_CHECK_BLOCK_STATUS(partialSplitRows);
const algorithmFPType * const partialSplit = partialSplitRows.get();

partialSplitValues[part] = partialSplit[0];
if ((size_t)partialSplit[1] == -1)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider re-writing this if(). It has hard-to-understand comparison of unsigned size_t value to a signed const -1. I'd rewrite to something like:
const size_t noSplitDim = -1;
...
if ((size_t)partialSplit[1] == noSplitDim)

{
continue;
}

partialSplitValues[valuedPart] = partialSplit[0];
valuedPart++;

DAAL_ASSERT(partialSplit[1] >= 0)
if (part == 0)
Expand All @@ -256,7 +273,7 @@ Status DBSCANDistrStep4Kernel<algorithmFPType, method, cpu>::compute(const DataC
}
}

algorithmFPType splitValue = findKthStatistic<algorithmFPType, cpu>(partialSplitValues, nBlocks, nBlocks / 2);
algorithmFPType splitValue = findKthStatistic<algorithmFPType, cpu>(partialSplitValues, valuedPart, valuedPart / 2);

DAAL_OVERFLOW_CHECK_BY_MULTIPLICATION(size_t, nBlocks, sizeof(int));

Expand Down Expand Up @@ -779,7 +796,10 @@ Status DBSCANDistrStep6Kernel<algorithmFPType, method, cpu>::computeNoMemSave(co
NeighborhoodEngine<method, algorithmFPType, cpu> nHaloEngine(ntData.get(), ntHaloData.get(), ntHaloWeights.get(), epsilon, minkowskiPower);
DAAL_CHECK_STATUS_VAR(nHaloEngine.queryFull(haloNeighs.get()));

DAAL_CHECK_STATUS_VAR(ntClusterStructure->resize(nRows));
if (nRows)
{
DAAL_CHECK_STATUS_VAR(ntClusterStructure->resize(nRows))
}

WriteRows<int, cpu> clusterStructureRows(ntClusterStructure, 0, nRows);
if (nRows)
Expand Down Expand Up @@ -952,7 +972,10 @@ Status DBSCANDistrStep6Kernel<algorithmFPType, method, cpu>::computeMemSave(cons
NeighborhoodEngine<method, algorithmFPType, cpu> nEngine(ntData.get(), ntData.get(), ntWeights.get(), epsilon, minkowskiPower);
NeighborhoodEngine<method, algorithmFPType, cpu> nHaloEngine(ntData.get(), ntHaloData.get(), ntHaloWeights.get(), epsilon, minkowskiPower);

DAAL_CHECK_STATUS_VAR(ntClusterStructure->resize(nRows));
if (nRows)
{
DAAL_CHECK_STATUS_VAR(ntClusterStructure->resize(nRows))
}

WriteRows<int, cpu> clusterStructureRows(ntClusterStructure, 0, nRows);
if (nRows)
Expand Down
156 changes: 80 additions & 76 deletions cpp/daal/src/algorithms/dbscan/dbscan_distributed_input_types.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,21 +129,23 @@ services::Status DistributedInput<step2Local>::check(const daal::algorithms::Par
const size_t nBlocks = dcPartialData->size();
DAAL_CHECK_EX(nBlocks > 0, ErrorIncorrectNumberOfInputNumericTables, ArgumentName, partialDataStr());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would suggest to handle case, when nBlocks == 0 in the same manner as the empty partialData tables.


size_t nFeatures = 0;
for (size_t i = 0; i < nBlocks; i++)
if (NumericTable::cast((*dcPartialData)[0])->getNumberOfRows() == 0)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

First, this check is incorrect. It should be getNumberOfRows() != 0 to make sense.
Second, it is reasonable to put this check inside loop and just skip tables with 0 rows.

{
DAAL_CHECK_EX((*dcPartialData)[i], ErrorNullNumericTable, ArgumentName, partialDataStr());
NumericTablePtr ntPartialData = NumericTable::cast((*dcPartialData)[i]);
DAAL_CHECK_EX(ntPartialData, ErrorIncorrectElementInNumericTableCollection, ArgumentName, partialDataStr());

if (i == 0)
size_t nFeatures = 0;
for (size_t i = 0; i < nBlocks; i++)
{
nFeatures = ntPartialData->getNumberOfColumns();
}
DAAL_CHECK_EX((*dcPartialData)[i], ErrorNullNumericTable, ArgumentName, partialDataStr());
NumericTablePtr ntPartialData = NumericTable::cast((*dcPartialData)[i]);
DAAL_CHECK_EX(ntPartialData, ErrorIncorrectElementInNumericTableCollection, ArgumentName, partialDataStr());

DAAL_CHECK_STATUS_VAR(checkNumericTable(ntPartialData.get(), partialDataStr(), 0, 0, nFeatures, 0));
}
if (i == 0)
{
nFeatures = ntPartialData->getNumberOfColumns();
}

DAAL_CHECK_STATUS_VAR(checkNumericTable(ntPartialData.get(), partialDataStr(), 0, 0, nFeatures, 0));
}
}
return services::Status();
}

Expand Down Expand Up @@ -249,19 +251,17 @@ services::Status DistributedInput<step3Local>::check(const daal::algorithms::Par
const size_t nDataBlocks = dcPartialData->size();
DAAL_CHECK_EX(nDataBlocks > 0, ErrorIncorrectNumberOfInputNumericTables, ArgumentName, partialDataStr());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would suggest to handle case, when nBlocks == 0 in the same manner as the empty partialData tables.


size_t nFeatures = 0;
for (size_t i = 0; i < nDataBlocks; i++)
size_t nFeatures = NumericTable::cast((*dcPartialData)[0])->getNumberOfColumns();
if (NumericTable::cast((*dcPartialData)[0])->getNumberOfRows() != 0)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is reasonable to put this check inside loop and just skip tables with 0 rows.

{
DAAL_CHECK_EX((*dcPartialData)[i], ErrorNullNumericTable, ArgumentName, partialDataStr());
NumericTablePtr ntPartialData = NumericTable::cast((*dcPartialData)[i]);
DAAL_CHECK_EX(ntPartialData, ErrorIncorrectElementInNumericTableCollection, ArgumentName, partialDataStr());

if (i == 0)
for (size_t i = 0; i < nDataBlocks; i++)
{
nFeatures = ntPartialData->getNumberOfColumns();
}
DAAL_CHECK_EX((*dcPartialData)[i], ErrorNullNumericTable, ArgumentName, partialDataStr());
NumericTablePtr ntPartialData = NumericTable::cast((*dcPartialData)[i]);
DAAL_CHECK_EX(ntPartialData, ErrorIncorrectElementInNumericTableCollection, ArgumentName, partialDataStr());

DAAL_CHECK_STATUS_VAR(checkNumericTable(ntPartialData.get(), partialDataStr(), 0, 0, nFeatures, 0));
DAAL_CHECK_STATUS_VAR(checkNumericTable(ntPartialData.get(), partialDataStr(), 0, 0, nFeatures, 0));
}
}

DataCollectionPtr dcBoundindBoxes = get(step3PartialBoundingBoxes);
Expand Down Expand Up @@ -388,24 +388,24 @@ services::Status DistributedInput<step4Local>::check(const daal::algorithms::Par

const int unexpectedLayouts = (int)packed_mask;

size_t nFeatures = 0;
for (size_t i = 0; i < nDataBlocks; i++)
size_t nFeatures = NumericTable::cast((*dcPartialData)[0])->getNumberOfColumns();
if (NumericTable::cast((*dcPartialData)[0])->getNumberOfRows() != 0)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it is reasonable to put this check inside loop and just skip tables with 0 rows.

{
DAAL_CHECK_EX((*dcPartialData)[i], ErrorNullNumericTable, ArgumentName, partialDataStr());
NumericTablePtr ntPartialData = NumericTable::cast((*dcPartialData)[i]);
DAAL_CHECK_EX(ntPartialData, ErrorIncorrectElementInNumericTableCollection, ArgumentName, partialDataStr());
if (i == 0)
for (size_t i = 0; i < nDataBlocks; i++)
{
nFeatures = ntPartialData->getNumberOfColumns();
}
DAAL_CHECK_STATUS_VAR(checkNumericTable(ntPartialData.get(), partialDataStr(), 0, 0, nFeatures, 0));
DAAL_CHECK_EX((*dcPartialData)[i], ErrorNullNumericTable, ArgumentName, partialDataStr());
NumericTablePtr ntPartialData = NumericTable::cast((*dcPartialData)[i]);
DAAL_CHECK_EX(ntPartialData, ErrorIncorrectElementInNumericTableCollection, ArgumentName, partialDataStr());

const size_t nRows = ntPartialData->getNumberOfRows();
DAAL_CHECK_STATUS_VAR(checkNumericTable(ntPartialData.get(), partialDataStr(), 0, 0, nFeatures, 0));

DAAL_CHECK_EX((*dcPartialOrders)[i], ErrorNullNumericTable, ArgumentName, step4PartialOrdersStr());
NumericTablePtr ntPartialOrder = NumericTable::cast((*dcPartialOrders)[i]);
DAAL_CHECK_EX(ntPartialOrder, ErrorIncorrectElementInNumericTableCollection, ArgumentName, step4PartialOrdersStr());
DAAL_CHECK_STATUS_VAR(checkNumericTable(ntPartialOrder.get(), step4PartialOrdersStr(), unexpectedLayouts, 0, 2, nRows));
const size_t nRows = ntPartialData->getNumberOfRows();

DAAL_CHECK_EX((*dcPartialOrders)[i], ErrorNullNumericTable, ArgumentName, step4PartialOrdersStr());
NumericTablePtr ntPartialOrder = NumericTable::cast((*dcPartialOrders)[i]);
DAAL_CHECK_EX(ntPartialOrder, ErrorIncorrectElementInNumericTableCollection, ArgumentName, step4PartialOrdersStr());
DAAL_CHECK_STATUS_VAR(checkNumericTable(ntPartialOrder.get(), step4PartialOrdersStr(), unexpectedLayouts, 0, 2, nRows));
}
}

DataCollectionPtr dcSplits = get(step4PartialSplits);
Expand Down Expand Up @@ -526,19 +526,17 @@ services::Status DistributedInput<step5Local>::check(const daal::algorithms::Par
const size_t nDataBlocks = dcPartialData->size();
DAAL_CHECK_EX(nDataBlocks > 0, ErrorIncorrectNumberOfInputNumericTables, ArgumentName, partialDataStr());

size_t nFeatures = 0;
for (size_t i = 0; i < nDataBlocks; i++)
size_t nFeatures = NumericTable::cast((*dcPartialData)[0])->getNumberOfColumns();
if (NumericTable::cast((*dcPartialData)[0])->getNumberOfRows() != 0)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it is reasonable to put this check inside loop and just skip tables with 0 rows.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

agree here

{
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This piece of code duplicates the pieces at lines 132, 256, 660. Please consider removing those duplicates.

DAAL_CHECK_EX((*dcPartialData)[i], ErrorNullNumericTable, ArgumentName, partialDataStr());
NumericTablePtr ntPartialData = NumericTable::cast((*dcPartialData)[i]);
DAAL_CHECK_EX(ntPartialData, ErrorIncorrectElementInNumericTableCollection, ArgumentName, partialDataStr());

if (i == 0)
for (size_t i = 0; i < nDataBlocks; i++)
{
nFeatures = ntPartialData->getNumberOfColumns();
}
DAAL_CHECK_EX((*dcPartialData)[i], ErrorNullNumericTable, ArgumentName, partialDataStr());
NumericTablePtr ntPartialData = NumericTable::cast((*dcPartialData)[i]);
DAAL_CHECK_EX(ntPartialData, ErrorIncorrectElementInNumericTableCollection, ArgumentName, partialDataStr());

DAAL_CHECK_STATUS_VAR(checkNumericTable(ntPartialData.get(), partialDataStr(), 0, 0, nFeatures, 0));
DAAL_CHECK_STATUS_VAR(checkNumericTable(ntPartialData.get(), partialDataStr(), 0, 0, nFeatures, 0));
}
}

DataCollectionPtr dcBoundindBoxes = get(step5PartialBoundingBoxes);
Expand Down Expand Up @@ -659,19 +657,17 @@ services::Status DistributedInput<step6Local>::check(const daal::algorithms::Par
const size_t nDataBlocks = dcPartialData->size();
DAAL_CHECK_EX(nDataBlocks > 0, ErrorIncorrectNumberOfInputNumericTables, ArgumentName, partialDataStr());

size_t nFeatures = 0;
for (size_t i = 0; i < nDataBlocks; i++)
size_t nFeatures = NumericTable::cast((*dcPartialData)[0])->getNumberOfColumns();
if (NumericTable::cast((*dcPartialData)[0])->getNumberOfRows() != 0)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it is reasonable to put this check inside loop and just skip tables with 0 rows.

{
DAAL_CHECK_EX((*dcPartialData)[i], ErrorNullNumericTable, ArgumentName, partialDataStr());
NumericTablePtr ntPartialData = NumericTable::cast((*dcPartialData)[i]);
DAAL_CHECK_EX(ntPartialData, ErrorIncorrectElementInNumericTableCollection, ArgumentName, partialDataStr());

if (i == 0)
for (size_t i = 0; i < nDataBlocks; i++)
{
nFeatures = ntPartialData->getNumberOfColumns();
}
DAAL_CHECK_EX((*dcPartialData)[i], ErrorNullNumericTable, ArgumentName, partialDataStr());
NumericTablePtr ntPartialData = NumericTable::cast((*dcPartialData)[i]);
DAAL_CHECK_EX(ntPartialData, ErrorIncorrectElementInNumericTableCollection, ArgumentName, partialDataStr());

DAAL_CHECK_STATUS_VAR(checkNumericTable(ntPartialData.get(), partialDataStr(), 0, 0, nFeatures, 0));
DAAL_CHECK_STATUS_VAR(checkNumericTable(ntPartialData.get(), partialDataStr(), 0, 0, nFeatures, 0));
}
}

DataCollectionPtr dcHaloData = get(haloData);
Expand Down Expand Up @@ -853,10 +849,12 @@ services::Status DistributedInput<step8Local>::check(const daal::algorithms::Par

{
NumericTablePtr ntClusterStructure = get(step8InputClusterStructure);
DAAL_CHECK_EX(ntClusterStructure, ErrorNullNumericTable, ArgumentName, step8InputClusterStructureStr());

int unexpectedLayouts = (int)packed_mask;
DAAL_CHECK_STATUS_VAR(checkNumericTable(ntClusterStructure.get(), step8InputClusterStructureStr(), unexpectedLayouts, 0, 4, 0));
if (ntClusterStructure->getNumberOfRows() != 0)
{
int unexpectedLayouts = (int)packed_mask;
DAAL_CHECK_STATUS_VAR(checkNumericTable(ntClusterStructure.get(), step8InputClusterStructureStr(), unexpectedLayouts, 0, 4, 0));
}
}

{
Expand Down Expand Up @@ -990,10 +988,11 @@ services::Status DistributedInput<step10Local>::check(const daal::algorithms::Pa

{
NumericTablePtr ntClusterStructure = get(step10InputClusterStructure);
DAAL_CHECK_EX(ntClusterStructure, ErrorNullNumericTable, ArgumentName, step10InputClusterStructureStr());

int unexpectedLayouts = (int)packed_mask;
DAAL_CHECK_STATUS_VAR(checkNumericTable(ntClusterStructure.get(), step10InputClusterStructureStr(), unexpectedLayouts, 0, 4, 0));
if (ntClusterStructure->getNumberOfRows() != 0)
{
int unexpectedLayouts = (int)packed_mask;
DAAL_CHECK_STATUS_VAR(checkNumericTable(ntClusterStructure.get(), step10InputClusterStructureStr(), unexpectedLayouts, 0, 4, 0));
}
}

{
Expand Down Expand Up @@ -1084,10 +1083,11 @@ services::Status DistributedInput<step11Local>::check(const daal::algorithms::Pa

{
NumericTablePtr ntClusterStructure = get(step11InputClusterStructure);
DAAL_CHECK_EX(ntClusterStructure, ErrorNullNumericTable, ArgumentName, step11InputClusterStructureStr());

int unexpectedLayouts = (int)packed_mask;
DAAL_CHECK_STATUS_VAR(checkNumericTable(ntClusterStructure.get(), step11InputClusterStructureStr(), unexpectedLayouts, 0, 4, 0));
if (ntClusterStructure->getNumberOfRows() != 0)
{
int unexpectedLayouts = (int)packed_mask;
DAAL_CHECK_STATUS_VAR(checkNumericTable(ntClusterStructure.get(), step11InputClusterStructureStr(), unexpectedLayouts, 0, 4, 0));
}
}

DataCollectionPtr dcQueries = get(step11PartialQueries);
Expand Down Expand Up @@ -1185,10 +1185,11 @@ services::Status DistributedInput<step12Local>::check(const daal::algorithms::Pa

{
NumericTablePtr ntClusterStructure = get(step12InputClusterStructure);
DAAL_CHECK_EX(ntClusterStructure, ErrorNullNumericTable, ArgumentName, step12InputClusterStructureStr());

int unexpectedLayouts = (int)packed_mask;
DAAL_CHECK_STATUS_VAR(checkNumericTable(ntClusterStructure.get(), step12InputClusterStructureStr(), unexpectedLayouts, 0, 4, 0));
if (ntClusterStructure->getNumberOfRows() != 0)
{
int unexpectedLayouts = (int)packed_mask;
DAAL_CHECK_STATUS_VAR(checkNumericTable(ntClusterStructure.get(), step12InputClusterStructureStr(), unexpectedLayouts, 0, 4, 0));
}
}

DataCollectionPtr dcOrders = get(step12PartialOrders);
Expand All @@ -1197,14 +1198,17 @@ services::Status DistributedInput<step12Local>::check(const daal::algorithms::Pa
const size_t nQueriesBlocks = dcOrders->size();
DAAL_CHECK_EX(nQueriesBlocks > 0, ErrorIncorrectNumberOfInputNumericTables, ArgumentName, step12PartialOrdersStr());

for (size_t i = 0; i < nQueriesBlocks; i++)
if (NumericTable::cast((*dcOrders)[0])->getNumberOfRows() != 0)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it is reasonable to put this check inside loop and just skip tables with 0 rows.

{
DAAL_CHECK_EX((*dcOrders)[i], ErrorNullNumericTable, ArgumentName, step12PartialOrdersStr());
NumericTablePtr ntOrders = NumericTable::cast((*dcOrders)[i]);
DAAL_CHECK_EX(ntOrders, ErrorIncorrectElementInNumericTableCollection, ArgumentName, step12PartialOrdersStr());
for (size_t i = 0; i < nQueriesBlocks; i++)
{
DAAL_CHECK_EX((*dcOrders)[i], ErrorNullNumericTable, ArgumentName, step12PartialOrdersStr());
NumericTablePtr ntOrders = NumericTable::cast((*dcOrders)[i]);
DAAL_CHECK_EX(ntOrders, ErrorIncorrectElementInNumericTableCollection, ArgumentName, step12PartialOrdersStr());

int unexpectedLayouts = (int)packed_mask;
DAAL_CHECK_STATUS_VAR(checkNumericTable(ntOrders.get(), step12PartialOrdersStr(), unexpectedLayouts, 0, 2, 0));
int unexpectedLayouts = (int)packed_mask;
DAAL_CHECK_STATUS_VAR(checkNumericTable(ntOrders.get(), step12PartialOrdersStr(), unexpectedLayouts, 0, 2, 0));
}
}

return services::Status();
Expand Down
36 changes: 32 additions & 4 deletions cpp/daal/src/algorithms/dbscan/dbscan_partial_result.h
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,14 @@ DAAL_EXPORT services::Status DistributedPartialResultStep6::allocate(const daal:

services::Status status;

set(step6ClusterStructure, HomogenNumericTable<int>::create(4, nRows, NumericTable::doAllocate, &status));
if (nRows != 0)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This if() statement looks meaningless to me. Why not revert to just
set(step6ClusterStructure, HomogenNumericTable::create(4, nRows, NumericTable::doAllocate, &status));
?

The same comment for other similar ifs in step8, step10 and step11.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the issue is that creating table with 0 rows and doAllocate flag leads to error raised.

{
set(step6ClusterStructure, HomogenNumericTable<int>::create(4, nRows, NumericTable::doAllocate, &status));
}
else
{
set(step6ClusterStructure, HomogenNumericTable<int>::create(4, 0, NumericTable::notAllocate, &status));
}
set(step6FinishedFlag, HomogenNumericTable<int>::create(1, 1, NumericTable::doAllocate, &status));
set(step6NClusters, HomogenNumericTable<int>::create(1, 1, NumericTable::doAllocate, &status));

Expand Down Expand Up @@ -229,7 +236,14 @@ DAAL_EXPORT services::Status DistributedPartialResultStep8::allocate(const daal:

services::Status status;

set(step8ClusterStructure, HomogenNumericTable<int>::create(4, nRows, NumericTable::doAllocate, &status));
if (nRows != 0)
{
set(step8ClusterStructure, HomogenNumericTable<int>::create(4, nRows, NumericTable::doAllocate, &status));
}
else
{
set(step8ClusterStructure, HomogenNumericTable<int>::create(4, 0, NumericTable::notAllocate, &status));
}
set(step8FinishedFlag, HomogenNumericTable<int>::create(1, 1, NumericTable::doAllocate, &status));
set(step8NClusters, HomogenNumericTable<int>::create(1, 1, NumericTable::doAllocate, &status));

Expand Down Expand Up @@ -307,7 +321,14 @@ DAAL_EXPORT services::Status DistributedPartialResultStep10::allocate(const daal

services::Status status;

set(step10ClusterStructure, HomogenNumericTable<int>::create(4, nRows, NumericTable::doAllocate, &status));
if (nRows != 0)
{
set(step10ClusterStructure, HomogenNumericTable<int>::create(4, nRows, NumericTable::doAllocate, &status));
}
else
{
set(step10ClusterStructure, HomogenNumericTable<int>::create(4, 0, NumericTable::notAllocate, &status));
}
set(step10FinishedFlag, HomogenNumericTable<int>::create(1, 1, NumericTable::doAllocate, &status));

DataCollectionPtr dcQueries(new DataCollection(nBlocks));
Expand Down Expand Up @@ -341,7 +362,14 @@ DAAL_EXPORT services::Status DistributedPartialResultStep11::allocate(const daal

services::Status status;

set(step11ClusterStructure, HomogenNumericTable<int>::create(4, nRows, NumericTable::doAllocate, &status));
if (nRows != 0)
{
set(step11ClusterStructure, HomogenNumericTable<int>::create(4, nRows, NumericTable::doAllocate, &status));
}
else
{
set(step11ClusterStructure, HomogenNumericTable<int>::create(4, 0, NumericTable::notAllocate, &status));
}
set(step11FinishedFlag, HomogenNumericTable<int>::create(1, 1, NumericTable::doAllocate, &status));

DataCollectionPtr dcQueries(new DataCollection(nBlocks));
Expand Down
Loading