use of com.tencent.angel.ps.storage.vector.ServerLongAnyRow in project angel by Tencent.
the class GetNodes method partitionGet.
@Override
public PartitionGetResult partitionGet(PartitionGetParam partParam) {
ServerPartition part = psContext.getMatrixStorageManager().getPart(partParam.getPartKey());
ServerLongAnyRow row = (ServerLongAnyRow) psContext.getMatrixStorageManager().getRow(partParam.getPartKey(), 0);
LongArrayList ret = new LongArrayList();
row.startRead();
try {
ObjectIterator<Long2ObjectMap.Entry<IElement>> it = row.iterator();
while (it.hasNext()) {
Long2ObjectMap.Entry<IElement> entry = it.next();
ret.add(entry.getLongKey() + partParam.getPartKey().getStartCol());
}
} finally {
row.endRead();
}
return new IndexPartGetLongResult(part.getPartitionKey(), ret.toLongArray());
}
use of com.tencent.angel.ps.storage.vector.ServerLongAnyRow in project angel by Tencent.
the class GetSort method partitionUpdate.
@Override
public void partitionUpdate(PartitionUpdateParam 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<IElement>> it = row.getStorage().iterator();
row.startWrite();
try {
while (it.hasNext()) {
Long2ObjectMap.Entry<IElement> next = it.next();
DynamicNeighborElement ele = (DynamicNeighborElement) next.getValue();
if (ele != null) {
ele.trans();
}
}
} 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 InitNeighbor method partitionUpdate.
@Override
public void partitionUpdate(PartitionUpdateParam partParam) {
InitNeighborPartParam param = (InitNeighborPartParam) partParam;
ServerLongAnyRow row = (ServerLongAnyRow) (psContext.getMatrixStorageManager().getRow(param.getPartKey(), 0));
long[] keys = param.getKeys();
long[][] neighborArrays = param.getNeighborArrays();
int[][] edgeTypes = param.getEdgeTypeArrays();
int[][] neighborTypes = param.getDstTypeArrays();
row.startWrite();
try {
for (int i = 0; i < keys.length; i++) {
Node node = (Node) row.get(keys[i]);
if (node == null) {
node = new Node();
row.set(keys[i], node);
}
node.setNeighbors(neighborArrays[i]);
if (edgeTypes != null)
node.setEdgeTypes(edgeTypes[i]);
if (neighborTypes != null)
node.setTypes(neighborTypes[i]);
}
} finally {
row.endWrite();
}
}
Aggregations