use of com.tencent.angel.ps.storage.vector.ServerLongIntRow in project angel by Tencent.
the class RowSplitCombineUtils method combineServerLongIntRowSplits.
private static Vector combineServerLongIntRowSplits(List<ServerRow> rowSplits, MatrixMeta matrixMeta, int rowIndex) {
long colNum = matrixMeta.getColNum();
int elemNum = 0;
int size = rowSplits.size();
for (int i = 0; i < size; i++) {
elemNum += rowSplits.get(i).size();
}
LongIntVector row = VFactory.sparseLongKeyIntVector(colNum, elemNum);
row.setMatrixId(matrixMeta.getId());
row.setRowId(rowIndex);
Collections.sort(rowSplits, serverRowComp);
int clock = Integer.MAX_VALUE;
for (int i = 0; i < size; i++) {
if (rowSplits.get(i) == null) {
continue;
}
if (rowSplits.get(i).getClock() < clock) {
clock = rowSplits.get(i).getClock();
}
((ServerLongIntRow) rowSplits.get(i)).mergeTo(row);
}
row.setClock(clock);
return row;
}
use of com.tencent.angel.ps.storage.vector.ServerLongIntRow in project angel by Tencent.
the class GetOutDegreeFunc method partitionGet.
@Override
public PartitionGetResult partitionGet(PartitionGetParam partParam) {
PartGetOutDegreeParam param = (PartGetOutDegreeParam) partParam;
ServerMatrix matrix = psContext.getMatrixStorageManager().getMatrix(partParam.getMatrixId());
ServerPartition part = matrix.getPartition(partParam.getPartKey().getPartitionId());
ServerLongIntRow row = (ServerLongIntRow) (((RowBasedPartition) part).getRow(0));
long[] nodeIds = param.getNodeIds();
int[] outDegrees = new int[nodeIds.length];
for (int i = 0; i < nodeIds.length; i++) {
outDegrees[i] = row.get(nodeIds[i]);
}
return new PartGetOutDegreeResult(part.getPartitionKey().getPartitionId(), outDegrees);
}
use of com.tencent.angel.ps.storage.vector.ServerLongIntRow in project angel by Tencent.
the class MergeUtils method combineServerLongIntRowSplits.
private static Vector combineServerLongIntRowSplits(List<ServerRow> rowSplits, MatrixMeta matrixMeta, int rowIndex) {
long colNum = matrixMeta.getColNum();
int elemNum = 0;
int size = rowSplits.size();
for (int i = 0; i < size; i++) {
elemNum += rowSplits.get(i).size();
}
LongIntVector row = VFactory.sparseLongKeyIntVector(colNum, elemNum);
row.setMatrixId(matrixMeta.getId());
row.setRowId(rowIndex);
Collections.sort(rowSplits, serverRowComp);
for (int i = 0; i < size; i++) {
if (rowSplits.get(i) == null) {
continue;
}
((ServerLongIntRow) rowSplits.get(i)).mergeTo(row);
}
return row;
}
use of com.tencent.angel.ps.storage.vector.ServerLongIntRow 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.vector.ServerLongIntRow in project angel by Tencent.
the class ReadTag method partitionGet.
@Override
public PartitionGetResult partitionGet(PartitionGetParam partParam) {
GeneralPartGetParam param = (GeneralPartGetParam) partParam;
KeyPart keyPart = param.getIndicesPart();
long[] nodeIds = ((ILongKeyPartOp) keyPart).getKeys();
ServerLongIntRow row = GraphMatrixUtils.getPSLongKeyIntRow(psContext, param, param.getRowId());
DynamicLongArray nodes = new DynamicLongArray(nodeIds.length);
for (int i = 0; i < nodeIds.length; i++) {
long nodeId = nodeIds[i];
if (row.get(nodeId) > 0) {
nodes.add(nodeId);
}
}
return new PartReadTagResult(nodes.getData());
}
Aggregations