Skip to content

Commit

Permalink
quiet changes
Browse files Browse the repository at this point in the history
  • Loading branch information
montyvesselinov committed Aug 2, 2024
1 parent 2672688 commit 0d4acb4
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 14 deletions.
4 changes: 2 additions & 2 deletions src/MadsBlindSourceSeparation.jl
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ Returns:
- NMF results
"""
function NMFipopt(X::AbstractMatrix, nk::Integer, retries::Integer=1; random::Bool=false, maxiter::Integer=100000, maxguess::Number=1, initW::AbstractMatrix=Array{Float64}(undef, 0, 0), initH::AbstractMatrix=Array{Float64}(undef, 0, 0), verbosity::Integer=0, quiet::Bool=false)
function NMFipopt(X::AbstractMatrix, nk::Integer, retries::Integer=1; random::Bool=false, maxiter::Integer=100000, maxguess::Number=1, initW::AbstractMatrix=Array{Float64}(undef, 0, 0), initH::AbstractMatrix=Array{Float64}(undef, 0, 0), verbosity::Integer=0, quiet::Bool=Mads.quiet)
Xc = copy(X)
weights = ones(size(Xc))
nans = isnan.(Xc)
Expand Down Expand Up @@ -133,7 +133,7 @@ Returns:
- NMF results
"""
function MFlm(X::AbstractMatrix{T}, nk::Integer; method::Symbol=:mads, log_W::Bool=false, log_H::Bool=false, retries::Integer=1, initW::AbstractMatrix=Array{T}(undef, 0, 0), initH::AbstractMatrix=Array{T}(undef, 0, 0), tolX::Number=1e-4, tolG::Number=1e-6, tolOF::Number=1e-3, tolOFcount::Integer=5, minOF::Number=1e-3, maxEval::Integer=1000, maxIter::Integer=100, maxJacobians::Integer=100, lambda::Number=100.0, lambda_mu::Number=10.0, np_lambda::Integer=10, show_trace::Bool=false, quiet::Bool=true) where {T <: Number}
function MFlm(X::AbstractMatrix{T}, nk::Integer; method::Symbol=:mads, log_W::Bool=false, log_H::Bool=false, retries::Integer=1, initW::AbstractMatrix=Array{T}(undef, 0, 0), initH::AbstractMatrix=Array{T}(undef, 0, 0), tolX::Number=1e-4, tolG::Number=1e-6, tolOF::Number=1e-3, tolOFcount::Integer=5, minOF::Number=1e-3, maxEval::Integer=1000, maxIter::Integer=100, maxJacobians::Integer=100, lambda::Number=100.0, lambda_mu::Number=10.0, np_lambda::Integer=10, show_trace::Bool=false, quiet::Bool=Mads.quiet) where {T <: Number}
nP = size(X, 1) # number of observation points
nC = size(X, 2) # number of observed components/transients
Wbest = Array{T}(undef, nP, nk)
Expand Down
14 changes: 7 additions & 7 deletions src/MadsFunc.jl
Original file line number Diff line number Diff line change
Expand Up @@ -105,19 +105,19 @@ function makemadscommandfunction(madsdata_in::AbstractDict; obskeys::AbstractVec
madscritical("Julia function $(fn) is not defined!")
end
end
madsinfo("""Model setup: Julia function -> Internal model evaluation of Julia function '$(madsdata["Julia function"])'""")
madsinfo("""Model setup: Julia function -> Internal model evaluation of Julia function '$(madsdata["Julia function"])'""", 2)
"MADS command function based on a Julia function '$(madsdata["Julia function"])'"
function madscommandfunctionvector(parameters::AbstractDict)
o = jf(collect(values(parameters)))
return OrderedCollections.OrderedDict{Union{String,Symbol},Float64}(zip(Mads.getobskeys(madsdata), o))
end
madscommandfunction = madscommandfunctionvector
elseif haskey(madsdata, "Julia model")
madsinfo("""Model setup: Julia model -> Internal model evaluation of Julia function '$(madsdata["Julia model"])'""")
madsinfo("""Model setup: Julia model -> Internal model evaluation of Julia function '$(madsdata["Julia model"])'""", 2)
madscommandfunction = madsdata["Julia model"]
elseif haskey(madsdata, "MADS model")
filename = joinpath(madsproblemdir, madsdata["MADS model"])
madsinfo("Model setup: MADS model -> Internal MADS model evaluation a Julia script in file '$(filename)'")
madsinfo("Model setup: MADS model -> Internal MADS model evaluation a Julia script in file '$(filename)'", 2)
madsdatacommandfunction = importeverywhere(filename)
local madscommandfunction
try
Expand All @@ -129,7 +129,7 @@ function makemadscommandfunction(madsdata_in::AbstractDict; obskeys::AbstractVec
madscommandfunction = Base.invokelatest(madsdatacommandfunction, madsdata)
elseif haskey(madsdata, "Model")
filename = joinpath(madsproblemdir, madsdata["Model"])
madsinfo("Model setup: Model -> Internal model evaluation a Julia script in file '$(filename)'")
madsinfo("Model setup: Model -> Internal model evaluation a Julia script in file '$(filename)'", 2)
madscommandfunction = importeverywhere(filename)
elseif haskey(madsdata, "Command") || haskey(madsdata, "Julia command") || ( haskey(madsdata, "Julia function") && haskey(madsdata, "Linked directory") )
linkdir = true
Expand All @@ -151,15 +151,15 @@ function makemadscommandfunction(madsdata_in::AbstractDict; obskeys::AbstractVec
madsdata["Command"] = replace(madsdata["Command"], "julia" => "$(first(Base.julia_cmd().exec)) --startup-file=no")
madsinfo("Mads Command has been updated to account for the location of julia: $(madsdata["Command"])")
end
madsinfo("""Model setup: Command -> External model evaluation of command '$(madsdata["Command"])'""")
madsinfo("""Model setup: Command -> External model evaluation of command '$(madsdata["Command"])'""", 2)
end
if haskey(madsdata, "Julia command")
filename = joinpath(madsproblemdir, madsdata["Julia command"])
madsinfo("Model setup: Julia command -> Model evaluation using a Julia script in file '$(filename)'")
madsinfo("Model setup: Julia command -> Model evaluation using a Julia script in file '$(filename)'", 2)
madsdatacommandfunction = importeverywhere(filename)
elseif haskey(madsdata, "Julia function") && haskey(madsdata, "Linked directory") && madsdata["Linked directory"] == true
if typeof(madsdata["Julia function"]) <: Function
madsinfo("""Model setup: Julia function -> Internal model evaluation of Julia function '$(madsdata["Julia function"])' in dedicated linked directory""")
madsinfo("""Model setup: Julia function -> Internal model evaluation of Julia function '$(madsdata["Julia function"])' in dedicated linked directory""", 2)
"MADS command function"
function madscommandfunctionexternal(parameters::AbstractVector)
o = madsdata["Julia function"](parameters)
Expand Down
2 changes: 1 addition & 1 deletion src/MadsIO.jl
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ Example:
md = Mads.loadmadsfile("input_file_name.mads")
```
"""
function loadmadsfile(filename::AbstractString; bigfile::Bool=false, format::AbstractString="yaml", quiet::Bool=false)
function loadmadsfile(filename::AbstractString; bigfile::Bool=false, format::AbstractString="yaml", quiet::Bool=Mads.quiet)
if bigfile
madsdata = loadbigyamlfile(filename)
end
Expand Down
5 changes: 1 addition & 4 deletions src/MadsParallel.jl
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,10 @@ if isdefined(Core, :Mads) && !isdefined(Mads, :sprintf)
sprintf(args...) = Base.eval(:@Printf.sprintf($(args...)))
end

quietdefault = true
nprocs_per_task_default = 1
madsservers = ["madsmax", "madsmen", "madszem", "madskil", "madsart", "madsend"] # madsdam is out
madsservers2 = vec(["madsmin"; map(i->(@Printf.sprintf "mads%02d" i), 1:18)])
madsserversall = vec(["madsmax"; "madsmen"; "madszem"; "madskil"; "madsart"; "madsend"; "madsmin"; map(i->(@Printf.sprintf "mads%02d" i), 1:18)]) # madsdam is out
if isdefined(Main, :Mads)
quietdefault = Mads.quiet
nprocs_per_task_default = Mads.nprocs_per_task_default
madsservers = Mads.madsservers
madsservers2 = Mads.madsservers2
Expand Down Expand Up @@ -44,7 +41,7 @@ end
function setprocs(np::Integer)
setprocs(np, np)
end
function setprocs(; ntasks_per_node::Integer=0, nprocs_per_task::Integer=nprocs_per_task_default, nodenames::Union{String,Vector{String}}=Array{String}(undef, 0), mads_servers::Bool=false, test::Bool=false, quiet::Bool=quietdefault, veryquiet::Bool=false, dir::AbstractString=pwd(), exename::AbstractString=Base.julia_cmd().exec[1])
function setprocs(; ntasks_per_node::Integer=0, nprocs_per_task::Integer=nprocs_per_task_default, nodenames::Union{String,Vector{String}}=Array{String}(undef, 0), mads_servers::Bool=false, test::Bool=false, quiet::Bool=Mads.quiet, veryquiet::Bool=false, dir::AbstractString=pwd(), exename::AbstractString=Base.julia_cmd().exec[1])
if isdefined(Core, :Mads) && isdefined(Mads, :set_nprocs_per_task)
set_nprocs_per_task(nprocs_per_task)
end
Expand Down

0 comments on commit 0d4acb4

Please sign in to comment.