in bioinformatics , the sequence alignment has become one of the most important issues . when the biologists get an unknown sequence , in general they would compare this unknown sequence ( denoted as query sequence ) with the known database of sequences ( denoted as database sequences ) to find the similarity scores and then identify the evolutionary relationships among them .
needleman and wunsch   proposed a dynamic programming method ( abbreviated to nw algorithm ) to solve the global alignment problem between two sequences in 1970 .
the smith - waterman ( abbreviated to sw ) algorithm , which was proposed by smith and waterman   in 1981 , is designed to find the optimal local alignment , and it is enhanced by gotoh   in 1982 . although hirschberg 's algorithm   can be used for these algorithms above to reduce the memory space requirement , the computing time increases by a factor of two . when the lengths of two sequences are m and n , respectively , the time complexities of both nw and sw algorithms are o(mn ) , respectively , and their space complexities by adapting hirschberg 's algorithm can be both reduced from o(mn ) to o(m ) , where m is assumed to be larger than n. though the nw and sw algorithms guarantee the maximal sensitivity for the alignment , the cost is still expensive , especially for the computation time .
several fast heuristic methods such as fasta   and blast [ 6 , 7 ] have been devised to reduce the computation time at the expense of sensitivity .
however , the exponential increase in the number of known sequences has increased the search time for querying against a database .
recently many core architectures , such as fpga [ 810 ] , cell / bes [ 1113 ] , and graphics processing units ( abbreviated to gpus ) [ 14 , 15 ] , have gradually become more popular in bioinformatics .
these new architectures make it possible to enhance the performance of sequence alignments by using the parallel computing technologies .
the potential advantage of gpu is its thousands of cores , with their total computing power exceeding the architecture with few cpus .
also nvidia released the compute unified device architecture ( abbreviated to cuda ) model to allow the programmers to use the commonly used programming languages , such as c / c++ , to develop the applications .
thus many efforts have been made to accelerate the sw computations by cuda on gpu . in 2008 ,
manavski and valle   presented the first sw algorithm by cuda for the protein database search on gpu .
the proposed algorithm was enhanced by the gsw algorithm proposed by striemer and akoglu   in 2009 .
ligowski and rudnicki   also presented another sw algorithm for the protein database search on gpu in 2009 .
liu et al . proposed cudasw++1.0   and cudasw++2.0   for protein database search in 2009 and 2010 , respectively . in cudasw++1.0 , they defined the intertask parallelization ( abbreviated to ite ) and intratask parallelization ( abbreviated to itr ) techniques for the relationships of task - thread and task - thread block on gpu , respectively . in general , the performance of the ite technique is better than that of the itr technique ; however the ite technique requires more memory space and then it is suitable for short sequences .
khajeh - saeed et al .   proposed a cuda - based sw algorithm ( abbreviated to cuda - ssca#1 ) by using the itr technique and multiple gpus in 2010 . in 2011 , hasan et al .  
proposed a gpu - based sw algorithm ( abbreviated to hka algorithm ) for the protein database search by using new sequence database organization and several optimizations to reduce the number of memory accesses .
developed new ite and itr kernels of sw algorithm for the protein database search in 2011 .
sandes and de melo proposed cudaling1.0   and cudaling2.0   for comparing two huge genomic sequences on gpu in 2010 and 2011 , respectively .
liu et al .   presented cudasw++3.0 in 2013 for the protein database search by coupling the cpu and gpu simd instructions and doing the cpu and gpu computations concurrently . with the development of next - generation sequencing ( ngs ) techniques
, the ngs machines can generate more than 1000 million nucleotide short reads ( dna , mrna , and small - rna ) of lengths around 30~50  bps or more in a single run . for several ngs applications , such as metagenomics
, these short reads will be assembled into possible contigs with lengths of tens to hundreds .
these contigs are then used to match several well - known databases , such as ncbi - nt database , in order to classify or filter out these contigs . for coding dna or mrna
short reads , they also can be translated to proteins for the proteomic research or be used for the analysis procedure of transcriptome .
now , several databases have more than hundreds of thousands protein ( or nucleotide ) sequences with lengths of tens to hundreds ( or hundreds to tens of thousands ) .
however , the previous works mentioned above are not suitable for the protein database search with a lot of database sequences .
one is that most of these works are suitable for short query and database sequences by using the ite technique .
the other is that these works all do the sw computations one by one ( seen as the brute force search ) , and the computation time will be large for comparing a query sequence with a lot of database sequences under the limited hardware resources .
therefore , it is important to provide new concepts and procedures for the protein database search problem
. there is a possible method to compare a query sequence with a lot of database sequences , called cuda - swf proposed by lee et al .   in 2013 .
cuda - swf used the frequency distance filtration scheme ( abbreviated to fdfs )   in the run - time to filter out the unnecessary alignments , and then the computation time by cuda - swf is improved up to 41% .
the fdfs in cuda - swf is to calculate the frequency vectors of query and database sequences on gpu at first ; then it calculates the frequency distance for each pair of query and database sequences , and after that the database sequences that need to be compared ( denoted as selected database sequences ) should be transferred from gpu to cpu .
finally , these selected database sequences are sorted according to their lengths and then retransferred from cpu to gpu in order to do the sw computations .
hence , the computation time by cuda - swf may be large for a lot of database sequences . in this paper
, we will propose an efficient sw alignment method , called cuda - swfr , for the protein database search by using the itr technique based on a cpu - gpu collaborative system . in order to avoid the unnecessary alignments ,
fdfs is also applied to cuda - swfr to enhance the computation performance . for most of bioapplications
, the used database can be predownloaded and preprocessed according to the application requirements . therefore
, the frequency vectors of database sequences can be precalculated and then stored in the database . before doing the sw computations on gpu
, fdfs is executed on cpu by calculating the frequency distances for each pair of frequency vectors from a query and database sequences .
after that , the query and selected database sequences are transferred from cpu to gpu .
the experimental results indicate that cuda - swfr runs 9.6 times and 96 times faster than the cpu - based sw method without and with fdfs , respectively .
these results indicated that cuda - swfr is suitable for the protein database search with a lot of database sequences .
section 2 briefly describes the background knowledge of cuda - swfr , including the sw algorithm , the cuda programming model , the frequency vector and frequency distance , and the related works of sw algorithm by cuda on gpu .  
section 3 then introduces cuda - swfr consisting of the implementations of fdfs on cpu and the sw computations on gpu .  
section 4 gives the experimental results to evaluate cuda - swfr without and with fdfs .
the sw algorithm is designed to identify the optimal local alignment between two sequences ( query and database sequences ) .
the sw computation needs a substitution matrix , such as a series of blosum   or pam   matrices , and a gap - penalty function , such as the constant gap penalty or the affine gap penalty .
the sw algorithm adopted in cuda - swfr is the same as that used in cuda - ssca#1   with the affine gap penalty . given two sequences s1 and s2 with lengths l1 and l2 , respectively , the sw algorithm computes the similarity score in an alignment matrix h(i , j ) of these two sequences ending at positions i and j of sequences s1 and s2 , respectively .
the alignment matrix h(i , j ) is computed according to ( 1)hi , j = maxmaxhi1,j1+sij,0max0<k < ihik , jgs+kgemax0<k < jhi , jkgs+kge , where 1  i  l1 , 1  j  l2 , and sij is the score in a substitution matrix , which is extracted according to a residue at position i in sequence s1 and another residue at position j in sequence s2 .
gs is the gap opening penalty , ge is the gap extension penalty , and k is the number of the extended gaps .
the maximum value of alignment matrix h(i , j ) indicates the similarity score between two sequences .
the dependency of calculating an alignment matrix h(i , j ) is shown in figure 1 . as mentioned in the literature , formula ( 1 )
is the native concept of the sw algorithm . in order to improve the sw computation ,
formula ( 2 ) is more suitable for the parallel computing and the details of sw algorithm can be found in the literature : ( 2)ei , j = maxei , j1,hi , j1gsge , fi , j = maxfi1,j , hi1,jgsge , hi , j = maxhi1,j1+sij , ei , j , fi , j,0 .
cuda is an extension of commonly used programming languages , such as c / c++ , in which users can write scalable multithreading programs for various applications . in general , the cuda program is implemented in two parts : host and device .
the host part is executed by cpu , and the device part is executed by gpu . the function executed on the device part is called a kernel .
the kernel can be invoked as a set of concurrently executing threads ( abbreviated to tds ) .
these tds are grouped into a hierarchical organization which can be combined into thread blocks ( abbreviated to tbs ) and grids ( abbreviated to gds ) .
a gd is a set of independent tbs , and a tb contains many tds .
the size of gd is the number of tbs per gd , and the size of tb is the number of tds per tb .
tds within a tb can communicate through a per - tb shared memory ( abbreviated to sm ) , whereas tds in the different tbs fail to communicate or synchronize directly .
besides sm , five memory types are per - td private local memory ( abbreviated to lm ) , global memory ( abbreviated to gm ) for data shared by all tbs , texture memory ( abbreviated to tm ) , constant memory ( abbreviated to cm ) , and registers ( abbreviated to rg ) . of these memory types ,
cm and tm can be regarded as fast read - only caches ; the fastest memories are the register and sm .
the gm , lm , tm , and cm are located on the gpu 's memory . besides sm accessed by a single tb and rg only accessed by a single td , the other memory types can be used by all tds .
the caches of tm and cm are limited to 8  kb per streaming multiprocessor ( abbreviated to sm ) . in the kepler architecture , sm
the cache of tm is designed for tds in order to improve the efficiency of memory access .
the fermi and kepler architectures have real configurable l1 per sm and unified l2 caches among sms .
hence , l2 caches can be accessed by gm and each sm can use the l1 caches and sm . the basic processing unit in nvidia 's gpu architecture
is called the streaming processor ( abbreviated to sp ) . in the fermi and kepler architectures ,
several sps can be integrated into a sm according to various architectures , such as 32 and 192 sps per sm for the fermi and kepler architectures , respectively . while the program runs the kernel , the device schedules tbs for the execution on the sm .
the single instruction multiple thread ( abbreviated to simt ) scheme refers to tds running on the sm in a small group of 32 , called a warp ( abbreviated to wp ) .
the frequency vector and frequency distance are proposed by kahveci et al .   in 2004 , and they are used to the whole genome alignment problem . in the literature ,
the frequency distance is also used to remove the sequences which are dissimilar between the query and subject sequences before performing the sequence alignment . in 2013 , lee et al .   used the frequency vector and frequency distance to remove the unnecessary sw alignments between the query and database sequences . assuming that a query or database sequence s is composed of n kinds of nucleotides / amino acids ( denoted as the alphabet set ) , the frequency vector ( abbreviated to fv ) of s is defined as follows:(3)fvs = fs=1,2,3,  ,n , where n represents the number of nth alphabets appearing in the sequence s. assume that there are two dna sequences u and v ; the frequency distance ( abbreviated to fd ) of these two sequences is defined as follows:(4)fdfu , fv = fufv = auav+tutv+gugv+cucv .
the fd is calculated from fvs of sequences u and v , which is the sum of differences for fvs of the alphabet set . for the biological sequences , the edit distance ( abbreviated to ed ) is a commonly used measurement to represent the difference between two sequences . in other words , a low edit distance means a high similarity score .
the relation between fd and ed for sequences u and v is listed as follows:(5)fdfu , fvedu , v . in several bioapplications , a threshold as a lower bound of similarity score
for example , in the homology modeling application , the similarity score should be larger than 35% between the template and target sequences .
moreover , in general , the sequence coverage ratio should be larger than 60% between the template and target sequences .
therefore , this threshold could be used as a factor to filter out unnecessary alignments between a query and database sequences . when we want to find the very similar sequences in a database for a query sequence , the value of ed is set to small .
if a fd of a pair of query and database sequences is larger than ed , it means that this database sequence may be not similar to the query sequence .
it is worth to note that a fd will be influenced by the sequence lengths between query and database sequences .
when the length of a database sequence is longer than that of query sequence , a fd of these two sequences may be large due to their length difference .
however , the possible subsequences in this database sequence may be similar to the query sequence .
hence , fdfs can not be applied to the database sequence with a length longer than that of the query sequence in order to avoid the possible false negatives .
recently , many works have been proposed in the past to implement the sw algorithm on gpu . in the following ,
the brief descriptions of selected works have been made by considering the implementations and performance . in 2006 , liu et al .  
proposed the hardware implementation of the double affine smith - waterman ( dasw ) algorithm on a graphics card by using graphic api ( opengl + glsl ) . by only computing alignment scores ,
dasw achieved 24  m ( millions or mega ) dp cells per second on single nvidia geforce 7800 gtx gpu card .
liu et al .   also presented an approach for the protein database scanning by using a graphics card ( opengl + glsl ) to gain a high performance at the low cost .
the proposed approach achieved more than 650  m cell updates per second ( abbreviated to cups ) on single nvidia geforce 7800 gtx gpu card .
moreover , it ran 9 times and 15 times faster than ssearch   and osearch , respectively .
the above works are both proposed based on gpu by opengl ( a gpgpu programming ) , not cuda .
the sw - cuda   precomputed a query profile stored in the tm to replace the query sequence and the substitution matrix . in sw - cuda , each td in a gd is used to do a sw computation by using the query profile and a database sequence .
hence , sw - cuda preordered the database sequences according to their lengths in order to balance the computing workload of each td in a tb .
the alignment matrix is computed column by column and the similarity score is stored in the lm .
the sw - cuda only calculated the similarity score for a sw computation and achieved 1830 mcups ( = 1.8 giga - cups ) and 3480 mcups ( = 3.48 gcups ) on single and dual - nvidia geforce 8800 gtx gpu cards , respectively , and it ran 2 to 30 times faster than any previous implementation of sw on gpu .
gsw algorithm   pointed out that the design of query profile is not suitable for gpu due to the limited size of tm on gpu .
they still used the query sequence and the substitution matrix both stored in the cm to do the sw computations by using the ite technique .
they also proposed an efficient function with an ascii code table to access the score in the substitution matrix .
the database sequences are stored in the gm and the similarity scores are stored in the sm .
the gsw algorithm ran 10 times faster than ssearch on single nvidia tesla c870 gpu card ; however , it is slower than farrar 's implementation .
another sw algorithm   by using the ite technique achieved 7.5 and 14.5 gcups on single and dual - nvidia geforce 9800 gtx gpu cards , respectively . in cudasw++1.0 ,
the ite technique means that each sw computation consisting of a pair of query and database sequences ( denoted as a task ) is assigned to one td ; the itr technique means a task is assigned to one tb . due to the limited memory on gpu ,
each td can only process a pair of short sequences in a tb with many tds by using the ite technique .
conversely , a pair of long sequences can be processed by a tb with many tds by using the itr technique .
however , the ite technique can achieve better performance than the itr technique due to more tasks concurrently executed on gpu .
the alignment matrix is computed according to the diagonal direction in cudasw++1.0 . for the ite technique
therefore , a preordered database is also used in cudasw++1.0 as the previous works above .
however , these preordered database sequences should be rearranged and then stored in the gm . in cudasw++1.0 , a threshold is set to 3072 for the length of database sequence .
if the length of database sequence is less than the threshold , the sw computation is done by the ite technique , otherwise by the itr technique .
cudasw++1.0 achieved an average performance of 9.5 gcups and 14.5 gcups on single nvidia geforce gtx 280 gpu card and dual - nvidia geforce gtx 295 gpu card , respectively .
however , the lengths of few sequences in the test swiss - prot protein database ( release 56.6 ) are larger than the threshold .
cudasw++2.0   further optimized the performance of cudasw++1.0 based on the simt abstraction of cuda - enabled gpus and achieved 17 gcups and 30 gcups on single nvidia geforce gtx 280 gpu card and dual - nvidia geforce gtx 295 gpu card , respectively .
cudasw++3.0   achieved the maximum performance of 119.0 and 185.6 gcups on single nvidia geforce gtx 680 gpu card and dual - gpu geforce gtx 690 gpu card , respectively .
the ssca#1 benchmark was used to evaluate 5 kernels that are various permutations of the sw algorithm , including saving the alignment results or not . in order to save the alignment result of a sw computation , cuda - ssca#1 needs to spend more memory space by using a traceback procedure .
the hka algorithm   processed the sw computations by using the ite technique and achieved 1.13 times better than cudasw++2.0 in terms of gcups .
hains et al . found that cudasw++1.0 only achieved 1.5 gcups when comparing the same query and database sequences on single nvidia tesla c1060 gpu card by using the itr technique .
the implementation of cuda - swfr can be divided into two parts : fdfs executed on cpu and the sw computations executed on gpu .
the details of these two parts are described in the following sections , respectively . in cuda - swfr
there are four steps in this procedure : ( 1 ) construct the preorder database sequences with fvs , ( 2 ) calculate the fv of query sequence , ( 3 ) calculate the fds for each pair of query and database sequences , and ( 4 ) collect the query and selected database sequences and then they are transferred from cpu to gpu . in the following ,
step 1 ( construct the preorder database sequences with fvs ) . in the previous works in section 2.4
, the database sequences should be preordered according to their lengths due to the ite technique .
however , the following calculation of fd will be influenced by the sequence lengths between the query and database sequences as mentioned in section 2.3 .
the database sequences are sorted and then stored in a database with their fvs in order to accelerate the computations of step 3 .
the computation time of this step is omitted in the experimental test as the previous works in section 2.4 . 
  in the previous works in section 2.4
, the database sequences should be preordered according to their lengths due to the ite technique .
however , the following calculation of fd will be influenced by the sequence lengths between the query and database sequences as mentioned in section 2.3 .
the database sequences are sorted and then stored in a database with their fvs in order to accelerate the computations of step 3 .
the computation time of this step is omitted in the experimental test as the previous works in section 2.4 . 

when the biologists want to use cuda - swfr for a query sequence , the fv of query sequence is calculated in the run - time by using formula ( 3 ) .
when the biologists want to use cuda - swfr for a query sequence , the fv of query sequence is calculated in the run - time by using formula ( 3 ) . moreover ,
step 3 ( calculate the fds for each pair of query and database sequences ) . as mentioned in section 2.3
, fdfs can not be applied to the database sequence with a length longer than that of the query sequence in order to avoid the possible false negative .
hence , when a database sequence has the length longer than that of the query sequence , it needs to be compared in the second part of cuda - swfr and it is not necessary to calculate the fd with the query sequence .
when the length of query sequence is short , this way will reduce a lot of time for step 3 .
however , when a database sequence has the length shorter than or equal to the query sequences , the fd should be calculated by using formula ( 4 ) with the query sequence . when the calculated fd is larger than a threshold of ed , this database sequence is not selected according to formula ( 5 ) .
one is the length of query sequence and the other is the threshold of ed .
when the length of query sequence is short , the lengths of most of database sequences may be longer than it , and the number of selected database sequences is large ; in other words , the effect of fdfs is small .
similarly , when the threshold of ed is set to large , the fds of most of database sequences may be smaller than this threshold , and then the effect of fdfs is small ; see the experimental results in section 4 . 
  as mentioned in section 2.3 ,
fdfs can not be applied to the database sequence with a length longer than that of the query sequence in order to avoid the possible false negative .
hence , when a database sequence has the length longer than that of the query sequence , it needs to be compared in the second part of cuda - swfr and it is not necessary to calculate the fd with the query sequence . when the length of query sequence is short , this way will reduce a lot of time for step 3 .
however , when a database sequence has the length shorter than or equal to the query sequences , the fd should be calculated by using formula ( 4 ) with the query sequence . when the calculated fd is larger than a threshold of ed , this database sequence is not selected according to formula ( 5 ) .
one is the length of query sequence and the other is the threshold of ed .
when the length of query sequence is short , the lengths of most of database sequences may be longer than it , and the number of selected database sequences is large ; in other words , the effect of fdfs is small .
similarly , when the threshold of ed is set to large , the fds of most of database sequences may be smaller than this threshold , and then the effect of fdfs is small ; see the experimental results in section 4 . 

step 4 ( collect the query and selected database sequences and then they are transferred from cpu to gpu ) . in this step , the fvs of query and selected database sequences and fds of a pair of query and selected database sequences are not needed to be transferred from cpu to gpu . by fdfs , the transmission data ( especially for the selected database sequences ) can be reduced , and then the transmission time is decreased according to two factors mentioned above .
one is to filter out the unnecessary alignments and the other is to reduce the transmission time .
moreover , the time by steps 3 and 4 can be overlapped with the time of sw computations executed on gpu .
after this step , the second part of cuda - swfr is used to do the sw computations on gpu . 
  in this step
, the fvs of query and selected database sequences and fds of a pair of query and selected database sequences are not needed to be transferred from cpu to gpu . by fdfs , the transmission data ( especially for the selected database sequences ) can be reduced , and then the transmission time is decreased according to two factors mentioned above
one is to filter out the unnecessary alignments and the other is to reduce the transmission time .
moreover , the time by steps 3 and 4 can be overlapped with the time of sw computations executed on gpu .
after this step , the second part of cuda - swfr is used to do the sw computations on gpu .
after the first part of cuda - swfr , the selected database sequences are stored in the gm and the query sequence is stored in the cm . when the length of query sequence is larger than the size of the cm , it is stored in the gm . in the fermi architecture , it may be fast to access the query sequence in the gm due to the l2 caches . in cuda - swfr ,
the sw computations are made by using the itr technique , and it means that the database sequences do not need to be rearranged before being stored in the gm . for the sw algorithm , a substitution matrix is needed .
hence , a substitution matrix is also stored in the cm . in order to access the score in a substitution matrix efficiently
, the function with an ascii code table presented by striemer and akoglu   is also used in cuda - swfr . by the itr technique , all tds in a tb
are used to do a sw computation ; it is a dynamic programming algorithm . according to the previous works and the simt scheme on gpus , there are eight implementation types of dynamic programming by using the itr technique on gpu .
these eight implementation types are synchronous row single thread ( srst ) , synchronous row multiple threads ( srmt ) , asynchronous row single thread ( arst ) , asynchronous row multiple threads ( armt ) , synchronous diagonal single thread ( sdst ) , synchronous diagonal multiple threads ( sdmt ) , asynchronous diagonal single thread ( adst ) , and asynchronous diagonal multiple threads ( admt ) .
cuda - swfr adopts the srmt type of dynamic programming to implement a sw computation by an assignment method , in which one row is assigned to a tb until all rows are assigned . for a sw computation in a tb , according to formulas ( 1 ) and ( 2 ) and the dependency shown in figure 1 , this process can be divided into two stages . in the first stage , the value of each cell ( h(i , j ) ) in a row is calculated according to the upper cell , upper - left cell and 0 .
assume that the length of a row is n and the number of tds in a tb is t ; the values of ( n / t ) cells are calculated by a td , where n is larger than t in general . however , these values are only intermediate values without considering the left cell according to formula ( 1 ) and ( 2 ) .
, only a td in a tb is used to correct the value of each cell in a row by considering its left cell .
these two stages will be done repeatedly until all rows are assigned to this tb .
the highest value among all cells in all rows is the similarity score for a query and a selected database sequence . for a query sequence ,
all of similarity scores or the best score will be copied from the sm to the gm , and then they could be transferred from gpu to cpu according to the user 's requirement . in cuda - swfr ,
the number of tds in a tb is set to 256 and the number of tbs in a gd is equal to the number of selected database sequences ( or partial of them in order to overlap the computation time between fdfs and sw computations ) .
the goal of this paper is to accelerate sw computations for the protein database search by using fdfs based on a cpu - gpu collaborative system . as the previous works [ 1619 ] in the past , the alignment quality is not the consideration in this work .
only similarity scores are calculated for each pair of query and database sequences by using the sw algorithm . the query and selected database sequences
can be aligned again by using other alignment algorithms or tools with specific substitution matrices in order to obtain the good alignment results or other simulation results , such as the homology modeling .
in this work , cuda - swfr is implemented by c+cuda on single nvidia tesla c2050 gpu card , with 448 sps cores and 3  gb gddr3 ram .
the host device is intel xeon e5506 cpu of 2.13  ghz with 12  gb ram running ubuntu 10.04 operation system . in order to evaluate the effect of fdfs in cuda - swfr ,
a test query sequence with a length of 1028 , np_001116291 , is a human protein sequence downloaded from the ncbi website ( http://www.ncbi.nlm.nih.gov/ ) .
three subsequences are extracted randomly from it with the lengths of 256 , 512 , and 768 , respectively .
these three subsequences and the original query sequence are used as the query sequences in the following tests .
based on these query sequences , 12 synthetic databases are generated and used in the experimental tests .
these 12 synthetic databases can be classified into 4 groups according to the lengths : 256 , 512 , 768 , and 1028 . for each group , there are three synthetic databases with 10000 , 20000 , and 40000 database sequences . for each database sequence in a group , it is generated according to the corresponding query sequence with the same length .
for each synthetic database , it has database sequences with 0%~100% mutations of its corresponding query sequence .
for example , assume that a synthetic database has 40000 database sequences and the length is 1028 .
there are 4000 database sequences with 0%~10% mutations of query sequence , 4000 database sequences with 10%~20% mutations of query sequence , and so on .
when we want to generate one database sequence with 0%~10% mutations of query sequence , a number t is randomly selected between 0 ( 1028  0% ) and 102 ( 1028  10% ) . if t is 57 , it means that 57 positions in the query sequence are randomly selected at first , and then the residues in these 57 positions are changed to others by adding a constant ( also randomly selected ) with its original ascii code .
this work is done repeatedly until 40000 database sequences are generated for this synthetic database . in the following tests ,
if a threshold is set to 90% , it means that the selected database sequence may be very similar to the query sequence . 

figure 3 shows the overall computation time ( unit : second ) by cuda - swfr with various thresholds for 12 synthetic databases . the threshold  none
 means the sw computations by cuda - swfr without fdfs . from figure 3 ,
the computation time decreases when the threshold increases for 12 synthetic databases . when the threshold is set to 90% , the computation time by cuda - swfr is fastest for all of 12 synthetic databases .
from figure 3 , it also shows that the computation time increases when the sequence length or the number of database sequences increases . in order to observe
the relationship between the threshold and the number of selected database sequences , figure 4 shows the ratio ( % ) by dividing the number of selected database sequences by the number of original database sequences for 12 synthetic databases with various thresholds . from figure 4 ,
the ratio decreases when the threshold increases for 12 synthetic databases . when the threshold is 90% , in figure 4 ,
only 10% database sequences are selected for the sw computations on gpu for 12 synthetic databases .
these results explain why the computation time by cuda - swfr is fastest when the threshold is set to 90% . from figure 4
, it also shows that the ratio is not influenced by the number of database sequences for 12 synthetic databases . besides , when the length of query sequence is equal to that of database sequences , the ratio is also not influenced by the sequence length for 12 synthetic databases .
however , the ratio will be influenced by the sequence length when the length of query sequence is not equal to that of database sequences . as mentioned in section 2.3 , when the length of database sequence is larger than that of query sequence , this database sequence should be compared with the query sequence . hence ,
when database sequences have various lengths , for a query sequence , the ratio will increase when the number of database sequences , each having a length larger than that of query sequence , increases . 

figure 5 shows the overall speedups by comparing cuda - swfr with the cpu - based sw method under various thresholds for 12 synthetic databases . from figure 5 ,
the best speedup by cuda - swfr with fdfs achieved 96 times . from figure 5 , the speedup increases when the threshold increases for 12 synthetic databases . from figure 5 , it also shows that the speedup is not influenced by the number of database sequences for 12 synthetic databases . besides , when the length of query sequence is equal to that of database sequences , the speedup is also not influenced by the sequence length for 12 synthetic databases .
the observations in figure 5 match those of figures 3 and 4 . unlike the previous works that use the gcups to evaluate the performance , cuda - swfr only considered the computation time and the speedups .
first , the overall computation workload ( dp cells ) by cuda - swfr is difficult to be estimated due to filtering out the unnecessary alignments by fdfs .
second , the overall computation time by cuda - swfr consisted of fv and fd calculations ( steps 2 and 3 in section 3.1 ) , sw computations ( section 3.2 ) , and transmission time ( step 4 in section 3.1 and section 3.2 ) .
cuda - swfr achieved the peak performance of 2.133 gcups by using the itr technique .
when the length of query sequence is less than the length of database sequences , figure 6 shows the overall speedup by comparing cuda - swfr with the cpu - based sw method for various combinations .
the query sequence of length 256 was used to compare with the synthetic database of lengths 512 , 768 , and 1028 , respectively ; the query sequence of length 512 was used to compare with the synthetic database of lengths 768 and 1028 , respectively ; the query sequence of length 768 was used to compare with the synthetic database of length 1028 .
since the length of database sequence is larger than that of query sequence , all of database sequences should be compared with the query sequence .
these results are similar to those ( 8.5~9.6 times ) by cuda - swfr without fdfs as shown in figure 3 . from figure 6 ,
the reason is that the overall computation workload increases when the length of database sequences increases . in this work
, we did not use the real biological sequences to evaluate the effect of fdfs .
the first one is the lengths of real biological sequences are various . in order to avoid the possible false negative , fdfs
can not be applied to the database sequence with a length longer than that of the query sequence .
hence , it is hard to choose the suitable set of real biological sequences and then to prove the relationships of ratio - threshold and ratio - speedup on gpu .
the second one is the range of similarity scores among real biological sequences is large . in practice
however , in the experimental tests , it is hard to choose the suitable set of real biological sequences to prove the relationships of threshold - speedup on gpu .
in this paper , we presented a gpu - based sw alignment method , cuda - swfr , with fdfs by using the itr technique .
the fdfs is executed by the cpu capability to filter out the unnecessary alignments and the sw computations are made by the gpu capability . from the experimental tests , cuda - swfr ran 9.6 times faster than the cpu - based sw method without fdfs ; it ran 96 times faster than the cpu - based sw method with fdfs .
the effect by fdfs is influenced greatly by the threshold . when the threshold as the sequence identity is large , the number of selected database sequences is small which means that the effect by fdfs is visible . in other words ,
, the effect by fdfs also could be influenced by the number of database sequences ; each has a length larger than that of query sequence .
cuda - swfr is suitable for the protein database search with a lot of database sequences , and the proposed fdfs can be integrated into other research works , such as huang et al .   and feng et al . , in recent years .
 the smith - waterman ( sw ) algorithm has been widely utilized for searching biological sequence databases in bioinformatics . recently , several works have adopted the graphic card with graphic processing units ( gpus ) and their associated cuda model to enhance the performance of sw computations . however , these works mainly focused on the protein database search by using the intertask parallelization technique , and only using the gpu capability to do the sw computations one by one . 
 hence , in this paper , we will propose an efficient sw alignment method , called cuda - swfr , for the protein database search by using the intratask parallelization technique based on a cpu - gpu collaborative system . before doing the sw computations on gpu 
 , a procedure is applied on cpu by using the frequency distance filtration scheme ( fdfs ) to eliminate the unnecessary alignments . 
 the experimental results indicate that cuda - swfr runs 9.6 times and 96 times faster than the cpu - based sw method without and with fdfs , respectively . 