From 9c9cf5139d636ad4ccb8e4b33434d5f267591106 Mon Sep 17 00:00:00 2001 From: vlucet Date: Wed, 10 Jun 2020 15:48:43 -0400 Subject: [PATCH] Modify default call to map/pmap when paralellizing This addresses the discussion in #236. --- src/core.jl | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/core.jl b/src/core.jl index 924d9906..fe6b0854 100644 --- a/src/core.jl +++ b/src/core.jl @@ -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 @@ -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] -