From be0a4038444760efab59ced6bb885ff322240ae4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tommi=20M=C3=A4klin?= Date: Tue, 20 Aug 2024 15:59:56 +0300 Subject: [PATCH] Add an undocumented -t option to use more than 1 thread. --- src/mGEMS.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/mGEMS.cpp b/src/mGEMS.cpp index a359bfe..09a944f 100644 --- a/src/mGEMS.cpp +++ b/src/mGEMS.cpp @@ -29,6 +29,7 @@ void ParseBin(int argc, char* argv[], cxxargs::Arguments &args) { args.add_short_argument('a', "Relative abundances estimates from mSWEEP."); args.add_short_argument('i', "Group identifiers file used with the mSWEEP call."); args.set_not_required('i'); + args.add_short_argument('t', "Number of threads to use (default: 1).", (size_t)1); args.add_long_argument("probs", "Posterior probabilities from mSWEEP."); args.add_long_argument("merge-mode", "How to merge paired-end alignments from Themisto (default: intersection).", "intersection"); args.add_long_argument>("groups", "Which reference groups to bin reads to (default: all)."); @@ -113,7 +114,12 @@ void Bin(const cxxargs::Arguments &args, bool extract_bins) { std::vector abundances; cxxio::In msweep_abundances(args.value('a')); mGEMS::ReadAbundances(msweep_abundances.stream(), &abundances, &groups); - + +#if defined(MGEMS_OPENMP_SUPPORT) && (MGEMS_OPENMP_SUPPORT) == 1 + size_t n_threads = args.value('t'); + omp_set_num_threads(n_threads); +#endif + std::vector themisto_alns; for (uint32_t i = 0; i < args.value>("themisto-alns").size(); ++i) { cxxio::In(args.value>("themisto-alns")[i]);