Skip to content

Commit

Permalink
modified: Julia/memory_usage.jl
Browse files Browse the repository at this point in the history
  • Loading branch information
jvo203 committed Feb 17, 2022
1 parent c2db1c0 commit ba6a76d
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 2 deletions.
23 changes: 23 additions & 0 deletions Julia/julia_comparison.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
using CSV
using DataFrames
using Plots

data_r = CSV.read(homedir() * "/memory_usage_rust.csv", DataFrame)
data_f = CSV.read(homedir() * "/memory_usage_fortran.csv", DataFrame)
data_j = CSV.read(homedir() * "/memory_usage_worker.csv", DataFrame)

timestamp_r = data_r[:, 1]
allocated_r = data_r[:, 2] ./ (1024^3)

timestamp_f = data_f[:, 1]
allocated_f = data_f[:, 2] ./ (1024^3)

timestamp_j = data_j[:, 1]
allocated_j = 4 * data_j[:, 2] ./ (1024^2) # kB unit

common = min(size(timestamp_r)[1], size(timestamp_f)[1], size(timestamp_j)[1])

plot(timestamp_f[1:common], [allocated_r[1:common], allocated_f[1:common], allocated_j[1:common]], label = ["Rust fits_web_ql v4" "C / FORTRAN FITSWEBQLSE v5" "Julia FITSWEBQLSE v5"], xlabel = "elapsed time [s]", ylabel = "allocated memory [GB]", legend = :bottomright, title = "memory consumption comparison")
# plot(timestamp_j, [allocated_r, allocated_f, allocated_j], label = ["Rust fits_web_ql v4" "C / FORTRAN FITSWEBQLSE v5" "Julia FITSWEBQLSE v5"], xlabel = "elapsed time [s]", ylabel = "allocated memory [GB]", legend = :bottomright, title = "memory consumption comparison")

savefig(homedir() * "/julia_mem_comparison.pdf")
6 changes: 4 additions & 2 deletions Julia/memory_usage.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ data = CSV.read("memory_usage.csv", DataFrame)
println(data[1:5, :])

timestamp = data[:, 1]
allocated = data[:, 2] ./ (1024^3)
allocated = 4 * data[:, 2] ./ (1024^2) # kB for rss, bytes otherwise (Rust and FORTRAN)

# plot(timestamp, allocated, label = "jemalloc stats.allocated memory [GB]", xlabel = "elapsed time [s]", ylabel = "memory [GB]", legend = :bottomright, title = "memory consumption")
plot(timestamp, allocated, label = "allocated memory [GB]", xlabel = "elapsed time [s]", ylabel = "memory [GB]", legend = :bottomright, title = "Julia memory consumption")

plot(timestamp, allocated, label = "jemalloc stats.allocated memory [GB]", xlabel = "elapsed time [s]", ylabel = "memory [GB]", legend = :bottomright, title = "memory consumption")
savefig(homedir() * "/mem_allocated_v5.pdf")

0 comments on commit ba6a76d

Please sign in to comment.