You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@systemml.apache.org by mb...@apache.org on 2017/04/23 07:26:55 UTC

[2/2] incubator-systemml git commit: [SYSTEMML-1555] Decouple literal replacement (scalar-only, in-place)

[SYSTEMML-1555] Decouple literal replacement (scalar-only, in-place)

So far full literal replacement was only applied for recompilations that
are not in-place, i.e., compilations that work over a deep copy of the
hop dag. Furthermore, we always applied full literal replacement
including the replacement of small matrix operations with its scalar
results.

This patch decouples these aspects in order to allow fine-grained
external control over literal replacement.

Furthermore, this patch also fixes the codegen MSVM and L2SVM tests to
account for the recently changed CLI command line argument parsing.


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

Branch: refs/heads/master
Commit: c8007f4548c0f0f0a5f7ba4f8c785871b6d31fe8
Parents: edd3491
Author: Matthias Boehm <mb...@gmail.com>
Authored: Sun Apr 23 00:16:46 2017 -0700
Committer: Matthias Boehm <mb...@gmail.com>
Committed: Sun Apr 23 00:16:46 2017 -0700

----------------------------------------------------------------------
 .../sysml/hops/codegen/SpoofCompiler.java       |  4 +-
 .../hops/recompile/LiteralReplacement.java      | 22 ++++----
 .../apache/sysml/hops/recompile/Recompiler.java | 54 ++++++++++++--------
 .../runtime/controlprogram/ProgramBlock.java    |  6 ++-
 .../parfor/opt/OptimizerRuleBased.java          |  3 +-
 .../parfor/opt/ProgramRecompiler.java           | 10 ++--
 .../sysml/yarn/ropt/ResourceOptimizer.java      | 38 +++++++++-----
 .../functions/codegen/AlgorithmL2SVM.java       |  2 +-
 .../functions/codegen/AlgorithmMSVM.java        |  2 +-
 9 files changed, 85 insertions(+), 56 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/c8007f45/src/main/java/org/apache/sysml/hops/codegen/SpoofCompiler.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/hops/codegen/SpoofCompiler.java b/src/main/java/org/apache/sysml/hops/codegen/SpoofCompiler.java
index 816b7ae..aa5e7e3 100644
--- a/src/main/java/org/apache/sysml/hops/codegen/SpoofCompiler.java
+++ b/src/main/java/org/apache/sysml/hops/codegen/SpoofCompiler.java
@@ -293,7 +293,7 @@ public class SpoofCompiler
 	{
 		//create copy of hop dag, call codegen, and generate instructions
 		return Recompiler.recompileHopsDag(sb, roots, 
-			new LocalVariableMap(), new RecompileStatus(), false, 0);
+			new LocalVariableMap(), new RecompileStatus(), false, false, 0);
 	}
 	
 	public static ArrayList<Instruction> generateCodeFromHopDAGsToInst(Hop root) 
@@ -301,7 +301,7 @@ public class SpoofCompiler
 	{
 		//create copy of hop dag, call codegen, and generate instructions
 		return Recompiler.recompileHopsDag(root, 
-			new LocalVariableMap(), new RecompileStatus(), false, 0);
+			new LocalVariableMap(), new RecompileStatus(), false, false, 0);
 	}
 	
 	

http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/c8007f45/src/main/java/org/apache/sysml/hops/recompile/LiteralReplacement.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/hops/recompile/LiteralReplacement.java b/src/main/java/org/apache/sysml/hops/recompile/LiteralReplacement.java
index f539abc..d7b97e9 100644
--- a/src/main/java/org/apache/sysml/hops/recompile/LiteralReplacement.java
+++ b/src/main/java/org/apache/sysml/hops/recompile/LiteralReplacement.java
@@ -50,7 +50,7 @@ public class LiteralReplacement
 	private static final long REPLACE_LITERALS_MAX_MATRIX_SIZE = 1000000; //10^6 cells (8MB)
 	private static final boolean REPORT_LITERAL_REPLACE_OPS_STATS = true; 	
 	
-	protected static void rReplaceLiterals( Hop hop, LocalVariableMap vars ) 
+	protected static void rReplaceLiterals( Hop hop, LocalVariableMap vars, boolean scalarsOnly ) 
 		throws DMLRuntimeException
 	{
 		if( hop.isVisited() )
@@ -68,10 +68,12 @@ public class LiteralReplacement
 				lit = (lit==null) ? replaceLiteralScalarRead(c, vars) : lit;
 				lit = (lit==null) ? replaceLiteralValueTypeCastScalarRead(c, vars) : lit;
 				lit = (lit==null) ? replaceLiteralValueTypeCastLiteral(c, vars) : lit;
-				lit = (lit==null) ? replaceLiteralDataTypeCastMatrixRead(c, vars) : lit;
-				lit = (lit==null) ? replaceLiteralValueTypeCastRightIndexing(c, vars) : lit;
-				lit = (lit==null) ? replaceLiteralFullUnaryAggregate(c, vars) : lit;
-				lit = (lit==null) ? replaceLiteralFullUnaryAggregateRightIndexing(c, vars) : lit;
+				if( !scalarsOnly ) {
+					lit = (lit==null) ? replaceLiteralDataTypeCastMatrixRead(c, vars) : lit;
+					lit = (lit==null) ? replaceLiteralValueTypeCastRightIndexing(c, vars) : lit;
+					lit = (lit==null) ? replaceLiteralFullUnaryAggregate(c, vars) : lit;
+					lit = (lit==null) ? replaceLiteralFullUnaryAggregateRightIndexing(c, vars) : lit;
+				}
 				
 				//replace hop w/ literal on demand
 				if( lit != null )
@@ -88,15 +90,13 @@ public class LiteralReplacement
 						}
 					}
 					else { //current hop is only parent
-						HopRewriteUtils.removeChildReferenceByPos(hop, c, i);
-						HopRewriteUtils.addChildReference(hop, lit, i);
+						HopRewriteUtils.replaceChildReference(hop, c, lit, i);
 					}
 				}
 				//recursively process children
-				else 
-				{
-					rReplaceLiterals(c, vars);	
-				}			
+				else {
+					rReplaceLiterals(c, vars, scalarsOnly);	
+				}
 			}
 		}
 		

http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/c8007f45/src/main/java/org/apache/sysml/hops/recompile/Recompiler.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/hops/recompile/Recompiler.java b/src/main/java/org/apache/sysml/hops/recompile/Recompiler.java
index 6c99d16..6a2d88c 100644
--- a/src/main/java/org/apache/sysml/hops/recompile/Recompiler.java
+++ b/src/main/java/org/apache/sysml/hops/recompile/Recompiler.java
@@ -154,6 +154,7 @@ public class Recompiler
 	 * @param vars local variable map
 	 * @param status the recompile status
 	 * @param inplace true if in place
+	 * @param litreplace true if literal replacement
 	 * @param tid thread id
 	 * @return list of instructions
 	 * @throws DMLRuntimeException if DMLRuntimeException occurs
@@ -161,7 +162,8 @@ public class Recompiler
 	 * @throws LopsException if LopsException occurs
 	 * @throws IOException if IOException occurs
 	 */
-	public static ArrayList<Instruction> recompileHopsDag( StatementBlock sb, ArrayList<Hop> hops, LocalVariableMap vars, RecompileStatus status, boolean inplace, long tid ) 
+	public static ArrayList<Instruction> recompileHopsDag( StatementBlock sb, ArrayList<Hop> hops, 
+			LocalVariableMap vars, RecompileStatus status, boolean inplace, boolean litreplace, long tid ) 
 		throws DMLRuntimeException, HopsException, LopsException, IOException
 	{
 		ArrayList<Instruction> newInst = null;
@@ -186,10 +188,10 @@ public class Recompiler
 			}
 
 			// replace scalar reads with literals 
-			if( !inplace ) {
+			if( !inplace && litreplace ) {
 				Hop.resetVisitStatus(hops);
 				for( Hop hopRoot : hops )
-					rReplaceLiterals( hopRoot, vars );
+					rReplaceLiterals( hopRoot, vars, false );
 			}
 			
 			// refresh matrix characteristics (update stats)			
@@ -268,6 +270,7 @@ public class Recompiler
 	 * @param vars local variable map
 	 * @param status recompile status
 	 * @param inplace true if in place
+	 * @param litreplace true if literal replacement
 	 * @param tid thread id
 	 * @return list of instructions
 	 * @throws DMLRuntimeException if DMLRuntimeException occurs
@@ -275,7 +278,8 @@ public class Recompiler
 	 * @throws LopsException if LopsException occurs
 	 * @throws IOException if IOException occurs
 	 */
-	public static ArrayList<Instruction> recompileHopsDag( Hop hops, LocalVariableMap vars, RecompileStatus status, boolean inplace, long tid ) 
+	public static ArrayList<Instruction> recompileHopsDag( Hop hops, LocalVariableMap vars, 
+			RecompileStatus status, boolean inplace, boolean litreplace, long tid ) 
 		throws DMLRuntimeException, HopsException, LopsException, IOException
 	{
 		ArrayList<Instruction> newInst = null;
@@ -299,9 +303,9 @@ public class Recompiler
 			}
 			
 			// replace scalar reads with literals 
-			if( !inplace ) {
+			if( !inplace && litreplace ) {
 				hops.resetVisitStatus();
-				rReplaceLiterals( hops, vars );
+				rReplaceLiterals( hops, vars, false );
 			}
 			
 			// refresh matrix characteristics (update stats)			
@@ -864,7 +868,8 @@ public class Recompiler
 				//&& Recompiler.requiresRecompilation( sb.get_hops() ) 
 				/*&& !Recompiler.containsNonRecompileInstructions(tmp)*/ )
 			{
-				tmp = Recompiler.recompileHopsDag(sb, sb.get_hops(), vars, status, true, tid);
+				tmp = Recompiler.recompileHopsDag(
+					sb, sb.get_hops(), vars, status, true, false, tid);
 				pb.setInstructions( tmp );
 				
 				//propagate stats across hops (should be executed on clone of vars)
@@ -1098,10 +1103,9 @@ public class Recompiler
 	private static MatrixObject createOutputMatrix( long dim1, long dim2, long nnz )
 	{
 		MatrixObject moOut = new MatrixObject(ValueType.DOUBLE, null);
+		int blksz = ConfigurationManager.getBlocksize();
 		MatrixCharacteristics mc = new MatrixCharacteristics( 
-									dim1, dim2,
-									ConfigurationManager.getBlocksize(), ConfigurationManager.getBlocksize(),
-									nnz);
+				dim1, dim2, blksz, blksz, nnz);
 		MatrixFormatMetaData meta = new MatrixFormatMetaData(mc,null,null);
 		moOut.setMetaData(meta);
 		
@@ -1118,7 +1122,8 @@ public class Recompiler
 		{
 			Hop hops = isb.getPredicateHops();
 			if( hops != null ) {
-				ArrayList<Instruction> tmp = recompileHopsDag(hops, vars, status, true, tid);
+				ArrayList<Instruction> tmp = recompileHopsDag(
+						hops, vars, status, true, false, tid);
 				ipb.setPredicate( tmp );
 				if( ParForProgramBlock.RESET_RECOMPILATION_FLAGs
 					&& resetRecompile ) 
@@ -1141,7 +1146,8 @@ public class Recompiler
 		{
 			Hop hops = wsb.getPredicateHops();
 			if( hops != null ) {
-				ArrayList<Instruction> tmp = recompileHopsDag(hops, vars, status, true, tid);
+				ArrayList<Instruction> tmp = recompileHopsDag(
+					hops, vars, status, true, false, tid);
 				wpb.setPredicate( tmp );
 				if( ParForProgramBlock.RESET_RECOMPILATION_FLAGs 
 					&& resetRecompile ) 
@@ -1171,17 +1177,20 @@ public class Recompiler
 				&& resetRecompile ) 
 			{
 				if( fromHops != null ) {
-					ArrayList<Instruction> tmp = recompileHopsDag(fromHops, vars, status, true, tid);
+					ArrayList<Instruction> tmp = recompileHopsDag(
+						fromHops, vars, status, true, false, tid);
 					fpb.setFromInstructions(tmp);
 					Hop.resetRecompilationFlag(fromHops,ExecType.CP);
 				}
 				if( toHops != null ) {
-					ArrayList<Instruction> tmp = recompileHopsDag(toHops, vars, status, true, tid);
+					ArrayList<Instruction> tmp = recompileHopsDag(
+						toHops, vars, status, true, false, tid);
 					fpb.setToInstructions(tmp);
 					Hop.resetRecompilationFlag(toHops,ExecType.CP);
 				}
 				if( incrHops != null ) {
-					ArrayList<Instruction> tmp = recompileHopsDag(incrHops, vars, status, true, tid);
+					ArrayList<Instruction> tmp = recompileHopsDag(
+						incrHops, vars, status, true, false, tid);
 					fpb.setIncrementInstructions(tmp);
 					Hop.resetRecompilationFlag(incrHops,ExecType.CP);
 				}
@@ -1190,15 +1199,18 @@ public class Recompiler
 			else //no reset of recompilation flags
 			{
 				if( fromHops != null ) {
-					ArrayList<Instruction> tmp = recompileHopsDag(fromHops, vars, status, true, tid);
+					ArrayList<Instruction> tmp = recompileHopsDag(
+						fromHops, vars, status, true, false, tid);
 					fpb.setFromInstructions(tmp);
 				}
 				if( toHops != null ) {
-					ArrayList<Instruction> tmp = recompileHopsDag(toHops, vars, status, true, tid);
+					ArrayList<Instruction> tmp = recompileHopsDag(
+						toHops, vars, status, true, false, tid);
 					fpb.setToInstructions(tmp);
 				}
 				if( incrHops != null ) {
-					ArrayList<Instruction> tmp = recompileHopsDag(incrHops, vars, status, true, tid);
+					ArrayList<Instruction> tmp = recompileHopsDag(
+						incrHops, vars, status, true, false, tid);
 					fpb.setIncrementInstructions(tmp);
 				}
 			}
@@ -1608,13 +1620,15 @@ public class Recompiler
 	 * 
 	 * @param hop high-level operator
 	 * @param vars local variable map
+	 * @param scalarsOnly if true, replace only scalar variables but no matrix operations;
+	 *            if false, apply full literal replacement
 	 * @throws DMLRuntimeException if DMLRuntimeException occurs
 	 */
-	public static void rReplaceLiterals( Hop hop, LocalVariableMap vars ) 
+	public static void rReplaceLiterals( Hop hop, LocalVariableMap vars, boolean scalarsOnly ) 
 		throws DMLRuntimeException
 	{
 		//public interface 
-		LiteralReplacement.rReplaceLiterals(hop, vars);
+		LiteralReplacement.rReplaceLiterals(hop, vars, scalarsOnly);
 	}
 	
 	public static void rSetExecType( Hop hop, ExecType etype )

http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/c8007f45/src/main/java/org/apache/sysml/runtime/controlprogram/ProgramBlock.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/runtime/controlprogram/ProgramBlock.java b/src/main/java/org/apache/sysml/runtime/controlprogram/ProgramBlock.java
index 1847847..71fb1c2 100644
--- a/src/main/java/org/apache/sysml/runtime/controlprogram/ProgramBlock.java
+++ b/src/main/java/org/apache/sysml/runtime/controlprogram/ProgramBlock.java
@@ -145,7 +145,8 @@ public class ProgramBlock
 				&& _sb != null 
 				&& _sb.requiresRecompilation() )
 			{
-				tmp = Recompiler.recompileHopsDag(_sb, _sb.get_hops(), ec.getVariables(), null, false, _tid);
+				tmp = Recompiler.recompileHopsDag(
+					_sb, _sb.get_hops(), ec.getVariables(), null, false, true, _tid);
 				
 				if( MLContextProxy.isActive() )
 					tmp = MLContextProxy.performCleanupAfterRecompilation(tmp);
@@ -188,7 +189,8 @@ public class ProgramBlock
 			if(    ConfigurationManager.isDynamicRecompilation() 
 				&& requiresRecompile )
 			{
-				tmp = Recompiler.recompileHopsDag(hops, ec.getVariables(), null, false, _tid);
+				tmp = Recompiler.recompileHopsDag(
+					hops, ec.getVariables(), null, false, true, _tid);
 			}
 			if( DMLScript.STATISTICS ){
 				long t1 = System.nanoTime();

http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/c8007f45/src/main/java/org/apache/sysml/runtime/controlprogram/parfor/opt/OptimizerRuleBased.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/runtime/controlprogram/parfor/opt/OptimizerRuleBased.java b/src/main/java/org/apache/sysml/runtime/controlprogram/parfor/opt/OptimizerRuleBased.java
index 1a8122a..bbd8fb8 100644
--- a/src/main/java/org/apache/sysml/runtime/controlprogram/parfor/opt/OptimizerRuleBased.java
+++ b/src/main/java/org/apache/sysml/runtime/controlprogram/parfor/opt/OptimizerRuleBased.java
@@ -786,7 +786,8 @@ public class OptimizerRuleBased extends Optimizer
 		HashMap<Hop, Double> estRix = getPartitionedRIXEstimates(nParent);
 		
 		//construct new instructions
-		ArrayList<Instruction> newInst = Recompiler.recompileHopsDag(sb, sb.get_hops(), vars, null, false, 0);
+		ArrayList<Instruction> newInst = Recompiler.recompileHopsDag(
+			sb, sb.get_hops(), vars, null, false, false, 0);
 		pb.setInstructions( newInst );   
 		
 		//reset all rix estimated (modified by recompile)

http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/c8007f45/src/main/java/org/apache/sysml/runtime/controlprogram/parfor/opt/ProgramRecompiler.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/runtime/controlprogram/parfor/opt/ProgramRecompiler.java b/src/main/java/org/apache/sysml/runtime/controlprogram/parfor/opt/ProgramRecompiler.java
index f6ccc13..2d03af3 100644
--- a/src/main/java/org/apache/sysml/runtime/controlprogram/parfor/opt/ProgramRecompiler.java
+++ b/src/main/java/org/apache/sysml/runtime/controlprogram/parfor/opt/ProgramRecompiler.java
@@ -183,7 +183,8 @@ public class ProgramRecompiler
 				if( ret )
 				{
 					//construct new instructions
-					ArrayList<Instruction> newInst = Recompiler.recompileHopsDag(sb, sb.get_hops(), ec.getVariables(), null, true, 0);
+					ArrayList<Instruction> newInst = Recompiler.recompileHopsDag(
+						sb, sb.get_hops(), ec.getVariables(), null, true, false, 0);
 					pb.setInstructions( newInst ); 
 				}
 			}
@@ -251,7 +252,7 @@ public class ProgramRecompiler
 				//replace constant literals
 				Hop.resetVisitStatus(hops);
 				for( Hop hopRoot : hops )
-					Recompiler.rReplaceLiterals( hopRoot, vars );
+					Recompiler.rReplaceLiterals( hopRoot, vars, true );
 			}	
 		}
 	}
@@ -261,7 +262,7 @@ public class ProgramRecompiler
 	{
 		if( pred != null ){
 			pred.resetVisitStatus();
-			Recompiler.rReplaceLiterals(pred, vars);
+			Recompiler.rReplaceLiterals(pred, vars, true);
 		}
 	}
 	
@@ -380,7 +381,8 @@ public class ProgramRecompiler
 			if( ret )
 			{
 				//construct new instructions
-				tmp = Recompiler.recompileHopsDag(hop, ec.getVariables(), null, true, 0);
+				tmp = Recompiler.recompileHopsDag(
+					hop, ec.getVariables(), null, true, false, 0);
 			}
 		}
 		catch(Exception ex)

http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/c8007f45/src/main/java/org/apache/sysml/yarn/ropt/ResourceOptimizer.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/yarn/ropt/ResourceOptimizer.java b/src/main/java/org/apache/sysml/yarn/ropt/ResourceOptimizer.java
index d753406..8b6003f 100644
--- a/src/main/java/org/apache/sysml/yarn/ropt/ResourceOptimizer.java
+++ b/src/main/java/org/apache/sysml/yarn/ropt/ResourceOptimizer.java
@@ -207,7 +207,8 @@ public class ResourceOptimizer
 			WhileProgramBlock wpb = (WhileProgramBlock)pb;
 			WhileStatementBlock sb = (WhileStatementBlock) pb.getStatementBlock();
 			if( INCLUDE_PREDICATES && sb!=null && sb.getPredicateHops()!=null ){
-				ArrayList<Instruction> inst = Recompiler.recompileHopsDag(sb.getPredicateHops(), new LocalVariableMap(), null, false, 0);
+				ArrayList<Instruction> inst = Recompiler.recompileHopsDag(
+					sb.getPredicateHops(), new LocalVariableMap(), null, false, false, 0);
 				wpb.setPredicate( inst );
 				B.add(wpb);
 				_cntCompilePB ++;
@@ -219,7 +220,8 @@ public class ResourceOptimizer
 			IfProgramBlock ipb = (IfProgramBlock)pb;
 			IfStatementBlock sb = (IfStatementBlock) ipb.getStatementBlock();
 			if( INCLUDE_PREDICATES && sb!=null && sb.getPredicateHops()!=null ){
-				ArrayList<Instruction> inst = Recompiler.recompileHopsDag(sb.getPredicateHops(), new LocalVariableMap(), null, false, 0);
+				ArrayList<Instruction> inst = Recompiler.recompileHopsDag(
+					sb.getPredicateHops(), new LocalVariableMap(), null, false, false, 0);
 				ipb.setPredicate( inst );
 				B.add(ipb);
 				_cntCompilePB ++;
@@ -233,15 +235,18 @@ public class ResourceOptimizer
 			ForStatementBlock sb = (ForStatementBlock) fpb.getStatementBlock();
 			if( INCLUDE_PREDICATES && sb!=null ){
 				if( sb.getFromHops()!=null ){
-					ArrayList<Instruction> inst = Recompiler.recompileHopsDag(sb.getFromHops(), new LocalVariableMap(), null, false, 0);
+					ArrayList<Instruction> inst = Recompiler.recompileHopsDag(
+						sb.getFromHops(), new LocalVariableMap(), null, false, false, 0);
 					fpb.setFromInstructions( inst );	
 				}
 				if( sb.getToHops()!=null ){
-					ArrayList<Instruction> inst = Recompiler.recompileHopsDag(sb.getToHops(), new LocalVariableMap(), null, false, 0);
+					ArrayList<Instruction> inst = Recompiler.recompileHopsDag(
+						sb.getToHops(), new LocalVariableMap(), null, false, false, 0);
 					fpb.setToInstructions( inst );	
 				}
 				if( sb.getIncrementHops()!=null ){
-					ArrayList<Instruction> inst = Recompiler.recompileHopsDag(sb.getIncrementHops(), new LocalVariableMap(), null, false, 0);
+					ArrayList<Instruction> inst = Recompiler.recompileHopsDag(
+						sb.getIncrementHops(), new LocalVariableMap(), null, false, false, 0);
 					fpb.setIncrementInstructions( inst );	
 				}
 				B.add(fpb);
@@ -252,8 +257,8 @@ public class ResourceOptimizer
 		else
 		{
 			StatementBlock sb = pb.getStatementBlock();
-			ArrayList<Instruction> inst = Recompiler.recompileHopsDag(sb, sb.get_hops(), 
-					                                   new LocalVariableMap(), null, false, 0);
+			ArrayList<Instruction> inst = Recompiler.recompileHopsDag(
+				sb, sb.get_hops(), new LocalVariableMap(), null, false, false, 0);
 			pb.setInstructions( inst );
 			B.add(pb);
 			_cntCompilePB ++;
@@ -288,7 +293,8 @@ public class ResourceOptimizer
 			WhileProgramBlock wpb = (WhileProgramBlock)pb;
 			WhileStatementBlock sb = (WhileStatementBlock) pb.getStatementBlock();
 			if( INCLUDE_PREDICATES && sb!=null && sb.getPredicateHops()!=null ){
-				ArrayList<Instruction> inst = Recompiler.recompileHopsDag(sb.getPredicateHops(), new LocalVariableMap(), null, false, 0);
+				ArrayList<Instruction> inst = Recompiler.recompileHopsDag(
+					sb.getPredicateHops(), new LocalVariableMap(), null, false, false, 0);
 				inst = annotateMRJobInstructions(inst, cp, mr);
 				wpb.setPredicate( inst );
 			}				
@@ -298,7 +304,8 @@ public class ResourceOptimizer
 			IfProgramBlock ipb = (IfProgramBlock)pb;
 			IfStatementBlock sb = (IfStatementBlock) ipb.getStatementBlock();
 			if( INCLUDE_PREDICATES && sb!=null && sb.getPredicateHops()!=null ){
-				ArrayList<Instruction> inst = Recompiler.recompileHopsDag(sb.getPredicateHops(), new LocalVariableMap(), null, false, 0);
+				ArrayList<Instruction> inst = Recompiler.recompileHopsDag(
+					sb.getPredicateHops(), new LocalVariableMap(), null, false, false, 0);
 				inst = annotateMRJobInstructions(inst, cp, mr);
 				ipb.setPredicate( inst );
 			}
@@ -309,17 +316,20 @@ public class ResourceOptimizer
 			ForStatementBlock sb = (ForStatementBlock) fpb.getStatementBlock();
 			if( INCLUDE_PREDICATES && sb!=null ){
 				if( sb.getFromHops()!=null ){
-					ArrayList<Instruction> inst = Recompiler.recompileHopsDag(sb.getFromHops(), new LocalVariableMap(), null, false, 0);
+					ArrayList<Instruction> inst = Recompiler.recompileHopsDag(
+						sb.getFromHops(), new LocalVariableMap(), null, false, false, 0);
 					inst = annotateMRJobInstructions(inst, cp, mr);
 					fpb.setFromInstructions( inst );	
 				}
 				if( sb.getToHops()!=null ){
-					ArrayList<Instruction> inst = Recompiler.recompileHopsDag(sb.getToHops(), new LocalVariableMap(), null, false, 0);
+					ArrayList<Instruction> inst = Recompiler.recompileHopsDag(
+						sb.getToHops(), new LocalVariableMap(), null, false, false, 0);
 					inst = annotateMRJobInstructions(inst, cp, mr);
 					fpb.setToInstructions( inst );	
 				}
 				if( sb.getIncrementHops()!=null ){
-					ArrayList<Instruction> inst = Recompiler.recompileHopsDag(sb.getIncrementHops(), new LocalVariableMap(), null, false, 0);
+					ArrayList<Instruction> inst = Recompiler.recompileHopsDag(
+						sb.getIncrementHops(), new LocalVariableMap(), null, false, false, 0);
 					inst = annotateMRJobInstructions(inst, cp, mr);
 					fpb.setIncrementInstructions( inst );	
 				}
@@ -328,8 +338,8 @@ public class ResourceOptimizer
 		else //last-level program blocks
 		{
 			StatementBlock sb = pb.getStatementBlock();
-			ArrayList<Instruction> inst = Recompiler.recompileHopsDag(sb, sb.get_hops(), 
-					                                   new LocalVariableMap(), null, false, 0);
+			ArrayList<Instruction> inst = Recompiler.recompileHopsDag(
+				sb, sb.get_hops(), new LocalVariableMap(), null, false, false, 0);
 			inst = annotateMRJobInstructions(inst, cp, mr);
 			pb.setInstructions( inst );
 		}

http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/c8007f45/src/test/java/org/apache/sysml/test/integration/functions/codegen/AlgorithmL2SVM.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/sysml/test/integration/functions/codegen/AlgorithmL2SVM.java b/src/test/java/org/apache/sysml/test/integration/functions/codegen/AlgorithmL2SVM.java
index 6f005ad..2e03ce6 100644
--- a/src/test/java/org/apache/sysml/test/integration/functions/codegen/AlgorithmL2SVM.java
+++ b/src/test/java/org/apache/sysml/test/integration/functions/codegen/AlgorithmL2SVM.java
@@ -123,7 +123,7 @@ public class AlgorithmL2SVM extends AutomatedTestBase
 			fullDMLScriptName = "scripts/algorithms/l2-svm.dml";
 			programArgs = new String[]{ "-explain", "-stats", "-nvargs", "X="+input("X"), "Y="+input("Y"),
 				"icpt="+String.valueOf(intercept), "tol="+String.valueOf(epsilon), "reg=0.001",
-				"maxiter="+String.valueOf(maxiter), "model="+output("w"), "Log=\" \""};
+				"maxiter="+String.valueOf(maxiter), "model="+output("w"), "Log= "};
 
 			rCmd = getRCmd(inputDir(), String.valueOf(intercept),String.valueOf(epsilon),
 				String.valueOf(maxiter), expectedDir());

http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/c8007f45/src/test/java/org/apache/sysml/test/integration/functions/codegen/AlgorithmMSVM.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/sysml/test/integration/functions/codegen/AlgorithmMSVM.java b/src/test/java/org/apache/sysml/test/integration/functions/codegen/AlgorithmMSVM.java
index 7f26d70..2a5de13 100644
--- a/src/test/java/org/apache/sysml/test/integration/functions/codegen/AlgorithmMSVM.java
+++ b/src/test/java/org/apache/sysml/test/integration/functions/codegen/AlgorithmMSVM.java
@@ -122,7 +122,7 @@ public class AlgorithmMSVM extends AutomatedTestBase
 			fullDMLScriptName = "scripts/algorithms/m-svm.dml";
 			programArgs = new String[]{ "-explain", "-stats", "-nvargs", "X="+input("X"), "Y="+input("Y"),
 					"icpt="+String.valueOf(intercept), "tol="+String.valueOf(epsilon), "reg=0.001",
-					"maxiter="+String.valueOf(maxiter), "model="+output("w"), "Log=\" \""};
+					"maxiter="+String.valueOf(maxiter), "model="+output("w"), "Log= "};
 
 			rCmd = getRCmd(inputDir(), String.valueOf(intercept),String.valueOf(epsilon),
 				String.valueOf(maxiter), expectedDir());