use of com.tencent.angel.ps.storage.vector.ServerLongAnyRow in project angel by Tencent.
the class GeneralGetUtils method partitionGet.
public static PartitionGetResult partitionGet(PSContext psContext, PartitionGetParam partParam) {
GeneralPartGetParam param = (GeneralPartGetParam) partParam;
KeyPart keyPart = param.getIndicesPart();
// Long type node id
long[] nodeIds = ((ILongKeyPartOp) keyPart).getKeys();
ServerLongAnyRow row = GraphMatrixUtils.getPSLongKeyRow(psContext, param);
// Get data
IElement[] data = new IElement[nodeIds.length];
for (int i = 0; i < nodeIds.length; i++) {
data[i] = row.get(nodeIds[i]);
}
MatrixMeta meta = psContext.getMatrixMetaManager().getMatrixMeta(param.getMatrixId());
try {
return new PartGeneralGetResult(meta.getValueClass(), nodeIds, data);
} catch (ClassNotFoundException e) {
throw new AngelException("Can not get value class ");
}
}
use of com.tencent.angel.ps.storage.vector.ServerLongAnyRow in project angel by Tencent.
the class InitAliasTable method partitionUpdate.
@Override
public void partitionUpdate(PartitionUpdateParam partParam) {
InitAliasTablePartParam param = (InitAliasTablePartParam) partParam;
ServerMatrix matrix = psContext.getMatrixStorageManager().getMatrix(partParam.getMatrixId());
RowBasedPartition part = (RowBasedPartition) matrix.getPartition(partParam.getPartKey().getPartitionId());
ServerLongAnyRow row = (ServerLongAnyRow) part.getRow(0);
ObjectIterator<Long2ObjectMap.Entry<AliasElement>> iter = param.getNodeId2Neighbors().long2ObjectEntrySet().iterator();
row.startWrite();
try {
while (iter.hasNext()) {
Long2ObjectMap.Entry<AliasElement> entry = iter.next();
AliasElement element = entry.getValue();
if (element == null) {
row.set(entry.getLongKey(), null);
} else {
row.set(entry.getLongKey(), new AliasElement(element.getNeighborIds(), element.getAccept(), element.getAlias()));
}
}
} finally {
row.endWrite();
}
}
use of com.tencent.angel.ps.storage.vector.ServerLongAnyRow in project angel by Tencent.
the class GeneralInit method partitionUpdate.
@Override
public void partitionUpdate(PartitionUpdateParam partParam) {
GeneralPartUpdateParam initParam = (GeneralPartUpdateParam) partParam;
ServerLongAnyRow row = GraphMatrixUtils.getPSLongKeyRow(psContext, initParam);
// Get nodes and features
ILongKeyAnyValuePartOp split = (ILongKeyAnyValuePartOp) initParam.getKeyValuePart();
long[] nodeIds = split.getKeys();
IElement[] neighbors = split.getValues();
row.startWrite();
try {
for (int i = 0; i < nodeIds.length; i++) {
row.set(nodeIds[i], neighbors[i]);
}
} finally {
row.endWrite();
}
}
use of com.tencent.angel.ps.storage.vector.ServerLongAnyRow 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.vector.ServerLongAnyRow 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