changed: reduce verbosity of multithreading group output for 2D LR splines

This commit is contained in:
Arne Morten Kvarving 2020-04-30 15:43:36 +02:00
parent a51f7a65ff
commit ab8f5a38f2
5 changed files with 41 additions and 0 deletions

View File

@ -468,3 +468,28 @@ bool ASMLRSpline::checkThreadGroups (const IntMat& groups,
return ok;
}
void ASMLRSpline::analyzeThreadGroups(const IntMat& groups)
{
size_t min = std::numeric_limits<size_t>::max() - 1;
size_t max = 0;
std::vector<size_t> groupSizes;
double avg = 0;
for (const auto& group : groups) {
min = std::min(group.size(), min);
max = std::max(group.size(), max);
groupSizes.push_back(group.size());
avg += group.size();
}
avg /= groups.size();
size_t half = groupSizes.size() / 2;
std::nth_element(groupSizes.begin(), groupSizes.begin() + half, groupSizes.end());
IFEM::cout << "\n Elements are divided in " << groups.size() << " colors "
<< "(min = " << min
<< ", max = " << max
<< ", avg = " << avg
<< ", med = " << groupSizes[half]
<< ").\n";
}

View File

@ -189,6 +189,10 @@ protected:
const std::vector<const LR::LRSpline*> bases,
const LR::LRSpline* threadBasis);
//! \brief Analyze and print thread group statistics.
//! \param groups The generated thread groups
static void analyzeThreadGroups(const IntMat& groups);
LR::LRSpline* geo; //!< Pointer to the actual spline geometry object
};

View File

@ -2604,10 +2604,14 @@ void ASMu2D::generateThreadGroups (const Integrand& integrand, bool silence,
if (silence || threadGroups[0].size() < 2) return;
std::cout <<"\nMultiple threads are utilized during element assembly.";
#ifdef SP_DEBUG
for (size_t i = 0; i < threadGroups[0].size(); i++)
std::cout <<"\n Color "<< i+1 <<": "
<< threadGroups[0][i].size() <<" elements";
std::cout << std::endl;
#else
this->analyzeThreadGroups(threadGroups[0]);
#endif
}

View File

@ -1102,9 +1102,13 @@ void ASMu2Dmx::generateThreadGroups (const Integrand& integrand, bool silence,
this->checkThreadGroups(threadGroups[0], bases, threadBasis);
std::cout <<"\nMultiple threads are utilized during element assembly.";
#ifdef SP_DEBUG
for (size_t i = 0; i < threadGroups[0].size(); i++)
std::cout <<"\n Color "<< i+1 <<": "
<< threadGroups[0][i].size() <<" elements";
#else
this->analyzeThreadGroups(threadGroups[0]);
#endif
}

View File

@ -1969,9 +1969,13 @@ void ASMu3D::generateThreadGroups (const Integrand& integrand, bool silence,
if (silence || threadGroups[0].size() < 2) return;
std::cout <<"\nMultiple threads are utilized during element assembly.";
#if SP_DEBUG
for (size_t i = 0; i < threadGroups[0].size(); i++)
std::cout <<"\n Color "<< i+1 <<": "
<< threadGroups[0][i].size() <<" elements";
#else
this->analyzeThreadGroups(threadGroups[0]);
#endif
}