use of com.tencent.angel.ps.storage.partition.RowBasedPartition in project angel by Tencent.
the class GraphMatrixUtils method getPSIntKeyRow.
public static ServerIntAnyRow getPSIntKeyRow(PSContext psContext, GeneralPartUpdateParam partParam) {
ServerMatrix matrix = psContext.getMatrixStorageManager().getMatrix(partParam.getMatrixId());
ServerPartition part = matrix.getPartition(partParam.getPartKey().getPartitionId());
return (ServerIntAnyRow) (((RowBasedPartition) part).getRow(0));
}
use of com.tencent.angel.ps.storage.partition.RowBasedPartition in project angel by Tencent.
the class GraphMatrixUtils method getPSIntKeyRow.
public static ServerIntAnyRow getPSIntKeyRow(PSContext psContext, PartitionGetParam partParam) {
ServerMatrix matrix = psContext.getMatrixStorageManager().getMatrix(partParam.getMatrixId());
ServerPartition part = matrix.getPartition(partParam.getPartKey().getPartitionId());
return (ServerIntAnyRow) (((RowBasedPartition) part).getRow(0));
}
use of com.tencent.angel.ps.storage.partition.RowBasedPartition in project angel by Tencent.
the class GetColsFunc method partitionGet.
@Override
public PartitionGetResult partitionGet(PartitionGetParam partParam) {
PartitionGetColsParam param = (PartitionGetColsParam) partParam;
int[] rows = param.rows;
long[] cols = param.cols;
int matId = param.getMatrixId();
int partitionId = param.getPartKey().getPartitionId();
Arrays.sort(rows);
RowBasedPartition partition = (RowBasedPartition) psContext.getMatrixStorageManager().getPart(matId, partitionId);
ServerRow[] splits = new ServerRow[rows.length];
for (int i = 0; i < rows.length; i++) {
splits[i] = partition.getRow(rows[i]);
}
Vector result = doGet(splits, cols, param.func);
return new PartitionGetColsResult(rows, cols, result);
}
use of com.tencent.angel.ps.storage.partition.RowBasedPartition in project angel by Tencent.
the class GraphMatrixUtils method getPSLongKeyIntRow.
public static ServerLongIntRow getPSLongKeyIntRow(PSContext psContext, PartitionGetParam partParam, int rowId) {
ServerMatrix matrix = psContext.getMatrixStorageManager().getMatrix(partParam.getMatrixId());
ServerPartition part = matrix.getPartition(partParam.getPartKey().getPartitionId());
return (ServerLongIntRow) (((RowBasedPartition) part).getRow(rowId));
}
use of com.tencent.angel.ps.storage.partition.RowBasedPartition in project angel by Tencent.
the class UpdateColsFunc method partitionUpdate.
@Override
public void partitionUpdate(PartitionUpdateParam partParam) {
PartitionUpdateColsParam param = (PartitionUpdateColsParam) partParam;
int[] rows = param.rows;
long[] cols = param.cols;
Vector vector = param.vector;
UpdateOp op = param.op;
int matId = param.getMatrixId();
int partitionId = param.getPartKey().getPartitionId();
RowBasedPartition partition = (RowBasedPartition) psContext.getMatrixStorageManager().getPart(matId, partitionId);
switch(partition.getRowType()) {
case T_DOUBLE_DENSE:
case T_DOUBLE_SPARSE:
{
ServerIntDoubleRow[] doubles = new ServerIntDoubleRow[rows.length];
for (int r = 0; r < rows.length; r++) doubles[r] = (ServerIntDoubleRow) partition.getRow(rows[r]);
doUpdate((CompIntDoubleVector) vector, rows, cols, doubles, op);
return;
}
case T_DOUBLE_SPARSE_LONGKEY:
{
ServerLongDoubleRow[] doubles = new ServerLongDoubleRow[rows.length];
for (int r = 0; r < rows.length; r++) doubles[r] = (ServerLongDoubleRow) partition.getRow(rows[r]);
doUpdate((CompIntDoubleVector) vector, rows, cols, doubles, op);
return;
}
case T_FLOAT_DENSE:
case T_FLOAT_SPARSE:
{
ServerIntFloatRow[] floats = new ServerIntFloatRow[rows.length];
for (int r = 0; r < rows.length; r++) floats[r] = (ServerIntFloatRow) partition.getRow(rows[r]);
doUpdate((CompIntFloatVector) vector, rows, cols, floats, op);
return;
}
case T_FLOAT_SPARSE_LONGKEY:
{
ServerLongFloatRow[] floats = new ServerLongFloatRow[rows.length];
for (int r = 0; r < rows.length; r++) floats[r] = (ServerLongFloatRow) partition.getRow(rows[r]);
doUpdate((CompIntFloatVector) vector, rows, cols, floats, op);
return;
}
default:
throw new AngelException("Data type should be double or float!");
}
}
Aggregations