This is an automated email from the ASF dual-hosted git repository.

mboehm7 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/systemds.git


The following commit(s) were added to refs/heads/master by this push:
     new d43cc72  [SYSTEMDS-2953] Fix robustness parfor program serialization
d43cc72 is described below

commit d43cc728a9dfb7e0164c741a1d73f010896b7d45
Author: Matthias Boehm <[email protected]>
AuthorDate: Mon Jun 7 11:38:40 2021 +0200

    [SYSTEMDS-2953] Fix robustness parfor program serialization
---
 .../sysds/runtime/util/ProgramConverter.java       | 25 +++++++---------------
 1 file changed, 8 insertions(+), 17 deletions(-)

diff --git a/src/main/java/org/apache/sysds/runtime/util/ProgramConverter.java 
b/src/main/java/org/apache/sysds/runtime/util/ProgramConverter.java
index ae27d6c..e3213f4 100644
--- a/src/main/java/org/apache/sysds/runtime/util/ProgramConverter.java
+++ b/src/main/java/org/apache/sysds/runtime/util/ProgramConverter.java
@@ -1120,14 +1120,15 @@ public class ProgramConverter
                for( String fkey : prog.getFunctionProgramBlocks().keySet() ) {
                        if( !cand.contains(fkey) ) //skip function not included 
in the parfor body
                                continue;
-                       if( count>0 ) {
+                       if( count>0 )
                                sb.append( ELEMENT_DELIM );
-                       }
                        sb.append( fkey );
                        sb.append( KEY_VALUE_DELIM );
                        FunctionProgramBlock fpb1 = 
prog.getFunctionProgramBlock(fkey, true);
                        sb.append( rSerializeProgramBlock(fpb1, clsMap) );
                        if( prog.containsFunctionProgramBlock(fkey, false) ) {
+                               sb.append( ELEMENT_DELIM );
+                               sb.append( fkey );
                                sb.append( KEY_VALUE_DELIM );
                                FunctionProgramBlock fpb2 = 
prog.getFunctionProgramBlock(fkey, false);
                                sb.append( rSerializeProgramBlock(fpb2, clsMap) 
);
@@ -1392,21 +1393,11 @@ public class ProgramConverter
                        String lvar  = st.nextToken(); //with ID = 
CP_CHILD_THREAD+id for current use
                        //put first copy into prog (for direct use)
                        int index = lvar.indexOf( KEY_VALUE_DELIM );
-                       String tmp1 = lvar.substring(0, index);
-                       String tmp2 = lvar.substring(index + 1);
-                       if( tmp2.contains(KEY_VALUE_DELIM) ) {
-                               int index2 = tmp2.indexOf( KEY_VALUE_DELIM );
-                               String tmp21 = tmp2.substring(0, index2);
-                               String tmp22 = tmp2.substring(index2 + 1);
-                               prog.addFunctionProgramBlock(tmp1,
-                                       
(FunctionProgramBlock)rParseProgramBlock(tmp21, prog, id), true);
-                               prog.addFunctionProgramBlock(tmp1,
-                                       
(FunctionProgramBlock)rParseProgramBlock(tmp22, prog, id), false);
-                       }
-                       else {
-                               prog.addFunctionProgramBlock(tmp1,
-                                       
(FunctionProgramBlock)rParseProgramBlock(tmp2, prog, id), true);
-                       }
+                       String fkey = lvar.substring(0, index);
+                       String tmp = lvar.substring(index + 1);
+                       boolean opt = !prog.containsFunctionProgramBlock(fkey, 
true);
+                       prog.addFunctionProgramBlock(fkey,
+                               (FunctionProgramBlock)rParseProgramBlock(tmp, 
prog, id), opt);
                }
                return ret;
        }

Reply via email to