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));
}
use of com.tencent.angel.ps.storage.vector.ServerLongAnyRow in project angel by Tencent.
the class PushNeighbor method partitionUpdate.
@Override
public void partitionUpdate(PartitionUpdateParam partParam) {
PushNeighborPartitionParam pparam = (PushNeighborPartitionParam) partParam;
ServerLongAnyRow row = (ServerLongAnyRow) psContext.getMatrixStorageManager().getRow(pparam.getPartKey(), 0);
Long2ObjectOpenHashMap<long[]> nodeIdToNeighborIndices = pparam.getNodeIdToNeighborIndices();
ObjectIterator<Long2ObjectMap.Entry<long[]>> iter = nodeIdToNeighborIndices.long2ObjectEntrySet().iterator();
row.startWrite();
try {
while (iter.hasNext()) {
Long2ObjectMap.Entry<long[]> entry = iter.next();
row.set(entry.getLongKey(), new LongArrayElement(entry.getValue()));
}
} finally {
row.endWrite();
}
}
use of com.tencent.angel.ps.storage.vector.ServerLongAnyRow in project angel by Tencent.
the class InitNodeFeats method partitionUpdate.
@Override
public void partitionUpdate(PartitionUpdateParam partParam) {
InitNodeFeatsPartParam param = (InitNodeFeatsPartParam) partParam;
ServerLongAnyRow row = (ServerLongAnyRow) psContext.getMatrixStorageManager().getRow(param.getPartKey(), 0);
long[] nodeIds = param.getNodeIds();
IntFloatVector[] feats = param.getFeats();
row.startWrite();
try {
for (int i = 0; i < nodeIds.length; i++) {
Node node = (Node) row.get(nodeIds[i]);
if (node == null) {
node = new Node();
row.set(nodeIds[i], node);
}
node.setFeats(feats[i]);
}
} finally {
row.endWrite();
}
}
use of com.tencent.angel.ps.storage.vector.ServerLongAnyRow in project angel by Tencent.
the class PullMaxDegree method partitionGet.
@Override
public PartitionGetResult partitionGet(PartitionGetParam partParam) {
ServerLongAnyRow row = (ServerLongAnyRow) psContext.getMatrixStorageManager().getRow(partParam.getPartKey(), 0);
int partResult = Integer.MIN_VALUE;
ObjectIterator<Long2ObjectMap.Entry<IElement>> iter = row.iterator();
while (iter.hasNext()) {
Long2ObjectMap.Entry<IElement> entry = iter.next();
LongArrayElement value = (LongArrayElement) entry.getValue();
int length = value.getData().length;
if (length > partResult) {
partResult = length;
}
}
return new PullMaxDegreePartitionResult(partResult);
}
use of com.tencent.angel.ps.storage.vector.ServerLongAnyRow in project angel by Tencent.
the class PushPathTail method partitionUpdate.
@Override
public void partitionUpdate(PartitionUpdateParam partParam) {
PushPathTailPartitionParam pparam = (PushPathTailPartitionParam) partParam;
PartitionKey partKey = pparam.getPartKey();
ServerLongAnyRow row = (ServerLongAnyRow) psContext.getMatrixStorageManager().getRow(pparam.getPartKey(), 0);
Long2LongOpenHashMap pathTail = pparam.getPathTail();
PathQueue.pushBatch(partKey.getPartitionId(), row, pathTail);
// int completeCount = 0;
// ArrayList<WalkPath> paths = new ArrayList<>(pathTail.size());
//
// row.startWrite();
// try {
// ObjectIterator<Map.Entry<Long, Long>> iter = pathTail.entrySet().iterator();
// while (iter.hasNext()) {
// Map.Entry<Long, Long> entry = iter.next();
// long key = entry.getKey();
// long tail = entry.getValue();
//
// WalkPath wPath = (WalkPath) row.get(key);
// wPath.add2Path(tail);
//
// if (wPath.isComplete()) {
// completeCount += 1;
// } else {
// paths.add(wPath);
// }
// }
// } finally {
// row.endWrite();
// }
//
// if (completeCount != 0) {
// PathQueue.progress(partKey.getPartitionId(), completeCount);
// }
//
// if (!paths.isEmpty()) {
// PathQueue.pushBatch(partKey.getPartitionId(), paths);
// }
}
Aggregations