diff --git a/Overlaps.cpp b/Overlaps.cpp index 3e60236..ad96ceb 100644 --- a/Overlaps.cpp +++ b/Overlaps.cpp @@ -3101,10 +3101,7 @@ typedef struct { long long n_read; uint64_t *readLen; ma_sub_t *coverage_cut; - int *counter; // per thread counter - uint32_t **buf_u32_q; // per thread linear buffers - uint32_t **buf_u32_t; - int* buf_u32_n; int* buf_u32_m; + int counter; // NOTE this might RACE during update, but it's an output and not used elsewhere }hitcontain_aux_t; static void hamt_hit_contained_drop_singleton_worker(void *data, long i_r, int tid){ // callback for kt_for() @@ -3425,15 +3422,15 @@ static void hamt_hit_contained_drop_singleton_worker_v2(void *data, long i_r, in __func__, (int)Get_NAME_LENGTH(R_INF, w), Get_NAME(R_INF, w)); } need_to_protect = 0; - // note: do not go to finish yet, we still need to check other neighbors and see if any of them ask for protection. - }else{ - if (verbose>1){ - fprintf(stderr, "[debug::%s] ~ neighbor %.*s hinted more haps\n", - __func__, (int)Get_NAME_LENGTH(R_INF, w), Get_NAME(R_INF, w)); - } - need_to_protect = 1; goto finish; } + + if (verbose>1){ + fprintf(stderr, "[debug::%s] ~ neighbor %.*s hinted more haps\n", + __func__, (int)Get_NAME_LENGTH(R_INF, w), Get_NAME(R_INF, w)); + } + need_to_protect = 1; + goto finish; }else{ if (verbose>1){ fprintf(stderr, "[debug::%s] ~ neighbor %.*s ok\n", @@ -3457,17 +3454,10 @@ static void hamt_hit_contained_drop_singleton_worker_v2(void *data, long i_r, in (int)Get_NAME_LENGTH(R_INF, hits[i]->tn), Get_NAME(R_INF, hits[i]->tn)); } } - d->counter[tid]++; - for (i=0; itn); - if (d->buf_u32_n[tid]>=d->buf_u32_m[tid]){ - d->buf_u32_m[tid] = d->buf_u32_m[tid] + (d->buf_u32_m[tid]>>1); - d->buf_u32_q[tid] = (uint32_t*)realloc(d->buf_u32_q[tid], sizeof(uint32_t)*d->buf_u32_m[tid]); - d->buf_u32_t[tid] = (uint32_t*)realloc(d->buf_u32_t[tid], sizeof(uint32_t)*d->buf_u32_m[tid]); - } - d->buf_u32_q[tid][d->buf_u32_n[tid]] = (uint32_t)i_r; - d->buf_u32_t[tid][d->buf_u32_n[tid]] = (uint32_t)(hits[i]->tn); - d->buf_u32_n[tid]++; + d->counter++; + for (i=0; idel = 1; + delete_single_edge_both_dir(sources, coverage_cut, (uint32_t)i_r, hits[i]->tn); } }else if (need_to_protect==0){ @@ -3677,7 +3667,7 @@ static void hamt_hit_contained_worker(void *data, long i_r, int tid){ // callba sprintf(tmp_msg, "[debug::%s] (there were %d contained reads)\n", __func__, (int)IDs_contained.n); hamt_dbgmsg_append(&msg, tmp_msg, strlen(tmp_msg)); } - d->counter[tid]++; + d->counter++; finish: kv_destroy(buf); @@ -3713,18 +3703,13 @@ void hamt_hit_contained_multi(ma_hit_t_alloc* sources, ma_hit_t_alloc* reverse_s aux.n_read = n_read; aux.readLen = readLen; aux.coverage_cut = coverage_cut; - aux.counter = (int*)calloc(asm_opt.thread_num, sizeof(int)); + aux.counter = 0; kt_for(asm_opt.thread_num, hamt_hit_contained_worker, &aux, (long)n_read); - int total = 0; - for (int i=0; i