Skip to content

Commit

Permalink
fixing indexing batches
Browse files Browse the repository at this point in the history
  • Loading branch information
jw2249a committed Mar 7, 2024
1 parent 0d5ba4e commit e64c130
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
Empty file added .dir-locals.el
Empty file.
9 changes: 4 additions & 5 deletions src/matchPatterns.jl
Original file line number Diff line number Diff line change
Expand Up @@ -24,23 +24,22 @@ end

function indices_to_uids(vecA, vecB,
indices::Vector{Vector{ComparisonIndex}}
)
)
batch_size=500
inds=eachindex(indices)
paired_ids = [Vector{Tuple}() for _ in inds]
Threads.@threads for i in inds
len=length(indices[i])
lk = ReentrantLock()
Threads.@threads for first_val in 1:500:len
Threads.@threads for first_val in 1:batch_size:len
local_paired_ids=Vector{Tuple}()
last_val = first_val + min(len-first_val,500-first_val)
last_val = min(first_val + batch_size - 1, len)
for ii in first_val:last_val
push!(local_paired_ids,(vecA[indices[i][ii].row],vecB[indices[i][ii].col]))
end

lock(lk) do
append!(paired_ids[i],local_paired_ids)
end

end
end
return paired_ids
Expand Down

0 comments on commit e64c130

Please sign in to comment.