Codebase list kmc / 81f0b3e
Support non-x86 systems via libsimde-dev Michael R. Crusoe 3 years ago
5 changed file(s) with 202 addition(s) and 1 deletion(s). Raw diff Collapse all Expand all
00 kmc (3.1.1+dfsg-2) UNRELEASED; urgency=medium
11
2 [ Étienne Mollier ]
23 * Remove non-portable -m64 flag put back by error.
4
5 [ Michael R. Crusoe ]
6 * Support non-x86 systems via libsimde-dev. Closes: #977498
37
48 -- Étienne Mollier <etienne.mollier@mailoo.org> Fri, 11 Dec 2020 00:07:16 +0100
59
1212 libbz2-dev,
1313 help2man,
1414 asciidoctor,
15 d-shlibs
15 d-shlibs,
16 libsimde-dev
1617 Standards-Version: 4.5.1
1718 Vcs-Browser: https://salsa.debian.org/med-team/kmc
1819 Vcs-Git: https://salsa.debian.org/med-team/kmc.git
2122
2223 Package: kmc
2324 Architecture: any
25 Built-Using: ${simde:Built-Using}
2426 Depends: ${shlibs:Depends},
2527 ${misc:Depends}
2628 Description: count kmers in genomic sequences
4749 order of the size of input data (usually it is smaller).
4850
4951 Package: libkmc-dev
52 Built-Using: ${simde:Built-Using}
5053 Architecture: any
5154 Section: libdevel
5255 Depends: ${shlibs:Depends},
33 newish_gcc_build_fix.patch
44 disable-python-bindings.patch
55 spelling.patch
6 simde
0 Author: Michael R. Crusoe <crusoe@debian.org>
1 Description: support non-x86 systems via libsimde-dev
2 --- kmc.orig/kmer_counter/cpu_info.cpp
3 +++ kmc/kmer_counter/cpu_info.cpp
4 @@ -38,6 +38,7 @@
5 string vendor, brand;
6 void cpuid(int *result, int function_id) const
7 {
8 +#if defined(__x86_64__) || defined(__i386__)
9 #ifdef _MSC_VER
10 __cpuidex(result, function_id, 0);
11
12 @@ -53,10 +54,12 @@
13 __asm__("cpuid\n\t"
14 : "=a" (result[0]), "=b" (result[1]), "=c" (result[2]), "=d" (result[3]) : "0" (function_id), "c"(0));
15 #endif
16 +#endif
17 }
18
19 CpuInfoImpl()
20 {
21 +#if defined(__x86_64__) || defined(__i386__)
22 array<int, 4> cpui = { -1 };
23 cpuid(cpui.data(), 0);
24 int nIds_ = cpui[0];
25 @@ -90,6 +93,9 @@
26 std::bitset<32> EBX = data_[7][1];
27 avx2 = EBX[5];
28 }
29 +#else
30 + sse2=true;
31 +#endif
32 }
33
34 const string& GetVendor() const
35 @@ -145,4 +151,4 @@
36 bool CCpuInfo::AVX_Enabled() { return cpu_info_impl.avx; }
37 bool CCpuInfo::AVX2_Enabled() { return cpu_info_impl.avx2; }
38
39 -// ***** EOF
40 \ No newline at end of file
41 +// ***** EOF
42 --- kmc.orig/kmer_counter/intr_copy.h
43 +++ kmc/kmer_counter/intr_copy.h
44 @@ -11,8 +11,8 @@
45 #ifndef _INTR_COPY_H
46 #define _INTR_COPY_H
47
48 -#include <emmintrin.h>
49 -#include <immintrin.h>
50 +#define SIMDE_ENABLE_NATIVE_ALIASES
51 +#include <simde/x86/sse2.h>
52
53 #ifndef WIN32
54 typedef long long __int64;
55 @@ -89,4 +89,4 @@
56
57 #endif
58
59 -// ***** EOF
60 \ No newline at end of file
61 +// ***** EOF
62 --- kmc.orig/kmer_counter/kmc.h
63 +++ kmc/kmer_counter/kmc.h
64 @@ -1112,6 +1112,8 @@
65 #ifdef __APPLE__
66 sort_func = RadixSort::RadixSortMSD<CKmer<SIZE>, SIZE>;
67 CSmallSort<SIZE>::Adjust(384);
68 +#elif !defined(__x86_64__) && !defined(__i386__)
69 + sort_func = RadulsSort::RadixSortMSD_SSE2<CKmer<SIZE>>;
70 #else
71 auto proc_name = CCpuInfo::GetBrand();
72 bool is_intel = CCpuInfo::GetVendor() == "GenuineIntel";
73 --- kmc.orig/makefile
74 +++ kmc/makefile
75 @@ -30,11 +30,16 @@
76 $(KMC_MAIN_DIR)/kmer.o \
77 $(KMC_MAIN_DIR)/splitter.o \
78 $(KMC_MAIN_DIR)/kb_collector.o
79 +ifeq (1,$(SIMD))
80 RADULS_OBJS = \
81 $(KMC_MAIN_DIR)/raduls_sse2.o \
82 $(KMC_MAIN_DIR)/raduls_sse41.o \
83 $(KMC_MAIN_DIR)/raduls_avx2.o \
84 $(KMC_MAIN_DIR)/raduls_avx.o
85 +else
86 +RADULS_OBJS = \
87 +$(KMC_MAIN_DIR)/raduls_sse2.o
88 +endif
89
90 KMC_DUMP_OBJS = \
91 $(KMC_DUMP_DIR)/nc_utils.o \
92 @@ -66,6 +71,7 @@
93 $(KMC_TOOLS_OBJS): %.o: %.cpp
94 $(CXX) $(CPPFLAGS) $(KMC_TOOLS_CXXFLAGS) -c $< -o $@
95
96 +ifeq (1,$(SIMD))
97 $(KMC_MAIN_DIR)/raduls_sse2.o: $(KMC_MAIN_DIR)/raduls_sse2.cpp
98 $(CXX) $(CPPFLAGS) $(CXXFLAGS) -msse2 -c $< -o $@
99 $(KMC_MAIN_DIR)/raduls_sse41.o: $(KMC_MAIN_DIR)/raduls_sse41.cpp
100 @@ -74,6 +80,10 @@
101 $(CXX) $(CPPFLAGS) $(CXXFLAGS) -mavx -c $< -o $@
102 $(KMC_MAIN_DIR)/raduls_avx2.o: $(KMC_MAIN_DIR)/raduls_avx2.cpp
103 $(CXX) $(CPPFLAGS) $(CXXFLAGS) -mavx2 -c $< -o $@
104 +else
105 +$(KMC_MAIN_DIR)/raduls_sse2.o: $(KMC_MAIN_DIR)/raduls_sse2.cpp
106 + $(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $< -o $@
107 +endif
108
109 kmc: $(KMC_OBJS) $(RADULS_OBJS)
110 -mkdir -p $(KMC_BIN_DIR)
111 --- kmc.orig/kmer_counter/splitter.cpp
112 +++ kmc/kmer_counter/splitter.cpp
113 @@ -350,7 +350,7 @@
114 if (!both_strands && is_rev_comp) //if read is reversed and kmc was run to count all (not only canonical) kmers read must be transformed back
115 {
116 //static const char rev_maping[] = "=TGMCRSVAWYHKDBN";
117 - static const char rev_maping[] = { -1, 3, 2, -1, 1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1 };// "=TGMCRSVAWYHKDBN";
118 + static const int rev_maping[] = { -1, 3, 2, -1, 1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1 };// "=TGMCRSVAWYHKDBN";
119 uint32 n_bytes = l_seq / 2;
120 uint64_t pos_after = pos + l_seq;
121 pos = pos_after;
122 @@ -369,7 +369,7 @@
123 }
124 else
125 {
126 - static const char maping[] = { -1, 0, 1, -1, 2, -1, -1, -1, 3, -1, -1, -1, -1, -1, -1, -1 };//"=ACMGRSVTWYHKDBN";
127 + static const int maping[] = { -1, 0, 1, -1, 2, -1, -1, -1, 3, -1, -1, -1, -1, -1, -1, -1 };//"=ACMGRSVTWYHKDBN";
128 uint32 n_bytes = l_seq / 2;
129 for (uint32_t ii = 0; ii < n_bytes; ++ii)
130 {
131 @@ -956,4 +956,4 @@
132 template class CWSmallKSplitter<uint32>;
133 template class CWSmallKSplitter<uint64>;
134
135 -// ***** EOF
136 \ No newline at end of file
137 +// ***** EOF
138 --- kmc.orig/kmer_counter/raduls.h
139 +++ kmc/kmer_counter/raduls.h
140 @@ -23,7 +23,7 @@
141 {
142 template<typename KMER_T>
143 void RadixSortMSD_SSE2(KMER_T* kmers, KMER_T* tmp, uint64 n_recs, uint32 byte, uint32 n_threads, CMemoryPool* pmm_radix_buf);
144 -
145 +#if defined(__x86_64__) || defined(__i386__)
146 template<typename KMER_T>
147 void RadixSortMSD_SSE41(KMER_T* kmers, KMER_T* tmp, uint64 n_recs, uint32 byte, uint32 n_threads, CMemoryPool* pmm_radix_buf);
148
149 @@ -32,8 +32,9 @@
150
151 template<typename KMER_T>
152 void RadixSortMSD_AVX2(KMER_T* kmers, KMER_T* tmp, uint64 n_recs, uint32 byte, uint32 n_threads, CMemoryPool* pmm_radix_buf);
153 +#endif
154 }
155
156 #endif // RADULS_H
157
158 -// ***** EOF
159 \ No newline at end of file
160 +// ***** EOF
161 --- kmc.orig/kmer_counter/raduls_impl.h
162 +++ kmc/kmer_counter/raduls_impl.h
163 @@ -730,7 +730,7 @@
164 #define RADULS_RADIX_SORT_FUNNAME RadixSortMSD_AVX
165 #elif defined(__SSE4_1__)
166 #define RADULS_RADIX_SORT_FUNNAME RadixSortMSD_SSE41
167 -#elif defined(__SSE2__)
168 +#else
169 #define RADULS_RADIX_SORT_FUNNAME RadixSortMSD_SSE2
170 #endif
171
172 @@ -769,4 +769,4 @@
173
174 #endif
175
176 -// ***** EOF
177 \ No newline at end of file
178 +// ***** EOF
11
22 export DH_VERBOSE := 1
33 export DEB_BUILD_MAINT_OPTIONS = hardening=+all
4
5 export DEB_CFLAGS_MAINT_APPEND+=-DSIMDE_ENABLE_OPENMP -fopenmp-simd -O3
6 export DEB_CXXFLAGS_MAINT_APPEND+=-DSIMDE_ENABLE_OPENMP -fopenmp-simd -O3
47
58 include /usr/share/dpkg/default.mk
69 DATE := $(SOURCE_DATE_EPOCH)
811 mandir := $(CURDIR)/debian/man
912 debfolder := $(CURDIR)/debian
1013
14
1115 %:
1216 dh $@
17
18 override_dh_auto_build:
19 ifneq (,$(filter $(DEB_HOST_ARCH),amd64 i386))
20 dh_auto_build -- SIMD=1
21 else
22 dh_auto_build
23 endif
1324
1425 override_dh_install:
1526 dh_install
2536 asciidoctor -a docdate='' -b manpage $(debfolder)/man_src/*.adoc
2637 cp $(debfolder)/man_src/*.? $(mandir)
2738 dh_installman --
39
40 override_dh_gencontrol:
41 dh_gencontrol -- -Vsimde:Built-Using="$(shell dpkg-query -f '$${source:Package} (= $${source:Version}), ' -W "libsimde-dev")"