From 74ff36a6164f44721053d7e429bbcae7b2540cfc Mon Sep 17 00:00:00 2001 From: Sergey Shalnov Date: Thu, 5 Dec 2019 11:31:44 -0600 Subject: [PATCH] Fix for dictinary if no kay exists --- sdc/distributed_analysis.py | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/sdc/distributed_analysis.py b/sdc/distributed_analysis.py index 231011ea5..0d179e794 100644 --- a/sdc/distributed_analysis.py +++ b/sdc/distributed_analysis.py @@ -199,16 +199,29 @@ def _analyze_assign(self, inst, array_dists, parfor_dists): elif isinstance(rhs, ir.Expr) and rhs.op in ('getiter', 'iternext'): # analyze array container access in pair_first return + elif isinstance(rhs, ir.Arg): - if rhs.name in self.metadata['distributed']: + distributed_key = 'distributed' + threaded_key = 'threaded' + + if distributed_key not in self.metadata.keys(): + self.metadata[distributed_key] = {} + + if threaded_key not in self.metadata.keys(): + self.metadata[threaded_key] = {} + + if rhs.name in self.metadata[distributed_key]: if lhs not in array_dists: array_dists[lhs] = Distribution.OneD - elif rhs.name in self.metadata['threaded']: + + elif rhs.name in self.metadata[threaded_key]: if lhs not in array_dists: array_dists[lhs] = Distribution.Thread + else: dprint("replicated input ", rhs.name, lhs) self._set_REP([inst.target], array_dists) + else: self._set_REP(inst.list_vars(), array_dists) return