Skip to content

Commit

Permalink
Modify default call to map/pmap when paralellizing
Browse files Browse the repository at this point in the history
This addresses the discussion in Circuitscape#236.
  • Loading branch information
VLucet authored Jun 10, 2020
1 parent 2d44a41 commit 9c9cf51
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions src/core.jl
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,12 @@ function amg_solver_path(data::GraphData{T,V}, flags, cfg, log)::Matrix{T} where
f(1)
update_shortcut_resistances!(idx, shortcut, resistances, points, comp)
else
X = pmap(x ->f(x), 1:size(csub,1))
is_parallel = cfg["parallelize"] in TRUELIST
if is_parallel
X = pmap(x ->f(x), 1:size(csub,1))
else
X = map(x ->f(x), 1:size(csub,1))
end

# Set all resistances
for x in X
Expand Down Expand Up @@ -417,8 +422,13 @@ function _cholmod_solver_path(data::GraphData{T,V}, flags,
end
end


pmap(x -> f(x, rng, lhs), 1:length(rng))
is_parallel = cfg["parallelize"] in TRUELIST
if is_parallel
X = pmap(x -> f(x, rng, lhs), 1:length(rng))
else
X = map(x -> f(x, rng, lhs), 1:length(rng))
end

for (i,v) in enumerate(rng)
coords = cholmod_batch[v].points_idx
r = lhs[cholmod_batch[v].cc_idx[2], i] -
Expand Down

0 comments on commit 9c9cf51

Please sign in to comment.