You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
GraphNeuralNetworks.batch scales quadratically in run time and memory use with the number of graphs to batch. Here is a MWE with benchmarks:
using BenchmarkTools
using GraphNeuralNetworks
g1 =rand_graph(4, 6, ndata=ones(8, 4));
g2 =rand_graph(7, 4, ndata=zeros(8, 7));
GraphNeuralNetworks.batch([g1, g2]);
for ngraphs in2.^ (8:10)
gs = [rand_graph(4, 6, ndata=ones(8, 4)) for _ in1:ngraphs]
println("\n=======================\nBatchsize = $ngraphs graphs\n=======================\n")
b =@benchmark GraphNeuralNetworks.batch($gs)
display(b)
end=======================
Batchsize =256 graphs
=======================
BenchmarkTools.Trial:1532 samples with 1 evaluation.
Range (min … max):2.583 ms …6.482 ms ┊ GC (min … max):0.00%…54.02%
Time (median):2.712 ms ┊ GC (median):0.00%
Time (mean ± σ):3.260 ms ±1.278 ms ┊ GC (mean ± σ):16.20%±19.62%
▄█▂▁
████▃▂▂▁▁▁▁▂▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▃▄▄▄▃ ▂
2.58 ms Histogram: frequency by time 6.33 ms <
Memory estimate:13.08 MiB, allocs estimate:17790.=======================
Batchsize =512 graphs
=======================
BenchmarkTools.Trial:510 samples with 1 evaluation.
Range (min … max):8.219 ms …11.230 ms ┊ GC (min … max):0.00%…21.96%
Time (median):10.632 ms ┊ GC (median):20.63%
Time (mean ± σ):9.790 ms ±1.241 ms ┊ GC (mean ± σ):13.99%±10.61%
▁█ ▁▂▁
███▆▄▂▂▁▁▁▁▁▁▂▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▂▄▆▆▄▄▆███▅▄ ▃
8.22 ms Histogram: frequency by time 11.1 ms <
Memory estimate:50.14 MiB, allocs estimate:36053.=======================
Batchsize =1024 graphs
=======================
BenchmarkTools.Trial:150 samples with 1 evaluation.
Range (min … max):32.179 ms …37.269 ms ┊ GC (min … max):11.89%…16.35%
Time (median):32.532 ms ┊ GC (median):12.07%
Time (mean ± σ):33.527 ms ±1.463 ms ┊ GC (mean ± σ):12.63%±1.19%
▃█▇▆
████▅▄▅▃▃▃▃▁▁▁▁▃▃▁▁▁▁▁▃▃▃▁▃▃▁▃▄▃▆▃▅▃▄▃▃▄▅▃▃▁▁▄▁▃▁▁▃▁▁▁▃▃▃▁▃ ▃
32.2 ms Histogram: frequency by time 37 ms <
Memory estimate:196.20 MiB, allocs estimate:73941.
GraphNeuralNetworks.batch
scales quadratically in run time and memory use with the number of graphs to batch. Here is a MWE with benchmarks:I came up with a fix to the current implementation and will submit a PR soon.
The text was updated successfully, but these errors were encountered: