Skip to content

Commit

Permalink
robustpmap
Browse files Browse the repository at this point in the history
  • Loading branch information
montyvesselinov committed Feb 3, 2024
1 parent 63442a8 commit 5870235
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/MadsForward.jl
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ function forward(madsdata::AbstractDict, paramdict::AbstractDict; all::Bool=fals
return forward(madsdata_c, paramarray; all=all, checkpointfrequency=checkpointfrequency, checkpointfilename=checkpointfilename)
end
end
function forward(madsdata::AbstractDict, paramarray::AbstractArray; parallel::Bool=true, pmap::Bool=false, all::Bool=false, checkpointfrequency::Integer=0, checkpointfilename::AbstractString="checkpoint_forward")
function forward(madsdata::AbstractDict, paramarray::AbstractArray; parallel::Bool=true, robustpmap::Bool=false, all::Bool=false, checkpointfrequency::Integer=0, checkpointfilename::AbstractString="checkpoint_forward")
paramdict = Mads.getparamdict(madsdata)
if sizeof(paramarray) == 0
return forward(madsdata; all=all)
Expand Down Expand Up @@ -99,12 +99,12 @@ function forward(madsdata::AbstractDict, paramarray::AbstractArray; parallel::Bo
end
r = hcat(collect.(values.(rv))...)
elseif parallel && Distributed.nprocs() > 1
if pmap
if robustpmap
@info("RobustPmap for parallel execution of forward runs ...")
if s[2] == np
rv = RobustPmap.pmap(func_forward, collect(paramarray))
rv = RobustPmap.rpmap(func_forward, collect(paramarray))
else
rv = RobustPmap.pmap(func_forward, permutedims(collect(paramarray)))
rv = RobustPmap.rpmap(func_forward, permutedims(collect(paramarray)))
end
r = hcat(collect.(values.(rv))...)
else
Expand Down

0 comments on commit 5870235

Please sign in to comment.