Skip to content

Commit

Permalink
calculate thread number better
Browse files Browse the repository at this point in the history
  • Loading branch information
Rob Patro committed Oct 5, 2020
1 parent f03a9f4 commit f65449d
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/SalmonAlevin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1826,11 +1826,8 @@ void sc_align_read_library(ReadExperimentT& readExp,
size_t numFiles = rl.mates1().size() + rl.mates2().size();
uint32_t numParsingThreads{1};
// HACK!
// below ~6 threads, assume that parser won't do
// too much actual cpu work.
if(numThreads > 6){
numThreads -= 1;
}
// if we have more than 1 set of input files and the thread count is
// greater than 8, then dedicate a second thread to parsing.
if (rl.mates1().size() > 1 and numThreads > 8) { numParsingThreads = 2; numThreads -= 1;}
pairedParserPtr.reset(new paired_parser(rl.mates1(), rl.mates2(), numThreads, numParsingThreads, miniBatchSize));
pairedParserPtr->start();
Expand Down Expand Up @@ -2562,6 +2559,13 @@ int alevin_sc_align(AlevinOpts<ProtocolT>& aopt,

sopt.allowOrphans = true;
sopt.useQuasi = true;

// lose one thread for parsing
// TODO: is it reasonable to assume
// that the work done by the parsing thread
// will be substantial enough to count if
// the remaining mapping thread count is
// too small?
if(sopt.numThreads > 1){
sopt.numThreads -= 1;
}
Expand Down

0 comments on commit f65449d

Please sign in to comment.