modifié : include/ArrayTree/ArrayTreeBuilder.tpp
modifié : include/TreeStats.hpp modifié : src/Appli/Option.cpp modifié : src/TreeStats.cpp
This commit is contained in:
parent
9ac0b5b752
commit
952f2ddea5
@ -57,15 +57,22 @@ ArrayTreeBuilder<WeightT, PixelT>::buildTree (Tree &tree, WeightAttributes<Weigh
|
|||||||
default:
|
default:
|
||||||
cerr << "*** unknown tree type: " << treeType << endl;
|
cerr << "*** unknown tree type: " << treeType << endl;
|
||||||
}
|
}
|
||||||
globalTreeStats.addTime (buildTreeStats, duration_cast<duration<double> > (high_resolution_clock::now ()-start).count ());
|
|
||||||
globalTreeStats.addDim (treeType, leafCount, nodeCount-leafCount);
|
|
||||||
|
|
||||||
weightAttributes.setWeightBounds (tree);
|
auto startChildren = high_resolution_clock::now ();
|
||||||
leaders.free ();
|
|
||||||
newCompId = nullptr;
|
|
||||||
buildChildren ();
|
buildChildren ();
|
||||||
childCount = nullptr;
|
childCount = nullptr;
|
||||||
|
|
||||||
|
auto end = high_resolution_clock::now ();
|
||||||
|
|
||||||
|
globalTreeStats.addTime (buildTreeStats, duration_cast<duration<double> > (startChildren-start).count ());
|
||||||
|
globalTreeStats.addTime (buildChildrenStats, duration_cast<duration<double> > (end-start).count ());
|
||||||
|
globalTreeStats.addDim (treeType, leafCount, nodeCount-leafCount);
|
||||||
|
|
||||||
|
leaders.free ();
|
||||||
|
newCompId = nullptr;
|
||||||
|
weightAttributes.setWeightBounds (tree);
|
||||||
|
|
||||||
SMART_LOG (tree.printTree ());
|
SMART_LOG (tree.printTree ());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -102,6 +109,7 @@ ArrayTreeBuilder<WeightT, PixelT>::buildTree (Tree &tree, const WeightFunct &wei
|
|||||||
coreCount = tree.getCoreCount ();
|
coreCount = tree.getCoreCount ();
|
||||||
|
|
||||||
// buildParents
|
// buildParents
|
||||||
|
auto start = high_resolution_clock::now ();
|
||||||
vector<Edge<WeightT> > allEdges (graphWalker.edgeMaxCount ());
|
vector<Edge<WeightT> > allEdges (graphWalker.edgeMaxCount ());
|
||||||
vector<Rect> tiles;
|
vector<Rect> tiles;
|
||||||
vector<Rect> boundaries;
|
vector<Rect> boundaries;
|
||||||
@ -123,6 +131,7 @@ ArrayTreeBuilder<WeightT, PixelT>::buildTree (Tree &tree, const WeightFunct &wei
|
|||||||
tileEdges [i] = &allEdges[edgesMaxBounds[i]];
|
tileEdges [i] = &allEdges[edgesMaxBounds[i]];
|
||||||
compBases [i] = compTops [i] = vertexMaxBounds [i];
|
compBases [i] = compTops [i] = vertexMaxBounds [i];
|
||||||
}
|
}
|
||||||
|
auto startParent = high_resolution_clock::now ();
|
||||||
dealThreadRange (tileCount, coreCount, [this, &tileEdges, &weightFunct, &tiles, &compTops] (DimImg threadId) {
|
dealThreadRange (tileCount, coreCount, [this, &tileEdges, &weightFunct, &tiles, &compTops] (DimImg threadId) {
|
||||||
buildParents (tileEdges [threadId], weightFunct, tiles [threadId], compTops [threadId]);
|
buildParents (tileEdges [threadId], weightFunct, tiles [threadId], compTops [threadId]);
|
||||||
});
|
});
|
||||||
@ -133,6 +142,7 @@ ArrayTreeBuilder<WeightT, PixelT>::buildTree (Tree &tree, const WeightFunct &wei
|
|||||||
<< printMap (compWeights, size, 0) << endl << endl
|
<< printMap (compWeights, size, 0) << endl << endl
|
||||||
<< tree.printTree (2*leafCount-1));
|
<< tree.printTree (2*leafCount-1));
|
||||||
// merge sub-tree
|
// merge sub-tree
|
||||||
|
auto startMerge = high_resolution_clock::now ();
|
||||||
DimImg compCount = compTops [0];
|
DimImg compCount = compTops [0];
|
||||||
DimImg *topC = NULL;
|
DimImg *topC = NULL;
|
||||||
DimImg compBase = vertexMaxBounds[tileCount];
|
DimImg compBase = vertexMaxBounds[tileCount];
|
||||||
@ -180,6 +190,7 @@ ArrayTreeBuilder<WeightT, PixelT>::buildTree (Tree &tree, const WeightFunct &wei
|
|||||||
<< printMap (compWeights, size, 0) << endl << endl
|
<< printMap (compWeights, size, 0) << endl << endl
|
||||||
<< tree.printTree (2*leafCount-1));
|
<< tree.printTree (2*leafCount-1));
|
||||||
// compress
|
// compress
|
||||||
|
auto startIndex = high_resolution_clock::now ();
|
||||||
DimImg maxUsed = max (compTops[tileCount-1], topC != NULL ? *topC : 0);
|
DimImg maxUsed = max (compTops[tileCount-1], topC != NULL ? *topC : 0);
|
||||||
dealThreadFill_n (maxUsed, coreCount, newCompId, DimImg_MAX);
|
dealThreadFill_n (maxUsed, coreCount, newCompId, DimImg_MAX);
|
||||||
|
|
||||||
@ -190,6 +201,7 @@ ArrayTreeBuilder<WeightT, PixelT>::buildTree (Tree &tree, const WeightFunct &wei
|
|||||||
SMART_LOG ("updateNewId:" << endl
|
SMART_LOG ("updateNewId:" << endl
|
||||||
<< printMap (newCompId, size, 0) << endl << endl);
|
<< printMap (newCompId, size, 0) << endl << endl);
|
||||||
|
|
||||||
|
auto startCompress = high_resolution_clock::now ();
|
||||||
compress (maxUsed);
|
compress (maxUsed);
|
||||||
SMART_LOG ("compress:" << endl
|
SMART_LOG ("compress:" << endl
|
||||||
<< printMap (newCompId, size, 0) << endl << endl);
|
<< printMap (newCompId, size, 0) << endl << endl);
|
||||||
@ -207,6 +219,12 @@ ArrayTreeBuilder<WeightT, PixelT>::buildTree (Tree &tree, const WeightFunct &wei
|
|||||||
|
|
||||||
SMART_LOG ("compWeights:" << endl
|
SMART_LOG ("compWeights:" << endl
|
||||||
<< printMap (compWeights, size, 0) << endl << endl);
|
<< printMap (compWeights, size, 0) << endl << endl);
|
||||||
|
auto end = high_resolution_clock::now ();
|
||||||
|
globalTreeStats.addTime (buildSetupStats, duration_cast<duration<double> > (startParent-start).count ());
|
||||||
|
globalTreeStats.addTime (buildParentsStats, duration_cast<duration<double> > (startMerge-startParent).count ());
|
||||||
|
globalTreeStats.addTime (buildMergeStats, duration_cast<duration<double> > (startIndex-startMerge).count ());
|
||||||
|
globalTreeStats.addTime (buildIndexStats, duration_cast<duration<double> > (startCompress-startIndex).count ());
|
||||||
|
globalTreeStats.addTime (buildCompressStats, duration_cast<duration<double> > (end-startCompress).count ());
|
||||||
}
|
}
|
||||||
|
|
||||||
// ========================================
|
// ========================================
|
||||||
|
|||||||
@ -31,6 +31,13 @@ namespace otb {
|
|||||||
|
|
||||||
enum TimeType {
|
enum TimeType {
|
||||||
buildTreeStats,
|
buildTreeStats,
|
||||||
|
buildSetupStats,
|
||||||
|
buildParentsStats,
|
||||||
|
buildMergeStats,
|
||||||
|
buildIndexStats,
|
||||||
|
buildCompressStats,
|
||||||
|
buildChildrenStats,
|
||||||
|
setAPStats,
|
||||||
areaStats,
|
areaStats,
|
||||||
averageStats,
|
averageStats,
|
||||||
xyStats,
|
xyStats,
|
||||||
|
|||||||
@ -216,7 +216,8 @@ Option::parse (int argc, char** argv) {
|
|||||||
cout
|
cout
|
||||||
<< "Input:" << inputFileName << " " << orgSize << " (" << bandInputCount << " chanels of " << GDALGetDataTypeName (inputType) << ")" << endl
|
<< "Input:" << inputFileName << " " << orgSize << " (" << bandInputCount << " chanels of " << GDALGetDataTypeName (inputType) << ")" << endl
|
||||||
<< "Crop topLeft:" << topLeft << " size:" << size << " band:" << selectedBand << endl
|
<< "Crop topLeft:" << topLeft << " size:" << size << " band:" << selectedBand << endl
|
||||||
<< "Output :" << outputFileName << endl;
|
<< "Output:" << outputFileName << endl
|
||||||
|
<< "core count:" << coreCount << endl;
|
||||||
if (!selectedBand.empty () &&
|
if (!selectedBand.empty () &&
|
||||||
(selectedBand.first () < 0 ||
|
(selectedBand.first () < 0 ||
|
||||||
selectedBand.last () >= bandInputCount))
|
selectedBand.last () >= bandInputCount))
|
||||||
|
|||||||
@ -10,6 +10,13 @@ using namespace std;
|
|||||||
// ========================================
|
// ========================================
|
||||||
static string timeTypeLabels [TimeTypeCard] = {
|
static string timeTypeLabels [TimeTypeCard] = {
|
||||||
"build tree",
|
"build tree",
|
||||||
|
"build setup ",
|
||||||
|
"build parents ",
|
||||||
|
"build merge ",
|
||||||
|
"build index ",
|
||||||
|
"build compress ",
|
||||||
|
"build children ",
|
||||||
|
"set AP",
|
||||||
"area",
|
"area",
|
||||||
"average",
|
"average",
|
||||||
"xy",
|
"xy",
|
||||||
@ -114,7 +121,7 @@ TreeStats::CPrintTime::print (ostream &out) const {
|
|||||||
if (empty)
|
if (empty)
|
||||||
return out;
|
return out;
|
||||||
out << endl
|
out << endl
|
||||||
<< setw (11) << left << "Time" << "\t"
|
<< setw (16) << left << "Time" << "\t"
|
||||||
<< setw (15) << left << "Sum" << "\t"
|
<< setw (15) << left << "Sum" << "\t"
|
||||||
<< setw (3) << left << "Count" << "\t"
|
<< setw (3) << left << "Count" << "\t"
|
||||||
<< setw (15) << left << "Mean" << "\t"
|
<< setw (15) << left << "Mean" << "\t"
|
||||||
@ -123,7 +130,7 @@ TreeStats::CPrintTime::print (ostream &out) const {
|
|||||||
for (unsigned int i = 0; i < TimeTypeCard; ++i) {
|
for (unsigned int i = 0; i < TimeTypeCard; ++i) {
|
||||||
if (!ba::count (treeStats.timeStats[i]))
|
if (!ba::count (treeStats.timeStats[i]))
|
||||||
continue;
|
continue;
|
||||||
out << setw (11) << right << timeTypeLabels[i] << "\t"
|
out << setw (16) << right << timeTypeLabels[i] << "\t"
|
||||||
<< ns2string (ba::sum (treeStats.timeStats[i])) << "\t" << setw (3) << ba::count (treeStats.timeStats[i]) << "\t"
|
<< ns2string (ba::sum (treeStats.timeStats[i])) << "\t" << setw (3) << ba::count (treeStats.timeStats[i]) << "\t"
|
||||||
<< ns2string (ba::mean (treeStats.timeStats[i])) << "\t"
|
<< ns2string (ba::mean (treeStats.timeStats[i])) << "\t"
|
||||||
<< ns2string (ba::min (treeStats.timeStats[i])) << "\t"
|
<< ns2string (ba::min (treeStats.timeStats[i])) << "\t"
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user