Skip to content

Commit

Permalink
fixed smem memory rellocation issue (issue167)
Browse files Browse the repository at this point in the history
  • Loading branch information
yuk12 committed Dec 13, 2021
1 parent 966cd1e commit edc703f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions src/bwamem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -924,13 +924,13 @@ int mem_kernel1_core(FMI_search *fmi,
for (i = 0; i < len; ++i)
seq[i] = seq[i] < 4? seq[i] : nst_nt4_table[(int)seq[i]]; //nst_nt4??
}

tot_len *= N_SMEM_KERNEL;
// This covers enc_qdb/SMEM reallocs
if (tot_len >= mmc->wsize_mem[tid])
{
fprintf(stderr, "[%0.4d] Re-allocating SMEM data structures due to enc_qdb\n", tid);
int64_t tmp = mmc->wsize_mem[tid];
mmc->wsize_mem[tid] *= 2;
mmc->wsize_mem[tid] = tot_len;
mmc->matchArray[tid] = (SMEM *) _mm_realloc(mmc->matchArray[tid],
tmp, mmc->wsize_mem[tid], sizeof(SMEM));
//realloc(mmc->matchArray[tid], mmc->wsize_mem[tid] * sizeof(SMEM));
Expand Down Expand Up @@ -966,8 +966,8 @@ int mem_kernel1_core(FMI_search *fmi,
num_smem);

if (num_smem >= *wsize_mem){
fprintf(stderr, "num_smem: %ld\n", num_smem);
assert(num_smem < *wsize_mem);
fprintf(stderr, "Error [bug]: num_smem: %ld are more than allocated space.\n", num_smem);
exit(EXIT_FAILURE);
}
printf_(VER, "6. Done! mem_collect_smem, num_smem: %ld\n", num_smem);
tprof[MEM_COLLECT][tid] += __rdtsc() - tim;
Expand Down
2 changes: 1 addition & 1 deletion src/macro.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ Authors: Vasimuddin Md <vasimuddin.md@intel.com>; Sanchit Misra <sanchit.misra@i
#define BATCH_SIZE 512 /* Block of reads alloacted to a thread for processing*/
#define BATCH_MUL 20
#define SEEDS_PER_CHAIN 1

#define N_SMEM_KERNEL 3
#define READ_LEN 151

#define SEQ_LEN8 128 // redundant??
Expand Down

0 comments on commit edc703f

Please sign in to comment.