• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

MikkelSchubert / adapterremoval / #36

22 Jul 2024 09:33AM UTC coverage: 87.26% (-12.7%) from 100.0%
#36

push

travis-ci

MikkelSchubert
remove duplicate tests

2185 of 2504 relevant lines covered (87.26%)

16293.15 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

64.71
/src/simd.cpp
1
/*************************************************************************\
2
 * AdapterRemoval - cleaning next-generation sequencing reads            *
3
 *                                                                       *
4
 * Copyright (C) 2022 by Mikkel Schubert - mikkelsch@gmail.com           *
5
 *                                                                       *
6
 * This program is free software: you can redistribute it and/or modify  *
7
 * it under the terms of the GNU General Public License as published by  *
8
 * the Free Software Foundation, either version 3 of the License, or     *
9
 * (at your option) any later version.                                   *
10
 *                                                                       *
11
 * This program is distributed in the hope that it will be useful,       *
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of        *
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
14
 * GNU General Public License for more details.                          *
15
 *                                                                       *
16
 * You should have received a copy of the GNU General Public License     *
17
 * along with this program.  If not, see <http://www.gnu.org/licenses/>. *
18
\*************************************************************************/
19
#include "simd.hpp"
20
#include "debug.hpp"
21
#include <string> // for basic_string
22

23
namespace adapterremoval {
24

25
namespace simd {
26

27
bool
28
compare_subsequences_std(size_t& n_mismatches,
29
                         size_t& n_ambiguous,
30
                         const char* seq_1,
31
                         const char* seq_2,
32
                         size_t length,
33
                         size_t max_penalty);
34

35
bool
36
compare_subsequences_sse2(size_t& n_mismatches,
37
                          size_t& n_ambiguous,
38
                          const char* seq_1,
39
                          const char* seq_2,
40
                          size_t length,
41
                          size_t max_penalty);
42

43
bool
44
compare_subsequences_avx2(size_t& n_mismatches,
45
                          size_t& n_ambiguous,
46
                          const char* seq_1,
47
                          const char* seq_2,
48
                          size_t length,
49
                          size_t max_penalty);
50

51
bool
52
compare_subsequences_avx512(size_t& n_mismatches,
53
                            size_t& n_ambiguous,
54
                            const char* seq_1,
55
                            const char* seq_2,
56
                            size_t length,
57
                            size_t max_penalty);
58

59
std::vector<instruction_set>
60
supported()
38✔
61
{
62
  std::vector<instruction_set> choices = { instruction_set::none };
76✔
63

64
  if (__builtin_cpu_supports("sse2")) {
38✔
65
    choices.push_back(instruction_set::sse2);
76✔
66
  }
67

68
  if (__builtin_cpu_supports("avx2")) {
38✔
69
    choices.push_back(instruction_set::avx2);
76✔
70
  }
71

72
  if (__builtin_cpu_supports("avx512bw")) {
38✔
73
    choices.push_back(instruction_set::avx512);
×
74
  }
75

76
  return choices;
38✔
77
}
×
78

79
const char*
80
name(instruction_set value)
405✔
81
{
82
  switch (value) {
405✔
83
    case instruction_set::none:
84
      return "none";
85
    case instruction_set::sse2:
135✔
86
      return "SSE2";
135✔
87
    case instruction_set::avx2:
135✔
88
      return "AVX2";
135✔
89
    case instruction_set::avx512:
×
90
      return "AVX512";
×
91
    default:
×
92
      AR_FAIL("SIMD function not implemented!");
×
93
  }
94
}
95

96
size_t
97
padding(instruction_set value)
519✔
98
{
99
  switch (value) {
519✔
100
    case instruction_set::none:
101
      return 0;
102
    case instruction_set::sse2:
103
      return 15;
104
    case instruction_set::avx2:
105
      return 31;
106
    case instruction_set::avx512:
107
      return 0;
108
    default:
×
109
      AR_FAIL("SIMD function not implemented!");
×
110
  }
111
}
112

113
compare_subsequences_func
114
get_compare_subsequences_func(instruction_set is)
519✔
115
{
116
  switch (is) {
519✔
117
    case instruction_set::none:
118
      return &compare_subsequences_std;
119
    case instruction_set::sse2:
173✔
120
      return &compare_subsequences_sse2;
173✔
121
    case instruction_set::avx2:
173✔
122
      return &compare_subsequences_avx2;
173✔
123
    case instruction_set::avx512:
×
124
      return &compare_subsequences_avx512;
×
125
    default:
×
126
      AR_FAIL("SIMD function not implemented!");
×
127
  }
128
}
129

130
} // namespace simd
131

132
} // namespace adapterremoval
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc