Skip to content

Commit

Permalink
Fixed generic compile.
Browse files Browse the repository at this point in the history
  • Loading branch information
bbuchfink committed Nov 5, 2019
1 parent 0ab903c commit ebe08d1
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 7 deletions.
9 changes: 4 additions & 5 deletions src/dp/swipe/banded_3frame_swipe.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -531,18 +531,18 @@ void banded_3frame_swipe_worker(vector<DpTarget>::const_iterator begin,
#ifdef __SSE2__
out->splice(out->end(), banded_3frame_swipe_targets<score_vector<int16_t>>(begin + pos, min(begin + pos + config.swipe_chunk_size, end), score_only, *query, strand, stat, true, of));
#else
out->splice(out->end(), banded_3frame_swipe_targets<int32_t>(begin + pos, min(begin + pos + config.swipe_chunk_size, end), score_only, *query, strand, stat, true, false, of));
out->splice(out->end(), banded_3frame_swipe_targets<int32_t>(begin + pos, min(begin + pos + config.swipe_chunk_size, end), score_only, *query, strand, stat, true, of));
#endif
*overflow = std::move(of);
}

list<Hsp> banded_3frame_swipe(const TranslatedSequence &query, Strand strand, vector<DpTarget>::iterator target_begin, vector<DpTarget>::iterator target_end, DpStat &stat, bool score_only, bool parallel)
{
vector<DpTarget> overflow16, overflow32;
#ifdef __SSE2__
task_timer timer("Banded 3frame swipe (sort)", parallel ? 3 : UINT_MAX);
std::stable_sort(target_begin, target_end);
list<Hsp> out;
vector<DpTarget> overflow16, overflow32;
if (parallel) {
timer.go("Banded 3frame swipe (run)");
vector<thread> threads;
Expand Down Expand Up @@ -576,11 +576,10 @@ list<Hsp> banded_3frame_swipe(const TranslatedSequence &query, Strand strand, ve
out = banded_3frame_swipe_targets<score_vector<int16_t>>(target_begin, target_end, score_only, query, strand, stat, false, overflow16);

out.splice(out.end(), banded_3frame_swipe_targets<int32_t>(overflow16.begin(), overflow16.end(), score_only, query, strand, stat, false, overflow32));
return out;
#else
out = banded_3frame_swipe_targets<int32_t>(target_begin, target_end, score_only, query, strand, stat, false, overflow);
return banded_3frame_swipe_targets<int32_t>(target_begin, target_end, score_only, query, strand, stat, false, overflow32);
#endif

return out;
}

}
2 changes: 2 additions & 0 deletions src/dp/swipe/banded_swipe.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,9 @@ void swipe(const sequence &query, Frame frame, vector<DpTarget>::const_iterator
}
}

#ifdef __SSE2__
template void swipe<score_vector<int16_t>, Traceback>(const sequence&, Frame, vector<DpTarget>::const_iterator, vector<DpTarget>::const_iterator);
template void swipe<score_vector<int16_t>, ScoreOnly>(const sequence&, Frame, vector<DpTarget>::const_iterator, vector<DpTarget>::const_iterator);
#endif

}}}
2 changes: 2 additions & 0 deletions src/dp/swipe/swipe.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,8 @@ vector<int> swipe(const sequence &query, const sequence *subject_begin, const se
{
#ifdef __SSE2__
return swipe<score_vector<uint8_t>>(query, subject_begin, subject_end);
#else
return {};
#endif
}

Expand Down
10 changes: 9 additions & 1 deletion src/tools/benchmark.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ void benchmark_ungapped(const sequence &s1, const sequence &s2)
cout << "Scalar ungapped extension:\t" << (double)time_span.count() / (n*40) * 1000 << " ps/Cell" << endl;
}

#ifdef __SSSE3__
void benchmark_ungapped_sse(const sequence &s1, const sequence &s2)
{
static const size_t n = 100000000llu;
Expand All @@ -89,6 +90,7 @@ void benchmark_ungapped_sse(const sequence &s1, const sequence &s2)
}
cout << "SSE score shuffle:\t\t" << (double)duration_cast<std::chrono::nanoseconds>(high_resolution_clock::now() - t1).count() / (n * 16) * 1000 << " ps/Letter" << endl;
}
#endif

void benchmark_transpose() {
static const size_t n = 100000000llu;
Expand All @@ -102,6 +104,7 @@ void benchmark_transpose() {
cout << "Matrix transpose 16x16 bytes:\t" << (double)duration_cast<std::chrono::nanoseconds>(high_resolution_clock::now() - t1).count() / (n * 256) * 1000 << " ps/Letter" << endl;
}

#ifdef __SSE2__
void swipe_cell_update() {
static const size_t n = 1000000000llu;
high_resolution_clock::time_point t1 = high_resolution_clock::now();
Expand All @@ -122,6 +125,7 @@ void swipe_cell_update() {
}
cout << "SWIPE cell update (int8_t):\t" << (double)duration_cast<std::chrono::nanoseconds>(high_resolution_clock::now() - t1).count() / (n * 16) * 1000 << " ps/Cell" << endl;
}
#endif

void swipe(const sequence &s1, const sequence &s2) {
sequence target[16];
Expand Down Expand Up @@ -153,11 +157,15 @@ void benchmark() {
s2 = sequence::from_string("erlvelvtmmgdqgelpiamalanvvpcsqwdelarvlvtlfdsrhllyqllwnmfskeveladsmqtlfrgnslaskimtfcfkvygatylqklldpllrivitssdwqhvsfevdptrlepsesleenqrnllqmtekffhaiissssefppqlrsvchclyqvvsqrfpqnsigavgsamflrfinpaivspyeagildkkpppiierglklmskilqsianhvlftkeehmrpfndfvksnfdaarrffldiasdcptsdavnhslsfisdgnvlalhrllwnnqekigqylssnrdhkavgrrpfdkmatllaylgppe");

benchmark_ungapped(s1, s2);
#ifdef __SSSE3__
benchmark_ungapped_sse(s1, s2);
#endif
benchmark_transpose();
swipe_cell_update();
#ifdef __SSE2__
swipe(s1, s2);
banded_swipe(s1, s2);
swipe_cell_update();
#endif
}

}}
1 change: 0 additions & 1 deletion src/util/simd.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ namespace SIMD {
enum class Arch { None, Generic, SSE4_1 };
enum Flags { SSSE3 = 1, POPCNT = 2, SSE4_1 = 4 };
Arch arch();
extern int flags;

#define DECL_DISPATCH(ret, name, param) namespace ARCH_GENERIC { ret name param; }\
namespace ARCH_SSE4_1 { ret name param; }\
Expand Down

0 comments on commit ebe08d1

Please sign in to comment.