Skip to content

Commit

Permalink
Refactor input (#7)
Browse files Browse the repository at this point in the history
* fixing package versions

* testing if removing cache helps

* adding messages to find github actions bug

* locating error

* perhaps coercion issue

* seeing if function finishes

* fixing divide by zero for single core

* fixing divide by zero for single core and start at 1
  • Loading branch information
jw2249a authored May 6, 2024
1 parent 25cf63f commit d4cba8e
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 11 deletions.
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

0 comments on commit d4cba8e

Please sign in to comment.