Skip to content

Commit be0a403

Browse files
committed
Add an undocumented -t option to use more than 1 thread.
1 parent ef2d9fb commit be0a403

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/mGEMS.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ void ParseBin(int argc, char* argv[], cxxargs::Arguments &args) {
2929
args.add_short_argument<std::string>('a', "Relative abundances estimates from mSWEEP.");
3030
args.add_short_argument<std::string>('i', "Group identifiers file used with the mSWEEP call.");
3131
args.set_not_required('i');
32+
args.add_short_argument<size_t>('t', "Number of threads to use (default: 1).", (size_t)1);
3233
args.add_long_argument<std::string>("probs", "Posterior probabilities from mSWEEP.");
3334
args.add_long_argument<std::string>("merge-mode", "How to merge paired-end alignments from Themisto (default: intersection).", "intersection");
3435
args.add_long_argument<std::vector<std::string>>("groups", "Which reference groups to bin reads to (default: all).");
@@ -113,7 +114,12 @@ void Bin(const cxxargs::Arguments &args, bool extract_bins) {
113114
std::vector<double> abundances;
114115
cxxio::In msweep_abundances(args.value<std::string>('a'));
115116
mGEMS::ReadAbundances(msweep_abundances.stream(), &abundances, &groups);
116-
117+
118+
#if defined(MGEMS_OPENMP_SUPPORT) && (MGEMS_OPENMP_SUPPORT) == 1
119+
size_t n_threads = args.value<size_t>('t');
120+
omp_set_num_threads(n_threads);
121+
#endif
122+
117123
std::vector<std::istream*> themisto_alns;
118124
for (uint32_t i = 0; i < args.value<std::vector<std::string>>("themisto-alns").size(); ++i) {
119125
cxxio::In(args.value<std::vector<std::string>>("themisto-alns")[i]);

0 commit comments

Comments
 (0)