Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor input #7

Merged
merged 10 commits into from
May 6, 2024
26 changes: 15 additions & 11 deletions src/gammas/gammaNUMCKpar.jl
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,10 @@ Numeric comparison of two columns
- `cut_a::Number=1`: Lower bound for close string distances.
- `cut_b::Number=2`: Lower bound for partial string distances.
"""
function gammaNUMCKpar!(vecA, vecB,
function gammaNUMCKpar!(vecA::Vector, vecB::Vector,
results::DiBitMatrix;
cut_a=1,cut_b=2,
partial::Bool=true)

N_a = length(vecA)
N_b = length(vecB)

Expand Down Expand Up @@ -72,16 +71,21 @@ function gammaNUMCKpar!(vecA, vecB,

# preallocation of ranges for the threads
tids = Threads.nthreads()
breaksize= len ÷ (tids-1)
starts = (collect(0:(tids-1))) .* breaksize .+ 1
ends = starts[:]
if last(starts) == len
pop!(starts)
popfirst!(ends)
else
ends = append!(starts[:], [len])
popfirst!(ends)
starts = [1]
ends = [len]
if tids > 1
breaksize = len ÷ (tids-1)
starts = (collect(0:(tids-1))) .* breaksize .+ 1
ends = starts[:]
if last(starts) == len
pop!(starts)
popfirst!(ends)
else
ends = append!(starts[:], [len])
popfirst!(ends)
end
end

tids=length(starts)

Threads.@threads for tid in 1:tids
Expand Down
2 changes: 2 additions & 0 deletions src/patterns.jl
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,9 @@ end

function match_and_link(patterns::Vector{DiBitMatrix}, e::Dict{String, Any}, _dims::Tuple{Int64,Int64},
final_name::String)
@info "getting match patterns"
counts=get_match_patterns(patterns)
@info "running emlink"
resultsEM=emlinkMARmov(counts.patterns,
length.(counts.indices),
_dims,
Expand Down
Loading