Skip to content

Commit b2d67ac

Browse files
Updating the pragma guard for optimizations in the alignment code that will hopefully prevent the problems seen on macs but work on more compilers. Not an ideal fix.
1 parent 7f90f30 commit b2d67ac

1 file changed

Lines changed: 13 additions & 6 deletions

File tree

src/AbismalAlign.hpp

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -159,11 +159,9 @@ is_insertion(const uint8_t c) {
159159

160160
static inline void
161161
get_traceback(const size_t n_col, const std::vector<score_t> &table,
162-
// const std::vector<uint8_t> &traceback,
163162
const std::vector<int8_t> &traceback,
164163
std::vector<uint32_t> &cigar, size_t &the_row, size_t &the_col) {
165164
int8_t prev_arrow = traceback[the_row * n_col + the_col];
166-
// int8_t prev_arrow = traceback[the_row * n_col + the_col];
167165
const bool is_del = is_deletion(prev_arrow);
168166
const bool is_ins = is_insertion(prev_arrow);
169167
the_row -= !is_ins;
@@ -211,8 +209,15 @@ get_best_score(const std::vector<score_t> &table, const size_t n_cells,
211209
// ADS: it seems like with g++-13, on macos ventura on intel hardware
212210
// the dynamic vectorized optimization of -O3 might be too aggressive
213211
// and makes this function have strange behavior. Placing this pragma
214-
// here helps, and below we restore it to the `-O3` default.
215-
#pragma GCC optimize("vect-cost-model=very-cheap")
212+
// here helps, and below we restore it to the `-O3` default. Probably
213+
// should move to attribute syntax soon.
214+
215+
#ifdef __APPLE__
216+
#pragma GCC push_options
217+
// ADS: below this won't make sense if the user wants no optimizations
218+
// at all...
219+
#pragma GCC optimize ("O2")
220+
#endif
216221

217222
template<score_t (*scr_fun)(const uint8_t, const uint8_t), class T,
218223
class QueryConstItr>
@@ -284,7 +289,9 @@ from_left(T left_itr, T target, const T target_end, U traceback) {
284289
}
285290
}
286291

287-
#pragma GCC optimize("vect-cost-model=dynamic")
292+
#ifdef __APPLE__
293+
#pragma GCC pop_options
294+
#endif
288295

289296
inline void
290297
make_default_cigar(const uint32_t len, std::string &cigar) {
@@ -323,7 +330,7 @@ AbismalAlign<scr_fun, indel_pen>::align(const score_t diffs,
323330

324331
// points to relevant reference sequence positions
325332
genome_iterator t_itr = target + t_beg;
326-
const auto q_itr(std::begin(qseq));
333+
const auto q_itr(std::cbegin(qseq));
327334
auto tb_cur(std::begin(traceback));
328335

329336
// prev and cur point to rows in the alignment matrix

0 commit comments

Comments
 (0)