Skip to content

Commit

Permalink
block size variable for comptimeprocs.jl
Browse files Browse the repository at this point in the history
  • Loading branch information
kdomino committed Jun 27, 2017
1 parent abaa0d0 commit b4fe726
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,8 @@ This script returns to a .jld file computional times, given folowing parameters:
* `-m (Int)`: cumulant's order, by default `m = 4`,
* `-n (Int)`: numbers of marginal variables, by default `m = 50`,
* `-t (Int)`: number of realistations of random variable, by defalut `t = 100000`,
* `-p (Int)`: maximal number of proceses, by default `p = 4`.
* `-p (Int)`: maximal number of proceses, by default `p = 4`,
* `-b (Int)`: blocks size, by default `b = 2`.

All result files are saved in /res directory. To plot a graph run /res/plotcomptimes.jl, with parameter
* `-f (String)`: file name without the .jld extension.
Expand Down
17 changes: 11 additions & 6 deletions test/comptimeproc.jl
Original file line number Diff line number Diff line change
Expand Up @@ -14,25 +14,25 @@ function comptime(data::Matrix{Float64}, ccalc::Function, m::Int, b::Int)
end


function comptimesonprocs(t::Int, n::Int, m::Int, p::Int)
function comptimesonprocs(t::Int, n::Int, m::Int, p::Int, b::Int)
data = randn(t, n)
times = zeros(p)
for i in 1:p
addprocs(i)
println("number of workers = ", nworkers())
@everywhere using Cumulants
times[i] = comptime(data, moment, m, 3)
times[i] = comptime(data, moment, m, b)
rmprocs(workers())
end
times
end


function savect(t::Int, n::Int, m::Int, maxprocs::Int)
function savect(t::Int, n::Int, m::Int, maxprocs::Int, b::Int)
comptimes = zeros(maxprocs)
comptimes = comptimesonprocs(t,n,m,maxprocs)
comptimes = comptimesonprocs(t,n,m,maxprocs, b)
onec = fill(comptimes[1], maxprocs)
filename = replace("res/$(m)_$(t)_$(n)_nprocs.jld", "[", "")
filename = replace("res/$(m)_$(t)_$(n)_$(b)_nprocs.jld", "[", "")
filename = replace(filename, "]", "")
compt = Dict{String, Any}("cumulants"=> onec, "cumulantsnc"=> comptimes)
push!(compt, "t" => [t])
Expand Down Expand Up @@ -65,13 +65,18 @@ function main(args)
help = "maximal number of procs"
default = 4
arg_type = Int
"--blocksize", "-b"
help = "set a block size"
default = 2
arg_type = Int
end
parsed_args = parse_args(s)
m = parsed_args["order"]
n = parsed_args["nvar"]
t = parsed_args["dats"]
p = parsed_args["maxprocs"]
savect(t::Int, n::Int, m::Int, p::Int)
b = parsed_args["blocksize"]
savect(t::Int, n::Int, m::Int, p::Int, b::Int)
end

main(ARGS)

0 comments on commit b4fe726

Please sign in to comment.