Class ParamservUtils
- java.lang.Object
- 
- org.apache.sysds.runtime.controlprogram.paramserv.ParamservUtils
 
- 
 public class ParamservUtils extends Object 
- 
- 
Field SummaryFields Modifier and Type Field Description static StringPS_FUNC_PREFIXstatic longSEED
 - 
Constructor SummaryConstructors Constructor Description ParamservUtils()
 - 
Method SummaryAll Methods Static Methods Concrete Methods Modifier and Type Method Description static ListObjectaccrueGradients(ListObject accGradients, ListObject gradients, boolean cleanup)Accumulate the given gradients into the accrued gradientsstatic ListObjectaccrueGradients(ListObject accGradients, ListObject gradients, boolean par, boolean cleanup)Accumulate the given gradients into the accrued gradientsstatic ListObjectaccrueModels(ListObject accModels, ListObject model, boolean cleanup)Accumulate the given models into the accrued accrueModelsstatic ListObjectaccrueModels(ListObject accModels, ListObject model, boolean par, boolean cleanup)Accumulate the given models into the accrued modelsstatic MatrixBlockcbindMatrix(MatrixBlock left, MatrixBlock right)static voidcleanupData(ExecutionContext ec, String varName)static voidcleanupData(ExecutionContext ec, Data data)static voidcleanupListObject(ExecutionContext ec, String lName)Clean up the list object according to its own data statusstatic voidcleanupListObject(ExecutionContext ec, String lName, boolean[] status)Clean up the list object according to the given array of data status (i.e., false => not be removed)static voidcleanupListObject(ExecutionContext ec, ListObject lo)static voidcleanupListObject(ExecutionContext ec, ListObject lo, boolean[] status)static voidcleanupListObject(ListObject lo)static List<ExecutionContext>copyExecutionContext(ExecutionContext ec, int num)static ListObjectcopyList(ListObject lo, boolean cleanup)Deep copy the list objectstatic ExecutionContextcreateExecutionContext(ExecutionContext ec, LocalVariableMap varsMap, String updFunc, String aggFunc, int k)static ExecutionContextcreateExecutionContext(ExecutionContext ec, LocalVariableMap varsMap, String updFunc, String aggFunc, int k, boolean forceExecTypeCP)static MatrixObjectcreateShallowCopy(MatrixObject mo)static MatrixBlockgeneratePermutation(int numEntries, long seed)Generate the permutationstatic MatrixBlockgenerateReplicationMatrix(int nsamples, int nrows, long seed)Generates a matrix which when left multiplied with the input matrix will replicate n data rowsstatic MatrixBlockgenerateSubsampleMatrix(int nsamples, int nrows, long seed)Generates a matrix which when left multiplied with the input matrix will subsamplestatic MatrixObjectnewMatrixObject(MatrixBlock mb)static MatrixObjectnewMatrixObject(MatrixBlock mb, boolean cleanup)static voidrecompileProgramBlocks(int k, List<ProgramBlock> pbs)static voidrecompileProgramBlocks(int k, List<ProgramBlock> pbs, boolean forceExecTypeCP)static MatrixObjectsliceMatrix(MatrixObject mo, long rl, long rh)Slice the matrixstatic MatrixBlocksliceMatrixBlock(MatrixBlock mb, long rl, long rh)Slice the matrix block and return a matrix block (used in spark)
 
- 
- 
- 
Field Detail- 
PS_FUNC_PREFIXpublic static final String PS_FUNC_PREFIX - See Also:
- Constant Field Values
 
 - 
SEEDpublic static long SEED 
 
- 
 - 
Method Detail- 
copyListpublic static ListObject copyList(ListObject lo, boolean cleanup) Deep copy the list object- Parameters:
- lo- list object
- cleanup- clean up the given list object
- Returns:
- a new copied list object
 
 - 
cleanupListObjectpublic static void cleanupListObject(ExecutionContext ec, String lName) Clean up the list object according to its own data status- Parameters:
- ec- execution context
- lName- list var name
 
 - 
cleanupListObjectpublic static void cleanupListObject(ExecutionContext ec, String lName, boolean[] status) Clean up the list object according to the given array of data status (i.e., false => not be removed)- Parameters:
- ec- execution context
- lName- list var name
- status- data status
 
 - 
cleanupListObjectpublic static void cleanupListObject(ExecutionContext ec, ListObject lo) 
 - 
cleanupListObjectpublic static void cleanupListObject(ExecutionContext ec, ListObject lo, boolean[] status) 
 - 
cleanupDatapublic static void cleanupData(ExecutionContext ec, Data data) 
 - 
cleanupDatapublic static void cleanupData(ExecutionContext ec, String varName) 
 - 
cleanupListObjectpublic static void cleanupListObject(ListObject lo) 
 - 
newMatrixObjectpublic static MatrixObject newMatrixObject(MatrixBlock mb) 
 - 
newMatrixObjectpublic static MatrixObject newMatrixObject(MatrixBlock mb, boolean cleanup) 
 - 
createShallowCopypublic static MatrixObject createShallowCopy(MatrixObject mo) 
 - 
sliceMatrixpublic static MatrixObject sliceMatrix(MatrixObject mo, long rl, long rh) Slice the matrix- Parameters:
- mo- input matrix
- rl- low boundary
- rh- high boundary
- Returns:
- new sliced matrix
 
 - 
sliceMatrixBlockpublic static MatrixBlock sliceMatrixBlock(MatrixBlock mb, long rl, long rh) Slice the matrix block and return a matrix block (used in spark)- Parameters:
- mb- input matrix
- rl- low boundary
- rh- high boundary
- Returns:
- new sliced matrix block
 
 - 
generatePermutationpublic static MatrixBlock generatePermutation(int numEntries, long seed) Generate the permutation- Parameters:
- numEntries- permutation size
- seed- seed used to generate random number
- Returns:
- permutation matrix
 
 - 
generateSubsampleMatrixpublic static MatrixBlock generateSubsampleMatrix(int nsamples, int nrows, long seed) Generates a matrix which when left multiplied with the input matrix will subsample- Parameters:
- nsamples- number of samples
- nrows- number of rows in input matrix
- seed- seed used to generate random number
- Returns:
- subsample matrix
 
 - 
generateReplicationMatrixpublic static MatrixBlock generateReplicationMatrix(int nsamples, int nrows, long seed) Generates a matrix which when left multiplied with the input matrix will replicate n data rows- Parameters:
- nsamples- number of samples
- nrows- number of rows in input matrix
- seed- seed used to generate random number
- Returns:
- replication matrix
 
 - 
createExecutionContextpublic static ExecutionContext createExecutionContext(ExecutionContext ec, LocalVariableMap varsMap, String updFunc, String aggFunc, int k) 
 - 
createExecutionContextpublic static ExecutionContext createExecutionContext(ExecutionContext ec, LocalVariableMap varsMap, String updFunc, String aggFunc, int k, boolean forceExecTypeCP) 
 - 
copyExecutionContextpublic static List<ExecutionContext> copyExecutionContext(ExecutionContext ec, int num) 
 - 
recompileProgramBlockspublic static void recompileProgramBlocks(int k, List<ProgramBlock> pbs)
 - 
recompileProgramBlockspublic static void recompileProgramBlocks(int k, List<ProgramBlock> pbs, boolean forceExecTypeCP)
 - 
cbindMatrixpublic static MatrixBlock cbindMatrix(MatrixBlock left, MatrixBlock right) 
 - 
accrueGradientspublic static ListObject accrueGradients(ListObject accGradients, ListObject gradients, boolean cleanup) Accumulate the given gradients into the accrued gradients- Parameters:
- accGradients- accrued gradients list object
- gradients- given gradients list object
- cleanup- clean up the given gradients list object
- Returns:
- new accrued gradients list object
 
 - 
accrueGradientspublic static ListObject accrueGradients(ListObject accGradients, ListObject gradients, boolean par, boolean cleanup) Accumulate the given gradients into the accrued gradients- Parameters:
- accGradients- accrued gradients list object
- gradients- given gradients list object
- par- parallel execution
- cleanup- clean up the given gradients list object
- Returns:
- new accrued gradients list object
 
 - 
accrueModelspublic static ListObject accrueModels(ListObject accModels, ListObject model, boolean cleanup) Accumulate the given models into the accrued accrueModels- Parameters:
- accModels- accrued models list object
- model- given models list object
- cleanup- clean up the given models list object
- Returns:
- new accrued models list object
 
 - 
accrueModelspublic static ListObject accrueModels(ListObject accModels, ListObject model, boolean par, boolean cleanup) Accumulate the given models into the accrued models- Parameters:
- accModels- accrued models list object
- model- given models list object
- par- parallel execution
- cleanup- clean up the given models list object
- Returns:
- new accrued models list object
 
 
- 
 
-