-
Notifications
You must be signed in to change notification settings - Fork 217
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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) | ||
{ | ||
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(); | ||
|
@@ -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) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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: |
||
{ | ||
continue; | ||
} | ||
|
||
partialSplitValues[valuedPart] = partialSplit[0]; | ||
valuedPart++; | ||
|
||
DAAL_ASSERT(partialSplit[1] >= 0) | ||
if (part == 0) | ||
|
@@ -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)); | ||
|
||
|
@@ -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) | ||
|
@@ -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) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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()); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would suggest to handle case, when |
||
|
||
size_t nFeatures = 0; | ||
for (size_t i = 0; i < nBlocks; i++) | ||
if (NumericTable::cast((*dcPartialData)[0])->getNumberOfRows() == 0) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. First, this check is incorrect. It should be |
||
{ | ||
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(); | ||
} | ||
|
||
|
@@ -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()); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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); | ||
|
@@ -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) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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); | ||
|
@@ -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) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. agree here |
||
{ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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); | ||
|
@@ -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) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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); | ||
|
@@ -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)); | ||
} | ||
} | ||
|
||
{ | ||
|
@@ -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)); | ||
} | ||
} | ||
|
||
{ | ||
|
@@ -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); | ||
|
@@ -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); | ||
|
@@ -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) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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(); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This if() statement looks meaningless to me. Why not revert to just The same comment for other similar ifs in step8, step10 and step11. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think the issue is that creating table with |
||
{ | ||
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)); | ||
|
||
|
@@ -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)); | ||
|
||
|
@@ -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)); | ||
|
@@ -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)); | ||
|
There was a problem hiding this comment.
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.