Package org.apache.sysds.resource.cost

# Class CPCostUtils

java.lang.Object
org.apache.sysds.resource.cost.CPCostUtils

public class CPCostUtils extends Object

## Constructor Summary

Constructors
Constructor
Description
`CPCostUtils()`

## Method Summary

Modifier and Type
Method
Description
`static void`
`assignOutputMemoryStats(CPInstruction inst, VarStats output, VarStats... inputs)`
`static double`
`getBinaryInstTime(BinaryCPInstruction inst, VarStats input1, VarStats input2, VarStats weights, VarStats output, IOCostUtils.IOMetrics metrics)`
`static double`
`getBuiltinNaryInstTime(BuiltinNaryCPInstruction inst, VarStats[] inputs, VarStats output, IOCostUtils.IOMetrics metrics)`
`static double`
`getComputationInstTime(ComputationCPInstruction inst, VarStats input1, VarStats input2, VarStats input3, VarStats input4, VarStats output, IOCostUtils.IOMetrics metrics)`
`static double`
`getCPUTime(long nflop, IOCostUtils.IOMetrics driverMetrics, VarStats output, VarStats... inputs)`
`static double`
`getDataGenCPInstTime(UnaryCPInstruction inst, VarStats output, IOCostUtils.IOMetrics metrics)`
`static long`
`getInstNFLOP(CPInstruction.CPType instructionType, String opcode, VarStats output, VarStats... inputs)`
`static double`
`getMultiReturnBuiltinInstTime(MultiReturnBuiltinCPInstruction inst, VarStats input, VarStats[] outputs, IOCostUtils.IOMetrics metrics)`
`static double`
`getParameterizedBuiltinInstTime(ParameterizedBuiltinCPInstruction inst, VarStats input, VarStats output, IOCostUtils.IOMetrics metrics)`
`static double`
`getUnaryInstTime(UnaryCPInstruction inst, VarStats input, VarStats weights, VarStats output, IOCostUtils.IOMetrics metrics)`
`static double`
`getVariableInstTime(VariableCPInstruction inst, VarStats input, VarStats output, IOCostUtils.IOMetrics metrics)`
`static void`
`inferStats(CPInstruction.CPType instType, String opcode, VarStats output, VarStats... inputs)`
`static boolean`
`opcodeRequiresScan(String opcode)`

### Methods inherited from class java.lang.Object

`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### CPCostUtils

public CPCostUtils()

## Method Details

### getVariableInstTime

public static double getVariableInstTime(VariableCPInstruction inst, VarStats input, VarStats output, IOCostUtils.IOMetrics metrics)

### getDataGenCPInstTime

public static double getDataGenCPInstTime(UnaryCPInstruction inst, VarStats output, IOCostUtils.IOMetrics metrics)

### getUnaryInstTime

public static double getUnaryInstTime(UnaryCPInstruction inst, VarStats input, VarStats weights, VarStats output, IOCostUtils.IOMetrics metrics)

### getBinaryInstTime

public static double getBinaryInstTime(BinaryCPInstruction inst, VarStats input1, VarStats input2, VarStats weights, VarStats output, IOCostUtils.IOMetrics metrics)

### getComputationInstTime

public static double getComputationInstTime(ComputationCPInstruction inst, VarStats input1, VarStats input2, VarStats input3, VarStats input4, VarStats output, IOCostUtils.IOMetrics metrics)

### getBuiltinNaryInstTime

public static double getBuiltinNaryInstTime(BuiltinNaryCPInstruction inst, VarStats[] inputs, VarStats output, IOCostUtils.IOMetrics metrics)

### getParameterizedBuiltinInstTime

public static double getParameterizedBuiltinInstTime(ParameterizedBuiltinCPInstruction inst, VarStats input, VarStats output, IOCostUtils.IOMetrics metrics)

### getMultiReturnBuiltinInstTime

public static double getMultiReturnBuiltinInstTime(MultiReturnBuiltinCPInstruction inst, VarStats input, VarStats[] outputs, IOCostUtils.IOMetrics metrics)

### opcodeRequiresScan

public static boolean opcodeRequiresScan(String opcode)

### assignOutputMemoryStats

public static void assignOutputMemoryStats(CPInstruction inst, VarStats output, VarStats... inputs)

### inferStats

public static void inferStats(CPInstruction.CPType instType, String opcode, VarStats output, VarStats... inputs)

### getCPUTime

public static double getCPUTime(long nflop, IOCostUtils.IOMetrics driverMetrics, VarStats output, VarStats... inputs)

### getInstNFLOP

public static long getInstNFLOP(CPInstruction.CPType instructionType, String opcode, VarStats output, VarStats... inputs)

Parameters:
  `instructionType` - instruction type
  `opcode` - instruction opcode, potentially with suffix to mark an extra op. characteristic
  `output` - output's variable statistics, null is not needed for the estimation
  `inputs` - any inputs' variable statistics, no object passed is not needed for estimation
Returns:
  estimated number of floating point operations