From ebe08d12f1fcd0c2e3a5f08ee3ea2795b6ab3197 Mon Sep 17 00:00:00 2001 From: Benjamin Buchfink Date: Tue, 5 Nov 2019 10:45:15 +0100 Subject: [PATCH] Fixed generic compile. --- src/dp/swipe/banded_3frame_swipe.cpp | 9 ++++----- src/dp/swipe/banded_swipe.cpp | 2 ++ src/dp/swipe/swipe.cpp | 2 ++ src/tools/benchmark.cpp | 10 +++++++++- src/util/simd.h | 1 - 5 files changed, 17 insertions(+), 7 deletions(-) diff --git a/src/dp/swipe/banded_3frame_swipe.cpp b/src/dp/swipe/banded_3frame_swipe.cpp index ea1f3d9f..c83b3871 100644 --- a/src/dp/swipe/banded_3frame_swipe.cpp +++ b/src/dp/swipe/banded_3frame_swipe.cpp @@ -531,18 +531,18 @@ void banded_3frame_swipe_worker(vector::const_iterator begin, #ifdef __SSE2__ out->splice(out->end(), banded_3frame_swipe_targets>(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(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(begin + pos, min(begin + pos + config.swipe_chunk_size, end), score_only, *query, strand, stat, true, of)); #endif *overflow = std::move(of); } list banded_3frame_swipe(const TranslatedSequence &query, Strand strand, vector::iterator target_begin, vector::iterator target_end, DpStat &stat, bool score_only, bool parallel) { + vector overflow16, overflow32; #ifdef __SSE2__ task_timer timer("Banded 3frame swipe (sort)", parallel ? 3 : UINT_MAX); std::stable_sort(target_begin, target_end); list out; - vector overflow16, overflow32; if (parallel) { timer.go("Banded 3frame swipe (run)"); vector threads; @@ -576,11 +576,10 @@ list banded_3frame_swipe(const TranslatedSequence &query, Strand strand, ve out = banded_3frame_swipe_targets>(target_begin, target_end, score_only, query, strand, stat, false, overflow16); out.splice(out.end(), banded_3frame_swipe_targets(overflow16.begin(), overflow16.end(), score_only, query, strand, stat, false, overflow32)); + return out; #else - out = banded_3frame_swipe_targets(target_begin, target_end, score_only, query, strand, stat, false, overflow); + return banded_3frame_swipe_targets(target_begin, target_end, score_only, query, strand, stat, false, overflow32); #endif - - return out; } } \ No newline at end of file diff --git a/src/dp/swipe/banded_swipe.cpp b/src/dp/swipe/banded_swipe.cpp index be5d8ccf..d1a6af50 100644 --- a/src/dp/swipe/banded_swipe.cpp +++ b/src/dp/swipe/banded_swipe.cpp @@ -377,7 +377,9 @@ void swipe(const sequence &query, Frame frame, vector::const_iterator } } +#ifdef __SSE2__ template void swipe, Traceback>(const sequence&, Frame, vector::const_iterator, vector::const_iterator); template void swipe, ScoreOnly>(const sequence&, Frame, vector::const_iterator, vector::const_iterator); +#endif }}} \ No newline at end of file diff --git a/src/dp/swipe/swipe.cpp b/src/dp/swipe/swipe.cpp index b38b2dc5..9ffe66c4 100644 --- a/src/dp/swipe/swipe.cpp +++ b/src/dp/swipe/swipe.cpp @@ -160,6 +160,8 @@ vector swipe(const sequence &query, const sequence *subject_begin, const se { #ifdef __SSE2__ return swipe>(query, subject_begin, subject_end); +#else + return {}; #endif } diff --git a/src/tools/benchmark.cpp b/src/tools/benchmark.cpp index b20fa269..326f8cc7 100644 --- a/src/tools/benchmark.cpp +++ b/src/tools/benchmark.cpp @@ -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; @@ -89,6 +90,7 @@ void benchmark_ungapped_sse(const sequence &s1, const sequence &s2) } cout << "SSE score shuffle:\t\t" << (double)duration_cast(high_resolution_clock::now() - t1).count() / (n * 16) * 1000 << " ps/Letter" << endl; } +#endif void benchmark_transpose() { static const size_t n = 100000000llu; @@ -102,6 +104,7 @@ void benchmark_transpose() { cout << "Matrix transpose 16x16 bytes:\t" << (double)duration_cast(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(); @@ -122,6 +125,7 @@ void swipe_cell_update() { } cout << "SWIPE cell update (int8_t):\t" << (double)duration_cast(high_resolution_clock::now() - t1).count() / (n * 16) * 1000 << " ps/Cell" << endl; } +#endif void swipe(const sequence &s1, const sequence &s2) { sequence target[16]; @@ -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 } }} \ No newline at end of file diff --git a/src/util/simd.h b/src/util/simd.h index 1d416061..f4104945 100644 --- a/src/util/simd.h +++ b/src/util/simd.h @@ -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; }\