use of com.tencent.angel.ps.storage.partition.RowBasedPartition in project angel by Tencent.
the class MatrixUtils method getRow.
public static ServerRow getRow(MatrixStorageManager storageManager, int matrixId, int partId, int rowId) {
ServerMatrix matrix = storageManager.getMatrix(matrixId);
if (matrix == null) {
throw new ObjectNotFoundException("Can not find matrix " + matrixId);
}
ServerPartition part = matrix.getPartition(partId);
if (part == null) {
throw new ObjectNotFoundException("Can not find partition " + partId + " of matrix " + matrixId);
}
if (!(part instanceof RowBasedPartition)) {
throw new UnsupportedOperationException("Get row only support for RowBasedPartition");
}
ServerRow row = ((RowBasedPartition) part).getRow(rowId);
if (row == null) {
throw new ObjectNotFoundException("Can not find row " + rowId + " of matrix " + matrixId + " in partition " + partId);
}
return row;
}
use of com.tencent.angel.ps.storage.partition.RowBasedPartition 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();
}
}
use of com.tencent.angel.ps.storage.partition.RowBasedPartition in project angel by Tencent.
the class ResetFunc method partitionUpdate.
@Override
public void partitionUpdate(PartitionUpdateParam partParam) {
RowBasedPartition part = (RowBasedPartition) psContext.getMatrixStorageManager().getPart(partParam.getMatrixId(), partParam.getPartKey().getPartitionId());
if (part != null) {
int startRow = part.getPartitionKey().getStartRow();
int endRow = part.getPartitionKey().getEndRow();
for (int i = startRow; i < endRow; i++) {
ServerRow row = part.getRow(i);
if (row == null) {
continue;
}
row.reset();
// reset(row);
}
}
}
use of com.tencent.angel.ps.storage.partition.RowBasedPartition in project angel by Tencent.
the class GraphMatrixUtils method getPSLongKeyRow.
public static ServerLongAnyRow getPSLongKeyRow(PSContext psContext, PartitionUpdateParam partParam) {
ServerMatrix matrix = psContext.getMatrixStorageManager().getMatrix(partParam.getMatrixId());
ServerPartition part = matrix.getPartition(partParam.getPartKey().getPartitionId());
return (ServerLongAnyRow) (((RowBasedPartition) part).getRow(0));
}
use of com.tencent.angel.ps.storage.partition.RowBasedPartition in project angel by Tencent.
the class GraphMatrixUtils method getPSLongKeyRow.
public static ServerLongAnyRow getPSLongKeyRow(PSContext psContext, GeneralPartUpdateParam partParam) {
ServerMatrix matrix = psContext.getMatrixStorageManager().getMatrix(partParam.getMatrixId());
ServerPartition part = matrix.getPartition(partParam.getPartKey().getPartitionId());
return (ServerLongAnyRow) (((RowBasedPartition) part).getRow(0));
}
Aggregations