Baunsgaard commented on a change in pull request #966:
URL: https://github.com/apache/systemml/pull/966#discussion_r443135535



##########
File path: 
src/main/java/org/apache/sysds/runtime/instructions/fed/MultiReturnParameterizedBuiltinFEDInstruction.java
##########
@@ -0,0 +1,215 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.sysds.runtime.instructions.fed;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.Future;
+
+import org.apache.commons.lang3.tuple.ImmutablePair;
+import org.apache.commons.lang3.tuple.Pair;
+import org.apache.sysds.common.Types;
+import org.apache.sysds.runtime.DMLRuntimeException;
+import org.apache.sysds.runtime.controlprogram.caching.FrameObject;
+import org.apache.sysds.runtime.controlprogram.caching.MatrixObject;
+import org.apache.sysds.runtime.controlprogram.context.ExecutionContext;
+import org.apache.sysds.runtime.controlprogram.federated.FederatedData;
+import org.apache.sysds.runtime.controlprogram.federated.FederatedRange;
+import org.apache.sysds.runtime.controlprogram.federated.FederatedRequest;
+import org.apache.sysds.runtime.controlprogram.federated.FederatedResponse;
+import org.apache.sysds.runtime.instructions.InstructionUtils;
+import org.apache.sysds.runtime.instructions.cp.CPOperand;
+import org.apache.sysds.runtime.matrix.data.FrameBlock;
+import org.apache.sysds.runtime.matrix.operators.Operator;
+import org.apache.sysds.runtime.transform.encode.EncoderRecode;
+
+public class MultiReturnParameterizedBuiltinFEDInstruction extends 
ComputationFEDInstruction {
+       protected final ArrayList<CPOperand> _outputs;
+
+       private MultiReturnParameterizedBuiltinFEDInstruction(Operator op, 
CPOperand input1, CPOperand input2,
+               ArrayList<CPOperand> outputs, String opcode, String istr) {
+               super(FEDType.MultiReturnParameterizedBuiltin, op, input1, 
input2, outputs.get(0), opcode, istr);
+               _outputs = outputs;
+       }
+
+       public CPOperand getOutput(int i) {
+               return _outputs.get(i);
+       }
+
+       public static MultiReturnParameterizedBuiltinFEDInstruction 
parseInstruction(String str) {
+               String[] parts = 
InstructionUtils.getInstructionPartsWithValueType(str);
+               ArrayList<CPOperand> outputs = new ArrayList<>();
+               String opcode = parts[0];
+
+               if(opcode.equalsIgnoreCase("transformencode")) {
+                       // one input and two outputs
+                       CPOperand in1 = new CPOperand(parts[1]);
+                       CPOperand in2 = new CPOperand(parts[2]);
+                       outputs.add(new CPOperand(parts[3], 
Types.ValueType.FP64, Types.DataType.MATRIX));
+                       outputs.add(new CPOperand(parts[4], 
Types.ValueType.STRING, Types.DataType.FRAME));

Review comment:
       1. thing (log time ago i wrote this comment)
   2. It does not make sense while i'm looking at it again. since our 
`common/Types.java` doesn't contain such a DataType of FederatedMatrix nor 
FederatedFrame. (which i thought they did when i wrote the comment)
   3. I think it might make sense to have such abstractions making it easier in 
general to code federated operations. 
   
   Do you have any oppinions on this?
   
   If it is implemented like currently this I'm concerned about how many places 
it has to interact.
   Currently it requires us to put information about if the matrix or frame is 
federated into those objects, rather than leveraging that the object itself by 
type defines it.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to