use of com.tencent.angel.ps.storage.vector.element.IElement in project angel by Tencent.
the class ComplexRowFormat method save.
private void save(ServerAnyAnyRow row, PSMatrixSaveContext saveContext, MatrixPartitionMeta partMeta, DataOutputStream output) throws IOException {
ElementElementStorage storage = row.getStorage();
ObjectIterator<Object2ObjectMap.Entry<IElement, IElement>> iter = storage.iterator();
while (iter.hasNext()) {
Object2ObjectMap.Entry<IElement, IElement> entry = iter.next();
save(entry.getKey(), entry.getValue(), output);
}
}
use of com.tencent.angel.ps.storage.vector.element.IElement 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.element.IElement in project angel by Tencent.
the class ElementElementMapStorage method deserialize.
@Override
public void deserialize(DataInputStream input) throws IOException {
super.deserialize(input);
// Valid element number
int elementNum = input.readInt();
data = new Object2ObjectOpenHashMap<>(elementNum);
// Deserialize the data
for (int i = 0; i < elementNum; i++) {
IElement elementKey = newElement();
IElement elementValue = newElement();
data.put(elementKey, elementValue);
elementKey.deserialize(input);
elementValue.deserialize(input);
}
}
use of com.tencent.angel.ps.storage.vector.element.IElement 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.element.IElement in project angel by Tencent.
the class IntArrayElementStorage method deserialize.
@Override
public void deserialize(DataInputStream input) throws IOException {
super.deserialize(input);
// Array len
int len = input.readInt();
data = new IElement[len];
// Valid element number
int elementNum = input.readInt();
for (int i = 0; i < elementNum; i++) {
IElement element = newElement();
data[input.readInt()] = element;
element.deserialize(input);
}
}
Aggregations