Commit ca6e1c13 authored by kraus's avatar kraus
Browse files

fix problem with parallel computation of statistics in temporal monitor

parent bb6256d6
......@@ -130,14 +130,16 @@ bool Monitor::applyToReferenceParticle(const Vector_t &R,
if (type_m == CollectionType::TEMPORAL) {
driftToCorrectPositionAndSave(R, P);
auto stats = lossDs_m->computeStatistics(1);
statFileEntries_sm.insert(std::make_pair(stats.begin()->spos_m, *stats.begin()));
OpalData::OpenMode openMode;
if (numPassages_m > 0) {
openMode = OpalData::OpenMode::APPEND;
} else {
openMode = OpalData::getInstance()->getOpenMode();
if (!stats.empty()) {
statFileEntries_sm.insert(std::make_pair(stats.begin()->spos_m, *stats.begin()));
OpalData::OpenMode openMode;
if (numPassages_m > 0) {
openMode = OpalData::OpenMode::APPEND;
} else {
openMode = OpalData::getInstance()->getOpenMode();
}
lossDs_m->save(1, openMode);
}
lossDs_m->save(1, openMode);
}
++ numPassages_m;
......
......@@ -744,10 +744,9 @@ SetStatistics LossDataSink::computeSetStatistics(unsigned int setIdx) {
plainData[i] = data[i].sum;
}
new_reduce(plainData, totalSize, std::plus<double>());
new_reduce(rminmax, 6, std::greater<double>());
allreduce(plainData, totalSize, std::plus<double>());
allreduce(rminmax, 6, std::greater<double>());
if (Ippl::myNode() != 0) return stat;
if (plainData[0] == 0.0) return stat;
double *centroid = plainData + 1;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment