-
Notifications
You must be signed in to change notification settings - Fork 8
Open
Description
I found that there exists a memory leak when using fix_vertices function, in the following MWE, the memory usage of the process will grow monotonically until it is killed.
I use the htop tool to check the memory usage, I would be glad to do more tests if you guys know better way to record the memory usage.
using KaHyPar, Graphs, SparseArrays
function edge2vertex(g::SimpleGraph)
I = Int[]
J = Int[]
edgecount = 0
@inbounds for i in 1:nv(g)-1, j in g.fadjlist[i]
if j > i
edgecount += 1
push!(I, i)
push!(I, j)
push!(J, edgecount)
push!(J, edgecount)
end
end
return sparse(I, J, ones(length(I)))
end
function select_region(g, i, n)
h = KaHyPar.HyperGraph(edge2vertex(g))
imbalance = 1 - 2 * n / nv(g)
local fix_vs = [j == i ? 1 : -1 for j in 1:nv(g)]
KaHyPar.fix_vertices(h, 2, fix_vs)
KaHyPar.set_target_block_weights(h, [nv(g) - n, n])
parts = KaHyPar.partition(h, 2)
return findall(!iszero, parts)
end
g = random_regular_graph(1000, 3)
while true
for i in 1:1000
select_region(g, i, 15)
end
end
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels