NVBIO
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
batched.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 
31 
32 namespace nvbio {
33 namespace aln {
34 
37 
48 
52 
59 template <uint32 BLOCKDIM_T, uint32 MINBLOCKS_T>
61 {
62  static const uint32 BLOCKDIM = BLOCKDIM_T;
63  static const uint32 MINBLOCKS = MINBLOCKS_T;
64 };
65 
69 
73 
77 
78 template <typename T,typename Scheduler>
79 struct supports_scheduler { static const bool pred = false; };
80 
81 template <AlignmentType TYPE, typename AlgorithmTag> struct supports_scheduler<EditDistanceAligner<TYPE,AlgorithmTag>, HostThreadScheduler> { static const bool pred = true; };
82 template <AlignmentType TYPE, typename AlgorithmTag> struct supports_scheduler<EditDistanceAligner<TYPE,AlgorithmTag>, DeviceThreadScheduler> { static const bool pred = true; };
83 template <AlignmentType TYPE, typename AlgorithmTag> struct supports_scheduler<EditDistanceAligner<TYPE,AlgorithmTag>, DeviceStagedThreadScheduler> { static const bool pred = true; };
84 template <AlignmentType TYPE, typename AlgorithmTag> struct supports_scheduler<EditDistanceAligner<TYPE,AlgorithmTag>, DeviceWarpScheduler> { static const bool pred = true; };
85 
86 template <AlignmentType TYPE, typename ScoringScheme, typename AlgorithmTag> struct supports_scheduler<SmithWatermanAligner<TYPE,ScoringScheme,AlgorithmTag>, HostThreadScheduler> { static const bool pred = true; };
87 template <AlignmentType TYPE, typename ScoringScheme, typename AlgorithmTag> struct supports_scheduler<SmithWatermanAligner<TYPE,ScoringScheme,AlgorithmTag>, DeviceThreadScheduler> { static const bool pred = true; };
88 template <AlignmentType TYPE, typename ScoringScheme, typename AlgorithmTag> struct supports_scheduler<SmithWatermanAligner<TYPE,ScoringScheme,AlgorithmTag>, DeviceStagedThreadScheduler> { static const bool pred = true; };
89 template <AlignmentType TYPE, typename ScoringScheme, typename AlgorithmTag> struct supports_scheduler<SmithWatermanAligner<TYPE,ScoringScheme,AlgorithmTag>, DeviceWarpScheduler> { static const bool pred = true; };
90 
91 template <AlignmentType TYPE, typename ScoringScheme, typename AlgorithmTag> struct supports_scheduler<GotohAligner<TYPE,ScoringScheme,AlgorithmTag>, HostThreadScheduler> { static const bool pred = true; };
92 template <AlignmentType TYPE, typename ScoringScheme, typename AlgorithmTag> struct supports_scheduler<GotohAligner<TYPE,ScoringScheme,AlgorithmTag>, DeviceThreadScheduler> { static const bool pred = true; };
93 template <AlignmentType TYPE, typename ScoringScheme, typename AlgorithmTag> struct supports_scheduler<GotohAligner<TYPE,ScoringScheme,AlgorithmTag>, DeviceStagedThreadScheduler> { static const bool pred = true; };
94 template <AlignmentType TYPE, typename ScoringScheme, typename AlgorithmTag> struct supports_scheduler<GotohAligner<TYPE,ScoringScheme,AlgorithmTag>, DeviceWarpScheduler> { static const bool pred = true; };
95 
96 template <AlignmentType TYPE, typename ScoringScheme, typename AlgorithmTag> struct supports_scheduler<HammingDistanceAligner<TYPE,ScoringScheme,AlgorithmTag>, HostThreadScheduler> { static const bool pred = true; };
97 template <AlignmentType TYPE, typename ScoringScheme, typename AlgorithmTag> struct supports_scheduler<HammingDistanceAligner<TYPE,ScoringScheme,AlgorithmTag>, DeviceThreadScheduler> { static const bool pred = true; };
98 template <AlignmentType TYPE, typename ScoringScheme, typename AlgorithmTag> struct supports_scheduler<HammingDistanceAligner<TYPE,ScoringScheme,AlgorithmTag>, DeviceStagedThreadScheduler> { static const bool pred = true; };
99 
101 
113 
137 template <
138  typename aligner_type,
139  typename pattern_set_type,
140  typename text_set_type,
141  typename sink_iterator,
142  typename scheduler_type>
144  const aligner_type aligner,
145  const pattern_set_type patterns,
146  const text_set_type texts,
147  sink_iterator sinks,
148  const scheduler_type scheduler,
149  const uint32 max_pattern_length = 1000,
150  const uint32 max_text_length = 1000);
151 
177 template <
178  typename aligner_type,
179  typename pattern_set_type,
180  typename qualities_set_type,
181  typename text_set_type,
182  typename sink_iterator,
183  typename scheduler_type>
185  const aligner_type aligner,
186  const pattern_set_type patterns,
187  const qualities_set_type quals,
188  const text_set_type texts,
189  sink_iterator sinks,
190  const scheduler_type scheduler,
191  const uint32 max_pattern_length = 1000,
192  const uint32 max_text_length = 1000);
193 
217 template <
218  uint32 BAND_LEN,
219  typename aligner_type,
220  typename pattern_set_type,
221  typename text_set_type,
222  typename sink_iterator,
223  typename scheduler_type>
225  const aligner_type aligner,
226  const pattern_set_type patterns,
227  const text_set_type texts,
228  sink_iterator sinks,
229  const scheduler_type scheduler,
230  const uint32 max_pattern_length,
231  const uint32 max_text_length);
232 
310 template <
311  typename stream_type,
312  typename algorithm_type = DeviceThreadScheduler>
314 {
315  typedef typename stream_type::aligner_type aligner_type;
317 
320  static uint64 min_temp_storage(const uint32 max_pattern_len, const uint32 max_text_len, const uint32 stream_size);
321 
324  static uint64 max_temp_storage(const uint32 max_pattern_len, const uint32 max_text_len, const uint32 stream_size);
325 
328  void enact(stream_type stream, uint64 temp_size = 0u, uint8* temp = NULL);
329 };
330 
333 template <
334  uint32 BAND_LEN,
335  typename stream_type,
336  typename algorithm_type = DeviceThreadScheduler>
338 {
339  typedef typename stream_type::aligner_type aligner_type;
341 
344  static uint64 min_temp_storage(const uint32 max_pattern_len, const uint32 max_text_len, const uint32 stream_size);
345 
348  static uint64 max_temp_storage(const uint32 max_pattern_len, const uint32 max_text_len, const uint32 stream_size);
349 
352  void enact(stream_type stream, uint64 temp_size = 0u, uint8* temp = NULL);
353 };
354 
432 template <
433  uint32 CHECKPOINTS,
434  typename stream_type,
435  typename algorithm_type = DeviceThreadScheduler>
437 {
440  static uint64 min_temp_storage(const uint32 max_pattern_len, const uint32 max_text_len, const uint32 stream_size);
441 
444  static uint64 max_temp_storage(const uint32 max_pattern_len, const uint32 max_text_len, const uint32 stream_size);
445 
448  void enact(stream_type stream, uint64 temp_size = 0u, uint8* temp = NULL);
449 };
450 
459 template <
460  uint32 BAND_LEN,
461  uint32 CHECKPOINTS,
462  typename stream_type,
463  typename algorithm_type = DeviceThreadScheduler>
465 {
468  static uint64 min_temp_storage(const uint32 max_pattern_len, const uint32 max_text_len, const uint32 stream_size);
469 
472  static uint64 max_temp_storage(const uint32 max_pattern_len, const uint32 max_text_len, const uint32 stream_size);
473 
476  void enact(stream_type stream, uint64 temp_size = 0u, uint8* temp = NULL);
477 };
478 
480 
482 
483 } // namespace aln
484 } // namespace nvbio
485