NVBIO
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
sufsort.h
Go to the documentation of this file.
1 /*
2  * nvbio
3  * Copyright (c) 2011-2014, NVIDIA CORPORATION. All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions are met:
7  * * Redistributions of source code must retain the above copyright
8  * notice, this list of conditions and the following disclaimer.
9  * * Redistributions in binary form must reproduce the above copyright
10  * notice, this list of conditions and the following disclaimer in the
11  * documentation and/or other materials provided with the distribution.
12  * * Neither the name of the NVIDIA CORPORATION nor the
13  * names of its contributors may be used to endorse or promote products
14  * derived from this software without specific prior written permission.
15  *
16  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19  * DISCLAIMED. IN NO EVENT SHALL NVIDIA CORPORATION BE LIABLE FOR ANY
20  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26  */
27 
28 #pragma once
29 
32 #include <nvbio/basic/cuda/sort.h>
33 #include <thrust/device_vector.h>
34 #include <thrust/transform_scan.h>
35 #include <thrust/sort.h>
36 
78 
84 
85 namespace nvbio {
86 
89 
92 struct BWTParams
93 {
95  host_memory(8u*1024u*1024u*1024llu),
96  device_memory(2u*1024u*1024u*1024llu),
97  bucketing_bits(16u),
98  radix_slice(4u),
99  cpu_bucketing(0u) {}
100 
106 };
107 
109 
112 namespace cuda {
114 
117 
120 template <typename string_type>
121 typename string_type::index_type find_primary(
122  const typename string_type::index_type string_len,
123  const string_type string);
124 
138 template <typename string_type, typename output_iterator>
139 void suffix_sort(
140  const typename stream_traits<string_type>::index_type string_len,
141  const string_type string,
142  output_iterator output,
143  BWTParams* params);
144 
178 template <typename string_type, typename output_handler>
180  const typename string_type::index_type string_len,
181  string_type string,
182  output_handler& output,
183  BWTParams* params);
184 
200 template <typename string_type, typename output_iterator>
201 typename string_type::index_type bwt(
202  const typename string_type::index_type string_len,
203  string_type string,
204  output_iterator output,
205  BWTParams* params);
206 
229 template <typename string_set_type, typename output_handler>
230 void suffix_sort(
231  const string_set_type& string_set,
232  output_handler& output,
233  BWTParams* params = NULL);
234 
261 template <uint32 SYMBOL_SIZE, bool BIG_ENDIAN, typename storage_type, typename output_handler>
262 void bwt(
263  const ConcatenatedStringSet<
265  uint64*> string_set,
266  output_handler& output,
267  BWTParams* params = NULL);
268 
270 
271 } // namespace cuda
272 
275 
301 template <uint32 SYMBOL_SIZE, bool BIG_ENDIAN, typename storage_type, typename output_handler>
302 void large_bwt(
303  const ConcatenatedStringSet<
304  PackedStream<storage_type,uint8,SYMBOL_SIZE,BIG_ENDIAN,uint64>,
305  uint64*> string_set,
306  output_handler& output,
307  BWTParams* params = NULL);
308 
310 
311 } // namespace nvbio
312