34 #include <thrust/host_vector.h>
35 #include <thrust/device_vector.h>
71 const uint64* dollar_ids) {}
80 const uint64* dollar_ids) {}
85 template <
typename OutputIterator>
135 template <
typename OutputIterator>
142 template <
typename bwt_iterator>
145 const bwt_iterator
bwt)
147 for (
uint32 i = 0; i < n_suffixes; ++i)
163 if (bits_per_symbol == 2)
165 else if (bits_per_symbol == 4)
167 else if (bits_per_symbol == 8)
188 template <u
int32 SYMBOL_SIZE,
bool BIG_ENDIAN,
typename word_type>
194 static const uint32 SYMBOLS_PER_WORD = WORD_SIZE / SYMBOL_SIZE;
203 template <
typename bwt_iterator>
206 const bwt_iterator
bwt)
208 const uint32 word_offset = offset & (SYMBOLS_PER_WORD-1);
210 uint32 word_idx = offset / SYMBOLS_PER_WORD;
212 word_type* words = output.stream();
217 word_rem = SYMBOLS_PER_WORD - word_offset;
220 word_type word = words[ word_idx ];
222 for (
uint32 i = 0; i < word_rem; ++i)
224 const uint32 bit_idx = (word_offset + i) * SYMBOL_SIZE;
225 const uint32 symbol_offset = BIG_ENDIAN ? (WORD_SIZE - SYMBOL_SIZE - bit_idx) : bit_idx;
226 const word_type symbol = word_type(bwt[i]) << symbol_offset;
233 words[ word_idx ] = word;
239 for (
uint32 i = word_rem; i < n_suffixes; i += SYMBOLS_PER_WORD)
246 for (
uint32 j = 0; j < n_symbols; ++j)
248 const uint32 bit_idx = j * SYMBOL_SIZE;
249 const uint32 symbol_offset = BIG_ENDIAN ? (WORD_SIZE - SYMBOL_SIZE - bit_idx) : bit_idx;
250 const word_type symbol = word_type(bwt[i + j]) << symbol_offset;
257 words[ ++word_idx ] = word;
261 offset += n_suffixes;
274 if (bits_per_symbol == 2)
276 else if (bits_per_symbol == 4)
278 else if (bits_per_symbol == 8)
291 do_process( n_suffixes, bwt );
311 template <
typename string_type,
typename output_iterator>
322 const string_type _string,
323 output_iterator _output) :
344 thrust::device_ptr<const uint32>( d_suffixes ),
345 thrust::device_ptr<const uint32>( d_suffixes ) + n_suffixes,
355 if (block_primary < n_suffixes)
383 thrust::device_ptr<const uint32>( d_suffixes ),
384 thrust::device_ptr<const uint32>( d_suffixes ) + n_suffixes,
394 if (block_primary < n_suffixes)
397 primary = thrust::device_ptr<const uint32>( d_slots )[ block_primary ] + 1u;
405 thrust::device_ptr<const uint32>( d_slots ),
415 const uint32 max_block_size = 32*1024*1024;
425 block_end - block_begin,
426 output + block_begin + 1u,
432 block_end - block_begin,
449 template <
typename output_iterator>
457 output_iterator _output) :
476 thrust::device_ptr<const uint32>(d_suffixes),
477 thrust::device_ptr<const uint32>(d_suffixes) + n_suffixes,
481 #pragma omp parallel for
482 for (
int i = 0; i < int( n_suffixes ); ++i)
486 if ((slot & (
mod-1)) == 0)
505 thrust::device_ptr<const uint32>(d_slots),
506 thrust::device_ptr<const uint32>(d_slots) + n_suffixes,
510 thrust::device_ptr<const uint32>(d_suffixes),
511 thrust::device_ptr<const uint32>(d_suffixes) + n_suffixes,
515 #pragma omp parallel for
516 for (
int i = 0; i < int( n_suffixes ); ++i)
520 if ((slot & (
mod-1)) == 0)
535 template <
typename string_type,
typename output_bwt_iterator,
typename output_ssa_iterator>
540 const string_type _string,
542 output_bwt_iterator _bwt,
543 output_ssa_iterator _ssa) :