将sw动态开辟内存改成静态数组
This commit is contained in:
parent
3f06d433e7
commit
b58cc1f574
|
|
@ -196,6 +196,8 @@ static const uint16_t h_vec_int_mask[SIMD_WIDTH][SIMD_WIDTH] = {
|
|||
mA1 = mA2; \
|
||||
mA2 = tmp;
|
||||
|
||||
uint8_t mem[102400];
|
||||
|
||||
int bsw_avx2(int qlen, // query length 待匹配段碱基的query长度
|
||||
const uint8_t *query, // read碱基序列
|
||||
int tlen, // target length reference的长度
|
||||
|
|
@ -221,7 +223,7 @@ int bsw_avx2(int qlen, // query length 待匹配段碱基的query
|
|||
{
|
||||
int16_t *mA, *hA, *eA, *fA, *mA1, *mA2, *hA0, *hA1, *eA1, *fA1, *hA2, *eA2, *fA2; // hA0保存上上个col的H,其他的保存上个H E F M
|
||||
int16_t *seq, *ref;
|
||||
uint8_t *mem;
|
||||
// uint8_t *mem;
|
||||
int16_t *qtmem, *vmem;
|
||||
int seq_size = qlen + SIMD_WIDTH, ref_size = tlen + SIMD_WIDTH;
|
||||
int i, iStart, D, j, k, beg, end, max, max_i, max_j, max_ins, max_del, max_ie, gscore, max_off;
|
||||
|
|
@ -237,7 +239,7 @@ int bsw_avx2(int qlen, // query length 待匹配段碱基的query
|
|||
assert(h0 > 0);
|
||||
|
||||
// allocate memory
|
||||
mem = malloc(mem_size);
|
||||
// mem = malloc(mem_size);
|
||||
qtmem = (int16_t *)&mem[0];
|
||||
seq = &qtmem[0];
|
||||
ref = &qtmem[seq_size];
|
||||
|
|
@ -534,7 +536,7 @@ int bsw_avx2(int qlen, // query length 待匹配段碱基的query
|
|||
// }
|
||||
// }
|
||||
|
||||
free(mem);
|
||||
// free(mem);
|
||||
if (_qle)
|
||||
*_qle = max_j + 1;
|
||||
if (_tle)
|
||||
|
|
|
|||
|
|
@ -213,6 +213,8 @@ static const uint8_t reverse_mask[SIMD_WIDTH] = {7, 6, 5, 4, 3, 2, 1, 0, 15, 14,
|
|||
mA1 = mA2; \
|
||||
mA2 = tmp;
|
||||
|
||||
uint8_t mem1[102400];
|
||||
|
||||
int ksw_avx2_u8(int qlen, // query length 待匹配段碱基的query长度
|
||||
const uint8_t *query, // read碱基序列
|
||||
int tlen, // target length reference的长度
|
||||
|
|
@ -247,7 +249,7 @@ int ksw_avx2_u8(int qlen, // query length 待匹配段碱基的que
|
|||
#endif
|
||||
uint8_t *mA, *hA, *eA, *fA, *mA1, *mA2, *hA0, *hA1, *eA1, *fA1, *hA2, *eA2, *fA2; // hA0保存上上个col的H,其他的保存上个H E F M
|
||||
uint8_t *seq, *ref;
|
||||
uint8_t *mem, *qtmem, *vmem;
|
||||
uint8_t *mem = &mem1[0], *qtmem, *vmem;
|
||||
int seq_size = qlen + SIMD_WIDTH, ref_size = tlen + SIMD_WIDTH;
|
||||
int i, iStart, D, j, k, beg, end, max, max_i, max_j, max_ins, max_del, max_ie, gscore, max_off;
|
||||
int Dloop = tlen + qlen; // 循环跳出条件
|
||||
|
|
@ -261,7 +263,7 @@ int ksw_avx2_u8(int qlen, // query length 待匹配段碱基的que
|
|||
assert(h0 > 0);
|
||||
|
||||
// allocate memory
|
||||
mem = malloc(mem_size);
|
||||
// mem = malloc(mem_size);
|
||||
qtmem = &mem[0];
|
||||
seq = (uint8_t *)&qtmem[0];
|
||||
ref = (uint8_t *)&qtmem[seq_size];
|
||||
|
|
@ -488,7 +490,7 @@ int ksw_avx2_u8(int qlen, // query length 待匹配段碱基的que
|
|||
#endif
|
||||
}
|
||||
|
||||
free(mem);
|
||||
// free(mem);
|
||||
if (_qle)
|
||||
*_qle = max_j + 1;
|
||||
if (_tle)
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ typedef struct
|
|||
|
||||
int ksw_normal(int qlen, const uint8_t *query, int tlen, const uint8_t *target, int m, const int8_t *mat, int o_del, int e_del, int o_ins, int e_ins, int w, int end_bonus, int zdrop, int h0, int *_qle, int *_tle, int *_gtle, int *_gscore, int *_max_off)
|
||||
{
|
||||
return h0;
|
||||
// return h0;
|
||||
eh_t *eh; // score array
|
||||
int8_t *qp; // query profile
|
||||
int i, j, k, oe_del = o_del + e_del, oe_ins = o_ins + e_ins, beg, end, max, max_i, max_j, max_ins, max_del, max_ie, gscore, max_off;
|
||||
|
|
|
|||
12
main.c
12
main.c
|
|
@ -130,12 +130,12 @@ int main(int argc, char *argv[])
|
|||
// const char *qf_path = "/home/zzh/data/sw/q_m.fa";
|
||||
// const char *tf_path = "/home/zzh/data/sw/t_m.fa";
|
||||
// const char *if_path = "/home/zzh/data/sw/i_m.txt";
|
||||
const char *qf_path = "/home/zzh/data/sw/q_l.fa";
|
||||
const char *tf_path = "/home/zzh/data/sw/t_l.fa";
|
||||
const char *if_path = "/home/zzh/data/sw/i_l.txt";
|
||||
// const char *qf_path = "/public/home/zzh/data/sw/query.fa";
|
||||
// const char *tf_path = "/public/home/zzh/data/sw/target.fa";
|
||||
// const char *if_path = "/public/home/zzh/data/sw/info.txt";
|
||||
// const char *qf_path = "/home/zzh/data/sw/q_l.fa";
|
||||
// const char *tf_path = "/home/zzh/data/sw/t_l.fa";
|
||||
// const char *if_path = "/home/zzh/data/sw/i_l.txt";
|
||||
const char *qf_path = "/home/zzh/data/sw/query.fa";
|
||||
const char *tf_path = "/home/zzh/data/sw/target.fa";
|
||||
const char *if_path = "/home/zzh/data/sw/info.txt";
|
||||
query_f = fopen(qf_path, "r");
|
||||
target_f = fopen(tf_path, "r");
|
||||
info_f = fopen(if_path, "r");
|
||||
|
|
|
|||
Loading…
Reference in New Issue