Skip to content

Commit

Permalink
changed comptime* to print parameters during computation and plotcomp…
Browse files Browse the repository at this point in the history
…times.jl to take file with extention
  • Loading branch information
kdomino committed Jun 26, 2017
1 parent e9aae75 commit abaa0d0
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 6 deletions.
7 changes: 5 additions & 2 deletions test/comptimeblocks.jl
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,13 @@ end
function savect(t::Vector{Int}, n::Int, m::Int)
maxb = round(Int, sqrt(n))
comptimes = zeros(maxb-1, length(t))
println("max block size = ", maxb)
for k in 1:length(t)
data = randn(t[k], n)
for i in 2:maxb
comptimes[i-1, k] = comptime(data, cumulants, m, i)
for b in 2:maxb
comptimes[b-1, k] = comptime(data, cumulants, m, b)
println("n = ", n)
println("bloks size = ", b)
end
end
filename = replace("res/$(m)_$(t)_$(n)_nblocks.jld", "[", "")
Expand Down
2 changes: 1 addition & 1 deletion test/comptimeproc.jl
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ function comptimesonprocs(t::Int, n::Int, m::Int, p::Int)
times = zeros(p)
for i in 1:p
addprocs(i)
println(nworkers())
println("number of workers = ", nworkers())
@everywhere using Cumulants
times[i] = comptime(data, moment, m, 3)
rmprocs(workers())
Expand Down
9 changes: 8 additions & 1 deletion test/comptimes.jl
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ function comtimes(m::Int, t::Vector{Int}, n::Vector{Int}, f::Function)
for i in 1:length(t)
for j in 1:length(n)
data = randn(t[i], n[j])
println("n = ", n[j])
println("t = ", t[i])
compt[j,i] = comptime(data, f, m)
end
end
Expand All @@ -46,7 +48,12 @@ function savecomptime(m::Int, t::Vector{Int}, n::Vector{Int})
filename = replace("res/"*string(m)*string(t)*string(n)*".jld", "[", "_")
filename = replace(filename, "]", "")
fs = [moment, naivemoment, cumulants, naivecumulant]
compt = Dict{String, Any}("$f"[11:end] => comtimes(m, t, n, f) for f in fs)
compt = Dict{String, Any}()
for f in fs
fname = "$f"[11:end]
println("called function " , fname)
push!(compt, fname => comtimes(m, t, n, f))
end
push!(compt, "t" => t)
push!(compt, "n" => n)
push!(compt, "m" => m)
Expand Down
5 changes: 3 additions & 2 deletions test/res/plotcomptimes.jl
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ Returns a figure in .eps format of the computional speedup of cumulants function
"""

function pltspeedup(filename::String)
d = load(filename*".jld")
d = load(filename)
filename = replace(filename, ".jld", "")
for f in d["functions"]
singleplot(filename::String, f...)
end
Expand All @@ -52,7 +53,7 @@ function main(args)
s = ArgParseSettings("description")
@add_arg_table s begin
"--file", "-f"
help = "the file name without .jld extension"
help = "the file name"
arg_type = String
end
parsed_args = parse_args(s)
Expand Down

0 comments on commit abaa0d0

Please sign in to comment.