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,- Ternary,- TernaryAggregate,- Transform,- UAggOuterChain,- Unary,- UnaryCP,- WeightedCrossEntropy,- WeightedCrossEntropyR,- WeightedDivMM,- WeightedDivMMR,- WeightedSigmoid,- WeightedSigmoidR,- WeightedSquaredLoss,- WeightedSquaredLossR,- WeightedUnaryMM,- WeightedUnaryMMR
 
 public abstract class Lop extends Object Base class for all Lops.
- 
- 
Nested Class SummaryNested Classes Modifier and Type Class Description static classLop.SimpleInstTypeLop typesstatic classLop.Typestatic classLop.VisitStatus
 - 
Field SummaryFields Modifier and Type Field Description int_beginColumnint_beginLineint_endColumnint_endLineString_filenamestatic StringCP_CHILD_THREADstatic StringCP_ROOT_THREAD_IDstatic StringDATATYPE_PREFIXstatic StringFILE_SEPARATORstatic StringFRAME_VAR_NAME_PREFIXstatic StringINSTRUCTION_DELIMITORstatic StringLITERAL_PREFIXstatic StringMATRIX_VAR_NAME_PREFIXstatic StringNAME_VALUE_SEPARATORstatic StringOPERAND_DELIMITORstatic StringPROCESS_PREFIXstatic doubleSAMPLE_FRACTIONstatic StringSCALAR_VAR_NAME_PREFIXstatic StringUPDATE_INPLACE_PREFIXstatic StringVALUETYPE_PREFIXstatic StringVARIABLE_NAME_PLACEHOLDER
 - 
Constructor SummaryConstructors Constructor Description Lop(Lop.Type t, Types.DataType dt, Types.ValueType vt)Constructor to be invoked by base class.
 - 
Method SummaryAll Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidactivatePrefetch()voidaddInput(Lop op)Method to add input to LopvoidaddOutput(Lop op)Method to add output to LopvoidaddToDag(Dag<Lop> dag)Method to recursively add LOPS to a DAGboolean[]createReachable(int size)AggBinaryOp.SparkAggTypegetAggType()Method to get aggregate type if applicable.intgetBeginColumn()intgetBeginLine()LopgetBroadcastInput()Method to get the input to be broadcast.Types.DataTypegetDataType()get data type of the output that is produced by this lopintgetEndColumn()intgetEndLine()Types.ExecTypegetExecType()Method to get the execution type (CP, CP_FILE, MR, SPARK, GPU, FED, INVALID) of LOPFEDInstruction.FederatedOutputgetFederatedOutput()StringgetFilename()longgetID()Method to return the ID of LOPArrayList<Lop>getInputs()Method to get input of LopsStringgetInstructions()Method should be overridden if neededStringgetInstructions(int input, int rowl, int rowu, int coll, int colu, int leftRowDim, int leftColDim, int output)StringgetInstructions(String output)Method should be overridden if neededStringgetInstructions(String[] inputs, String outputs)StringgetInstructions(String[] inputs, String[] outputs)Method should be overridden if neededStringgetInstructions(String input1, String output)Method should be overridden if neededStringgetInstructions(String input1, String input2, String output)Method should be overridden if neededStringgetInstructions(String input1, String input2, String input3, String output)Method should be overridden if neededStringgetInstructions(String input1, String input2, String input3, String input4, String output)Method should be overridden if neededStringgetInstructions(String input1, String input2, String input3, String input4, String input5, String output)Method should be overridden if neededStringgetInstructions(String input1, String input2, String input3, String input4, String input5, String input6, String output)Method should be overridden if neededStringgetInstructions(String input1, String input2, String input3, String input4, String input5, String input6, String input7, String output)intgetLevel()OutputParametersgetOutputParameters()Method to get output parametersArrayList<Lop>getOutputs()Method to get output of LopsPrivacyConstraintgetPrivacyConstraint()booleangetProducesIntermediateOutput()boolean[]getReachable()Lop.SimpleInstTypegetSimpleInstructionType()Method should be overridden if neededLop.TypegetType()Method to get Lop type.Types.ValueTypegetValueType()get value type of the output that is produced by this lopLop.VisitStatusgetVisited()get visit status of nodebooleanisAllOutputsCP()Function that determines if all the outputs of a LOP are of CP execution typesbooleanisDataExecLocation()booleanisVariable()Function that determines if the output of a LOP is defined by a variable or not.booleanprefetchActivated()StringprepInputOperand(int index)StringprepInputOperand(String label)StringprepOperand(String label, Types.DataType dt, Types.ValueType vt)Method to prepare instruction operand with given parameters.StringprepOperand(String label, Types.DataType dt, Types.ValueType vt, boolean literal)Method to prepare instruction operand with given parameters.StringprepOutputOperand()StringprepOutputOperand(int index)StringprepOutputOperand(String label)StringprepScalarInputOperand(String label)StringprepScalarInputOperand(Types.ExecType et)StringprepScalarLabel()Function to prepare label for scalar inputs while generating instructions.StringprepScalarOperand(Types.ExecType et, String label)Function to be used in creating instructions for creating scalar operands.StringprintErrorLocation()intremoveConsumer()voidremoveOutput(Lop op)Method to remove output from LopvoidreplaceInput(Lop oldInp, Lop newInp)Method to replace an input to a LopvoidresetVisitStatus()voidsetAllPositions(String filename, int blp, int bcp, int elp, int ecp)voidsetBeginColumn(int passed)voidsetBeginLine(int passed)voidsetConsumerCount(int cc)voidsetDataType(Types.DataType dt)set 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)voidsetPrivacyConstraint(PrivacyConstraint privacy)Method to set privacy constraint of Lop.voidsetValueType(Types.ValueType vt)set value type of the output that is produced by this lopvoidsetVisited(Lop.VisitStatus visited)set visit status of nodeabstract StringtoString()Method to have Lops print their state.
 
- 
- 
- 
Field Detail- 
FILE_SEPARATORpublic static final String FILE_SEPARATOR - See Also:
- Constant Field Values
 
 - 
PROCESS_PREFIXpublic static final String PROCESS_PREFIX - See Also:
- Constant Field Values
 
 - 
CP_ROOT_THREAD_IDpublic static final String CP_ROOT_THREAD_ID - See Also:
- Constant Field Values
 
 - 
CP_CHILD_THREADpublic static final String CP_CHILD_THREAD - See Also:
- Constant Field Values
 
 - 
SAMPLE_FRACTIONpublic static final double SAMPLE_FRACTION - See Also:
- Constant Field Values
 
 - 
INSTRUCTION_DELIMITORpublic static final String INSTRUCTION_DELIMITOR - See Also:
- Constant Field Values
 
 - 
OPERAND_DELIMITORpublic static final String OPERAND_DELIMITOR - See Also:
- Constant Field Values
 
 - 
VALUETYPE_PREFIXpublic static final String VALUETYPE_PREFIX - See Also:
- Constant Field Values
 
 - 
DATATYPE_PREFIXpublic static final String DATATYPE_PREFIX - See Also:
- Constant Field Values
 
 - 
LITERAL_PREFIXpublic static final String LITERAL_PREFIX - See Also:
- Constant Field Values
 
 - 
VARIABLE_NAME_PLACEHOLDERpublic static final String VARIABLE_NAME_PLACEHOLDER - See Also:
- Constant Field Values
 
 - 
NAME_VALUE_SEPARATORpublic static final String NAME_VALUE_SEPARATOR - See Also:
- Constant Field Values
 
 - 
MATRIX_VAR_NAME_PREFIXpublic static final String MATRIX_VAR_NAME_PREFIX - See Also:
- Constant Field Values
 
 - 
FRAME_VAR_NAME_PREFIXpublic static final String FRAME_VAR_NAME_PREFIX - See Also:
- Constant Field Values
 
 - 
SCALAR_VAR_NAME_PREFIXpublic static final String SCALAR_VAR_NAME_PREFIX - See Also:
- Constant Field Values
 
 - 
UPDATE_INPLACE_PREFIXpublic static final String UPDATE_INPLACE_PREFIX - See Also:
- Constant Field Values
 
 - 
_beginLinepublic int _beginLine 
 - 
_beginColumnpublic int _beginColumn 
 - 
_endLinepublic int _endLine 
 - 
_endColumnpublic int _endColumn 
 - 
_filenamepublic String _filename 
 
- 
 - 
Constructor Detail- 
Loppublic Lop(Lop.Type t, Types.DataType dt, Types.ValueType vt) Constructor to be invoked by base class.- Parameters:
- t- lop type
- dt- data type of the output
- vt- value type of the output
 
 
- 
 - 
Method Detail- 
getVisitedpublic Lop.VisitStatus getVisited() get visit status of node- Returns:
- visit status
 
 - 
setVisitedpublic void setVisited(Lop.VisitStatus visited) set visit status of node- Parameters:
- visited- visit status
 
 - 
getReachablepublic boolean[] getReachable() 
 - 
createReachablepublic boolean[] createReachable(int size) 
 - 
isDataExecLocationpublic boolean isDataExecLocation() 
 - 
getDataTypepublic Types.DataType getDataType() get data type of the output that is produced by this lop- Returns:
- data type
 
 - 
setDataTypepublic void setDataType(Types.DataType dt) set data type of the output that is produced by this lop- Parameters:
- dt- data type
 
 - 
getValueTypepublic Types.ValueType getValueType() get value type of the output that is produced by this lop- Returns:
- value type
 
 - 
setValueTypepublic void setValueType(Types.ValueType vt) set value type of the output that is produced by this lop- Parameters:
- vt- value type
 
 - 
getTypepublic Lop.Type getType() Method to get Lop type.- Returns:
- lop type
 
 - 
getOutputspublic ArrayList<Lop> getOutputs() Method to get output of Lops- Returns:
- list of output lops
 
 - 
addInputpublic void addInput(Lop op) Method to add input to Lop- Parameters:
- op- input lop
 
 - 
replaceInputpublic void replaceInput(Lop oldInp, Lop newInp) Method to replace an input to a Lop- Parameters:
- oldInp- old input Lop
- newInp- new input Lop
 
 - 
addOutputpublic void addOutput(Lop op) Method to add output to Lop- Parameters:
- op- output lop
 
 - 
removeOutputpublic void removeOutput(Lop op) Method to remove output from Lop- Parameters:
- op- Lop to remove
 
 - 
setPrivacyConstraintpublic void setPrivacyConstraint(PrivacyConstraint privacy) Method to set privacy constraint of Lop.- Parameters:
- privacy- privacy constraint instance
 
 - 
getPrivacyConstraintpublic PrivacyConstraint getPrivacyConstraint() 
 - 
activatePrefetchpublic void activatePrefetch() 
 - 
prefetchActivatedpublic boolean prefetchActivated() 
 - 
setFederatedOutputpublic void setFederatedOutput(FEDInstruction.FederatedOutput fedOutput) 
 - 
getFederatedOutputpublic FEDInstruction.FederatedOutput getFederatedOutput() 
 - 
setConsumerCountpublic void setConsumerCount(int cc) 
 - 
removeConsumerpublic int removeConsumer() 
 - 
toStringpublic abstract String toString() Method to have Lops print their state. This is for debugging purposes.
 - 
resetVisitStatuspublic void resetVisitStatus() 
 - 
getIDpublic long getID() Method to return the ID of LOP- Returns:
- lop ID
 
 - 
getLevelpublic int getLevel() 
 - 
getExecTypepublic Types.ExecType getExecType() Method to get the execution type (CP, CP_FILE, MR, SPARK, GPU, FED, INVALID) of LOP- Returns:
- execution type
 
 - 
setExecTypepublic void setExecType(Types.ExecType newExecType) Set the execution type of LOP.- Parameters:
- newExecType- new execution type
 
 - 
getProducesIntermediateOutputpublic boolean getProducesIntermediateOutput() 
 - 
addToDagpublic final void addToDag(Dag<Lop> dag) Method to recursively add LOPS to a DAG- Parameters:
- dag- lop DAG
 
 - 
getOutputParameterspublic OutputParameters getOutputParameters() Method to get output parameters- Returns:
- output parameters
 
 - 
getAggTypepublic AggBinaryOp.SparkAggType getAggType() Method to get aggregate type if applicable. This method is overridden by the Lops with aggregate types (e.g. MapMult)- Returns:
- SparkAggType
 
 - 
getBroadcastInputpublic Lop 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
 
 - 
getInstructionspublic String getInstructions(String output) Method should be overridden if needed- Parameters:
- output- output
- Returns:
- instructions as string
 
 - 
getInstructionspublic String getInstructions(String input1, String output) Method should be overridden if needed- Parameters:
- input1- input 1
- output- output
- Returns:
- instructions as string
 
 - 
getInstructionspublic String getInstructions(String input1, String input2, String output) Method should be overridden if needed- Parameters:
- input1- input 1
- input2- input 2
- output- output
- Returns:
- instructions as string
 
 - 
getInstructionspublic String getInstructions(String input1, String input2, String input3, String output) Method should be overridden if needed- Parameters:
- input1- input 1
- input2- input 2
- input3- input 3
- output- output
- Returns:
- instructions as string
 
 - 
getInstructionspublic String getInstructions(String input1, String input2, String input3, String input4, String output) Method should be overridden if needed- Parameters:
- input1- input 1
- input2- input 2
- input3- input 3
- input4- input 4
- output- output
- Returns:
- instructions as string
 
 - 
getInstructionspublic String getInstructions(String input1, String input2, String input3, String input4, String input5, String output) Method should be overridden if needed- Parameters:
- input1- input 1
- input2- input 2
- input3- input 3
- input4- input 4
- input5- input 5
- output- output
- Returns:
- instructions as string
 
 - 
getInstructionspublic 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 1
- input2- input 2
- input3- input 3
- input4- input 4
- input5- input 5
- input6- input 6
- output- output
- Returns:
- instructions as string
 
 - 
getInstructionspublic String getInstructions(String input1, String input2, String input3, String input4, String input5, String input6, String input7, String output) 
 - 
getInstructionspublic String getInstructions(String[] inputs, String[] outputs) Method should be overridden if needed- Parameters:
- inputs- array of inputs
- outputs- array of outputs
- Returns:
- instructions as string
 
 - 
getInstructionspublic String getInstructions() Method should be overridden if needed- Returns:
- instructions as string
 
 - 
getSimpleInstructionTypepublic Lop.SimpleInstType getSimpleInstructionType() Method should be overridden if needed- Returns:
- simple instruction type
 
 - 
setBeginLinepublic void setBeginLine(int passed) 
 - 
setBeginColumnpublic void setBeginColumn(int passed) 
 - 
setEndLinepublic void setEndLine(int passed) 
 - 
setEndColumnpublic void setEndColumn(int passed) 
 - 
setFilenamepublic void setFilename(String passed) 
 - 
setAllPositionspublic void setAllPositions(String filename, int blp, int bcp, int elp, int ecp) 
 - 
getBeginLinepublic int getBeginLine() 
 - 
getBeginColumnpublic int getBeginColumn() 
 - 
getEndLinepublic int getEndLine() 
 - 
getEndColumnpublic int getEndColumn() 
 - 
getFilenamepublic String getFilename() 
 - 
printErrorLocationpublic String printErrorLocation() 
 - 
getInstructionspublic String getInstructions(int input, int rowl, int rowu, int coll, int colu, int leftRowDim, int leftColDim, int output) 
 - 
isVariablepublic 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
 
 - 
isAllOutputsCPpublic boolean isAllOutputsCP() Function that determines if all the outputs of a LOP are of CP execution types- Returns:
- true if all outputs are CP
 
 - 
prepOperandpublic String prepOperand(String label, Types.DataType dt, Types.ValueType vt) Method to prepare instruction operand with given parameters.- Parameters:
- label- instruction label
- dt- data type
- vt- value type
- Returns:
- instruction operand with data type and value type
 
 - 
prepOperandpublic String prepOperand(String label, Types.DataType dt, Types.ValueType vt, boolean literal) Method to prepare instruction operand with given parameters.- Parameters:
- label- instruction label
- dt- data type
- vt- value type
- literal- true if literal
- Returns:
- instruction operand with data type, value type, and literal status
 
 - 
prepOutputOperandpublic String prepOutputOperand() 
 - 
prepOutputOperandpublic String prepOutputOperand(int index) 
 - 
prepScalarLabelpublic String 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
 
 - 
prepScalarOperandpublic String prepScalarOperand(Types.ExecType et, String label) 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 type
- label- instruction label
- Returns:
- prepared scalar operand
 
 - 
prepScalarInputOperandpublic String prepScalarInputOperand(Types.ExecType et) 
 - 
prepInputOperandpublic String prepInputOperand(int index) 
 
- 
 
-