Skip to content

Commit adb9d2c

Browse files
committed
adjust thread count
1 parent 5463525 commit adb9d2c

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/main.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ int main(int argc, char *argv[])
113113
mm_mapopt_t opt;
114114
mm_idxopt_t ipt;
115115
int i, c, n_threads = std::max(3, (int) std::thread::hardware_concurrency()/2), n_parts, old_best_n = -1;
116+
bool n_threads_override = false;
116117
//by default, we set pthread count to half of hardware supported threads
117118
char *fnw = 0, *rg = 0, *junc_bed = 0, *s;
118119
FILE *fp_help = stderr;
@@ -147,7 +148,7 @@ int main(int argc, char *argv[])
147148
else if (c == 'H') ipt.flag |= MM_I_HPC;
148149
else if (c == 'd') fnw = o.arg; // the above are indexing related options, except -I
149150
else if (c == 'r') opt.bw = (int)mm_parse_num(o.arg);
150-
else if (c == 't') n_threads = atoi(o.arg);
151+
else if (c == 't') {n_threads = atoi(o.arg); n_threads_override = true;}
151152
else if (c == 'v') mm_verbose = atoi(o.arg);
152153
else if (c == 'g') opt.max_gap = (int)mm_parse_num(o.arg);
153154
else if (c == 'G') mm_mapopt_max_intron_len(&opt, (int)mm_parse_num(o.arg));
@@ -217,7 +218,11 @@ int main(int argc, char *argv[])
217218
else if (c == 338) opt.max_qlen = mm_parse_num(o.arg); // --max-qlen
218219
else if (c == 340) junc_bed = o.arg; // --junc-bed
219220
else if (c == 342) opt.flag |= MM_F_SAM_HIT_ONLY; // --sam-hit-only
220-
else if (c == 343) opt.SVaware = false; // --sv-off (defaults back to ISMB'20 version)
221+
else if (c == 343) {
222+
opt.SVaware = false; // --sv-off (defaults back to ISMB'20 version)
223+
if (n_threads_override == false) // --adjust thread count as openmp is not used
224+
n_threads = std::max(3, (int) std::thread::hardware_concurrency());
225+
}
221226
else if (c == 314) { // --frag
222227
yes_or_no(&opt, MM_F_FRAG_MODE, o.longidx, o.arg, 1);
223228
} else if (c == 315) { // --secondary

0 commit comments

Comments
 (0)