[SYSTEMML-1386] Fix execution context creation w/ forced singlenode

Project: http://git-wip-us.apache.org/repos/asf/incubator-systemml/repo
Commit: 
http://git-wip-us.apache.org/repos/asf/incubator-systemml/commit/b945543d
Tree: http://git-wip-us.apache.org/repos/asf/incubator-systemml/tree/b945543d
Diff: http://git-wip-us.apache.org/repos/asf/incubator-systemml/diff/b945543d

Branch: refs/heads/master
Commit: b945543d933c37ad92adc04ccbfa51410434e777
Parents: feb1cb7
Author: Matthias Boehm <[email protected]>
Authored: Thu Mar 9 17:58:44 2017 -0800
Committer: Matthias Boehm <[email protected]>
Committed: Thu Mar 9 17:58:44 2017 -0800

----------------------------------------------------------------------
 .../controlprogram/context/ExecutionContextFactory.java   | 10 ++++++++++
 1 file changed, 10 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/b945543d/src/main/java/org/apache/sysml/runtime/controlprogram/context/ExecutionContextFactory.java
----------------------------------------------------------------------
diff --git 
a/src/main/java/org/apache/sysml/runtime/controlprogram/context/ExecutionContextFactory.java
 
b/src/main/java/org/apache/sysml/runtime/controlprogram/context/ExecutionContextFactory.java
index 4b2d9d0..9fc871b 100644
--- 
a/src/main/java/org/apache/sysml/runtime/controlprogram/context/ExecutionContextFactory.java
+++ 
b/src/main/java/org/apache/sysml/runtime/controlprogram/context/ExecutionContextFactory.java
@@ -20,6 +20,8 @@
 package org.apache.sysml.runtime.controlprogram.context;
 
 import org.apache.sysml.api.DMLScript;
+import org.apache.sysml.api.DMLScript.RUNTIME_PLATFORM;
+import org.apache.sysml.hops.OptimizerUtils;
 import org.apache.sysml.runtime.controlprogram.Program;
 
 public class ExecutionContextFactory 
@@ -41,6 +43,14 @@ public class ExecutionContextFactory
                switch( DMLScript.rtplatform )
                {
                        case SINGLE_NODE:
+                               //NOTE: even in case of forced singlenode 
operations, users might still 
+                               //want to run remote parfor which requires the 
correct execution context
+                               if( 
OptimizerUtils.getDefaultExecutionMode()==RUNTIME_PLATFORM.HYBRID)
+                                       ec = new ExecutionContext(allocateVars, 
prog);
+                               else
+                                       ec = new 
SparkExecutionContext(allocateVars, prog);
+                               break;
+                               
                        case HADOOP:
                        case HYBRID:
                                ec = new ExecutionContext(allocateVars, prog);

Reply via email to