Package org.apache.sysds.lops
Class Lop
java.lang.Object
org.apache.sysds.lops.Lop
- Direct Known Subclasses:
Append,AppendG,AppendGAlignedSP,AppendM,AppendR,Binary,BinaryM,BinaryScalar,BinaryUAggChain,CentralMoment,Checkpoint,Compression,CoVariance,CSVReBlock,Ctable,CumulativeOffsetBinary,CumulativePartialAggregate,Data,DataGen,DeCompression,DnnTransform,Federated,FunctionCallCP,GroupedAggregate,GroupedAggregateM,LeftIndex,Local,MapMult,MapMultChain,MatMultCP,MMCJ,MMRJ,MMTSJ,MMZip,Nary,ParameterizedBuiltin,PartialAggregate,PickByCount,PMapMult,PMMJ,ReBlock,RightIndex,SortKeys,SpoofFused,Sql,Tee,Ternary,TernaryAggregate,Transform,UAggOuterChain,Unary,UnaryCP,WeightedCrossEntropy,WeightedCrossEntropyR,WeightedDivMM,WeightedDivMMR,WeightedSigmoid,WeightedSigmoidR,WeightedSquaredLoss,WeightedSquaredLossR,WeightedUnaryMM,WeightedUnaryMMR
Base class for all Lops.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumLop typesstatic enumstatic enum -
Field Summary
FieldsModifier and TypeFieldDescriptionintintintintstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final String -
Constructor Summary
ConstructorsConstructorDescriptionLop(Lop.Type t, Types.DataType dt, Types.ValueType vt) Constructor to be invoked by base class. -
Method Summary
Modifier and TypeMethodDescriptionvoidvoidMethod to add input to LopvoidMethod to add output to Lopfinal voidMethod to recursively add LOPS to a DAGboolean[]createReachable(int size) Method to get aggregate type if applicable.intintMethod to get the input to be broadcast.doubleget data type of the output that is produced by this lopintintMethod to get the execution type (CP, CP_FILE, MR, SPARK, GPU, FED, INVALID) of LOPlonggetID()Method to return the ID of LOPgetInput(int index) Method to get input of LopsMethod should be overridden if neededgetInstructions(int input, int rowl, int rowu, int coll, int colu, int leftRowDim, int leftColDim, int output) getInstructions(String output) Method should be overridden if neededgetInstructions(String[] inputs, String outputs) getInstructions(String[] inputs, String[] outputs) Method should be overridden if neededgetInstructions(String input1, String output) Method should be overridden if neededgetInstructions(String input1, String input2, String output) Method should be overridden if neededgetInstructions(String input1, String input2, String input3, String output) Method should be overridden if neededMethod should be overridden if neededgetInstructions(String input1, String input2, String input3, String input4, String input5, String output) Method should be overridden if neededgetInstructions(String input1, String input2, String input3, String input4, String input5, String input6, String output) Method should be overridden if neededgetInstructions(String input1, String input2, String input3, String input4, String input5, String input6, String input7, String output) intgetLevel()longgetNnz()longlongdoubleMethod to get output parametersMethod to get output of Lopsintbooleanboolean[]Method should be overridden if neededdoublegetType()Method to get Lop type.get value type of the output that is produced by this lopget visit status of nodebooleanFunction that determines if all the outputs of a LOP are of CP execution typesbooleanFunction that determines if all the outputs of a LOP are of GPU execution typesbooleanbooleanbooleanisExecCP()booleanbooleanbooleanFunction that determines if the output of a LOP is defined by a variable or not.booleanbooleanprepInputOperand(int index) prepInputOperand(String label) prepOperand(String label, Types.DataType dt, Types.ValueType vt) Method to prepare instruction operand with given parameters.prepOperand(String label, Types.DataType dt, Types.ValueType vt, boolean literal) Method to prepare instruction operand with given parameters.prepOutputOperand(int index) prepOutputOperand(String label) prepScalarInputOperand(String label) Function to prepare label for scalar inputs while generating instructions.prepScalarOperand(Types.ExecType et, String label) Function to be used in creating instructions for creating scalar operands.intvoidremoveInput(Lop op) voidremoveOutput(Lop op) Method to remove output from LopvoidreplaceAllInputs(ArrayList<Lop> newInputs) voidreplaceAllOutputs(ArrayList<Lop> newOutputs) voidreplaceInput(Lop oldInp, Lop newInp) Method to replace an input to a LopvoidvoidsetAllPositions(String filename, int blp, int bcp, int elp, int ecp) voidsetAsynchronous(boolean isAsync) voidsetBeginColumn(int passed) voidsetBeginLine(int passed) voidsetComputeEstimate(double compCost) voidsetConsumerCount(int cc) voidset data type of the output that is produced by this lopvoidsetEndColumn(int passed) voidsetEndLine(int passed) voidsetExecType(Types.ExecType newExecType) Set the execution type of LOP.voidsetFederatedOutput(FEDInstruction.FederatedOutput fedOutput) voidsetFilename(String passed) voidsetMemoryEstimates(double outMem, double totMem, double interMem, double bcMem) voidsetNewID()voidsetPipelineID(int id) voidset value type of the output that is produced by this lopvoidvoidsetVisited(Lop.VisitStatus visited) set visit status of nodeabstract StringtoString()Method to have Lops print their state.
-
Field Details
-
FILE_SEPARATOR
- See Also:
-
PROCESS_PREFIX
- See Also:
-
CP_ROOT_THREAD_ID
- See Also:
-
CP_CHILD_THREAD
- See Also:
-
INSTRUCTION_DELIMITOR
- See Also:
-
OPERAND_DELIMITOR
- See Also:
-
VALUETYPE_PREFIX
- See Also:
-
DATATYPE_PREFIX
- See Also:
-
LITERAL_PREFIX
- See Also:
-
VARIABLE_NAME_PLACEHOLDER
- See Also:
-
NAME_VALUE_SEPARATOR
- See Also:
-
MATRIX_VAR_NAME_PREFIX
- See Also:
-
FRAME_VAR_NAME_PREFIX
- See Also:
-
SCALAR_VAR_NAME_PREFIX
- See Also:
-
UPDATE_INPLACE_PREFIX
- See Also:
-
_beginLine
public int _beginLine -
_beginColumn
public int _beginColumn -
_endLine
public int _endLine -
_endColumn
public int _endColumn -
_filename
-
-
Constructor Details
-
Lop
Constructor to be invoked by base class.- Parameters:
t- lop typedt- data type of the outputvt- value type of the output
-
-
Method Details
-
getVisited
get visit status of node- Returns:
- visit status
-
setVisited
set visit status of node- Parameters:
visited- visit status
-
setVisited
public void setVisited() -
isVisited
public boolean isVisited() -
getReachable
public boolean[] getReachable() -
createReachable
public boolean[] createReachable(int size) -
isDataExecLocation
public boolean isDataExecLocation() -
getDataType
get data type of the output that is produced by this lop- Returns:
- data type
-
setDataType
set data type of the output that is produced by this lop- Parameters:
dt- data type
-
getValueType
get value type of the output that is produced by this lop- Returns:
- value type
-
setValueType
set value type of the output that is produced by this lop- Parameters:
vt- value type
-
getType
Method to get Lop type.- Returns:
- lop type
-
getInputs
Method to get input of Lops- Returns:
- list of input lops
-
getInput
-
getOutputs
Method to get output of Lops- Returns:
- list of output lops
-
addInput
Method to add input to Lop- Parameters:
op- input lop
-
replaceInput
Method to replace an input to a Lop- Parameters:
oldInp- old input LopnewInp- new input Lop
-
replaceAllInputs
-
replaceAllOutputs
-
removeInput
-
addOutput
Method to add output to Lop- Parameters:
op- output lop
-
removeOutput
Method to remove output from Lop- Parameters:
op- Lop to remove
-
activatePrefetch
public void activatePrefetch() -
prefetchActivated
public boolean prefetchActivated() -
setFederatedOutput
-
getFederatedOutput
-
setConsumerCount
public void setConsumerCount(int cc) -
removeConsumer
public int removeConsumer() -
setAsynchronous
public void setAsynchronous(boolean isAsync) -
isAsynchronousOp
public boolean isAsynchronousOp() -
setPipelineID
public void setPipelineID(int id) -
getPipelineID
public int getPipelineID() -
setMemoryEstimates
public void setMemoryEstimates(double outMem, double totMem, double interMem, double bcMem) -
getTotalMemoryEstimate
public double getTotalMemoryEstimate() -
getOutputMemoryEstimate
public double getOutputMemoryEstimate() -
setComputeEstimate
public void setComputeEstimate(double compCost) -
getComputeEstimate
public double getComputeEstimate() -
toString
Method to have Lops print their state. This is for debugging purposes. -
resetVisitStatus
public void resetVisitStatus() -
getID
public long getID()Method to return the ID of LOP- Returns:
- lop ID
-
setNewID
public void setNewID() -
getLevel
public int getLevel() -
getExecType
Method to get the execution type (CP, CP_FILE, MR, SPARK, GPU, FED, INVALID) of LOP- Returns:
- execution type
-
setExecType
Set the execution type of LOP.- Parameters:
newExecType- new execution type
-
isExecSpark
public boolean isExecSpark() -
isExecGPU
public boolean isExecGPU() -
isExecCP
public boolean isExecCP() -
getProducesIntermediateOutput
public boolean getProducesIntermediateOutput() -
addToDag
Method to recursively add LOPS to a DAG- Parameters:
dag- lop DAG
-
getOutputParameters
Method to get output parameters- Returns:
- output parameters
-
getNumRows
public long getNumRows() -
getNumCols
public long getNumCols() -
getNnz
public long getNnz() -
getAggType
Method to get aggregate type if applicable. This method is overridden by the Lops with aggregate types (e.g. MapMult)- Returns:
- SparkAggType
-
getBroadcastInput
Method to get the input to be broadcast. This method is overridden by the Lops which require broadcasts (e.g. AppendM)- Returns:
- An input Lop or Null
-
getInstructions
Method should be overridden if needed- Parameters:
output- output- Returns:
- instructions as string
-
getInstructions
Method should be overridden if needed- Parameters:
input1- input 1output- output- Returns:
- instructions as string
-
getInstructions
Method should be overridden if needed- Parameters:
input1- input 1input2- input 2output- output- Returns:
- instructions as string
-
getInstructions
Method should be overridden if needed- Parameters:
input1- input 1input2- input 2input3- input 3output- output- Returns:
- instructions as string
-
getInstructions
public String getInstructions(String input1, String input2, String input3, String input4, String output) Method should be overridden if needed- Parameters:
input1- input 1input2- input 2input3- input 3input4- input 4output- output- Returns:
- instructions as string
-
getInstructions
public String getInstructions(String input1, String input2, String input3, String input4, String input5, String output) Method should be overridden if needed- Parameters:
input1- input 1input2- input 2input3- input 3input4- input 4input5- input 5output- output- Returns:
- instructions as string
-
getInstructions
public String getInstructions(String input1, String input2, String input3, String input4, String input5, String input6, String output) Method should be overridden if needed- Parameters:
input1- input 1input2- input 2input3- input 3input4- input 4input5- input 5input6- input 6output- output- Returns:
- instructions as string
-
getInstructions
-
getInstructions
-
getInstructions
Method should be overridden if needed- Parameters:
inputs- array of inputsoutputs- array of outputs- Returns:
- instructions as string
-
getInstructions
Method should be overridden if needed- Returns:
- instructions as string
-
getSimpleInstructionType
Method should be overridden if needed- Returns:
- simple instruction type
-
setBeginLine
public void setBeginLine(int passed) -
setBeginColumn
public void setBeginColumn(int passed) -
setEndLine
public void setEndLine(int passed) -
setEndColumn
public void setEndColumn(int passed) -
setFilename
-
setAllPositions
-
getBeginLine
public int getBeginLine() -
getBeginColumn
public int getBeginColumn() -
getEndLine
public int getEndLine() -
getEndColumn
public int getEndColumn() -
getFilename
-
printErrorLocation
-
getInstructions
public String getInstructions(int input, int rowl, int rowu, int coll, int colu, int leftRowDim, int leftColDim, int output) -
isVariable
public boolean isVariable()Function that determines if the output of a LOP is defined by a variable or not.- Returns:
- true if lop output defined by a variable
-
isAllOutputsCP
public boolean isAllOutputsCP()Function that determines if all the outputs of a LOP are of CP execution types- Returns:
- true if all outputs are CP
-
isAllOutputsGPU
public boolean isAllOutputsGPU()Function that determines if all the outputs of a LOP are of GPU execution types- Returns:
- true if all outputs are CP
-
prepOperand
Method to prepare instruction operand with given parameters.- Parameters:
label- instruction labeldt- data typevt- value type- Returns:
- instruction operand with data type and value type
-
prepOperand
Method to prepare instruction operand with given parameters.- Parameters:
label- instruction labeldt- data typevt- value typeliteral- true if literal- Returns:
- instruction operand with data type, value type, and literal status
-
prepOutputOperand
-
prepOutputOperand
-
prepOutputOperand
-
prepScalarLabel
Function to prepare label for scalar inputs while generating instructions. It attaches placeholder suffix and prefixes if the Lop denotes a variable.- Returns:
- prepared scalar label
-
prepScalarOperand
Function to be used in creating instructions for creating scalar operands. It decides whether or not attach placeholders for instruction patching. Resulting string also encodes if the operand is a literal. For non-literals: Placeholder prefix and suffix need to be attached for Instruction Patching during execution. However, they should NOT be attached IF: - the operand is a literal OR - the execution type is CP. This is because CP runtime has access to symbol table and the instruction encodes sufficient information to determine if an operand is a literal or not.- Parameters:
et- execution typelabel- instruction label- Returns:
- prepared scalar operand
-
prepScalarInputOperand
-
prepScalarInputOperand
-
prepInputOperand
-
prepInputOperand
-