use of com.tencent.angel.ps.storage.vector.ServerLongLongRow in project angel by Tencent.
the class GetNumNeighborEdgesFunc method partitionGet.
@Override
public PartitionGetResult partitionGet(PartitionGetParam partParam) {
PartGetNumNeighborEdgesParam param = (PartGetNumNeighborEdgesParam) partParam;
ServerMatrix matrix = psContext.getMatrixStorageManager().getMatrix(partParam.getMatrixId());
ServerPartition part = matrix.getPartition(partParam.getPartKey().getPartitionId());
ServerLongLongRow row = (ServerLongLongRow) (((RowBasedPartition) part).getRow(0));
long[] nodeIds = param.getNodeIds();
long[] numEdges = new long[nodeIds.length];
for (int i = 0; i < nodeIds.length; i++) {
numEdges[i] = row.get(nodeIds[i]);
}
return new PartGetNumNeighborEdgesResult(part.getPartitionKey().getPartitionId(), numEdges);
}
use of com.tencent.angel.ps.storage.vector.ServerLongLongRow in project angel by Tencent.
the class MergeUtils method combineServerLongLongRowSplits.
private static Vector combineServerLongLongRowSplits(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();
}
LongLongVector row = VFactory.sparseLongKeyLongVector(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;
}
((ServerLongLongRow) rowSplits.get(i)).mergeTo(row);
}
return row;
}
use of com.tencent.angel.ps.storage.vector.ServerLongLongRow in project angel by Tencent.
the class RowSplitCombineUtils method combineServerLongLongRowSplits.
private static Vector combineServerLongLongRowSplits(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();
}
LongLongVector row = VFactory.sparseLongKeyLongVector(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();
}
((ServerLongLongRow) rowSplits.get(i)).mergeTo(row);
}
row.setClock(clock);
return row;
}
use of com.tencent.angel.ps.storage.vector.ServerLongLongRow in project angel by Tencent.
the class InitNumNeighborEdgesFunc method partitionUpdate.
@Override
public void partitionUpdate(PartitionUpdateParam partParam) {
PartInitNumNeighborEdgesParam param = (PartInitNumNeighborEdgesParam) partParam;
ServerMatrix matrix = psContext.getMatrixStorageManager().getMatrix(partParam.getMatrixId());
RowBasedPartition part = (RowBasedPartition) matrix.getPartition(partParam.getPartKey().getPartitionId());
ServerLongLongRow row = (ServerLongLongRow) part.getRow(0);
ObjectIterator<Long2LongMap.Entry> iter = param.getNodeIdToNumEdges().long2LongEntrySet().iterator();
row.startWrite();
try {
while (iter.hasNext()) {
Long2LongMap.Entry entry = iter.next();
row.set(entry.getLongKey(), entry.getLongValue());
}
} finally {
row.endWrite();
}
}
Aggregations