Skip to content

Commit

Permalink
Never use more than 8 threads for encoding: it causes problems when r…
Browse files Browse the repository at this point in the history
…unning many DPPP instances
  • Loading branch information
aroffringa committed Sep 20, 2017
1 parent b733d20 commit 380344d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
8 changes: 5 additions & 3 deletions threadeddyscocolumn.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include <casacore/tables/Tables/ScalarColumn.h>
#include <casacore/ms/MeasurementSets/MeasurementSet.h>

#include <algorithm>
#include <limits>

using namespace altthread;
Expand Down Expand Up @@ -250,9 +251,10 @@ void ThreadedDyscoColumn<DataType>::Prepare(DyscoDistribution distribution, Dysc
}

template<typename DataType>
size_t ThreadedDyscoColumn<DataType>::cpuCount() const
size_t ThreadedDyscoColumn<DataType>::defaultThreadCount() const
{
return sysconf(_SC_NPROCESSORS_ONLN);
// Don't spawn more than 8 threads; it causes problems in NDPPP
return std::min(8l, sysconf(_SC_NPROCESSORS_ONLN));
}

template<typename DataType>
Expand All @@ -270,7 +272,7 @@ void ThreadedDyscoColumn<DataType>::InitializeAfterNRowsPerBlockIsKnown()
//TODO _timeBlockEncoder->SetNAntennae(_antennaCount);

// start the threads
size_t threadCount = cpuCount();
size_t threadCount = defaultThreadCount();
EncodingThreadFunctor functor;
functor.parent = this;
_stopThreads = false;
Expand Down
4 changes: 2 additions & 2 deletions threadeddyscocolumn.h
Original file line number Diff line number Diff line change
Expand Up @@ -176,8 +176,8 @@ class ThreadedDyscoColumn : public DyscoStManColumn
bool isWriteItemAvailable(typename cache_t::iterator &i);
void loadBlock(size_t blockIndex);
void storeBlock();
size_t cpuCount() const;
size_t maxCacheSize() const { return cpuCount()*12/10+1; }
size_t defaultThreadCount() const;
size_t maxCacheSize() const { return defaultThreadCount()*12/10+1; }

unsigned _bitsPerSymbol;
casacore::IPosition _shape;
Expand Down

0 comments on commit 380344d

Please sign in to comment.