use of com.tencent.angel.ps.impl.matrix.ServerPartition in project angel by Tencent.
the class VAUpdateFunc method partitionUpdate.
@Override
public void partitionUpdate(PartitionUpdateParam partParam) {
ServerPartition part = psContext.getMatrixStorageManager().getPart(partParam.getMatrixId(), partParam.getPartKey().getPartitionId());
if (part != null) {
VAUpdateParam.VAPartitionUpdateParam va = (VAUpdateParam.VAPartitionUpdateParam) partParam;
int rowId = va.getRowId();
if (Utils.withinPart(partParam.getPartKey(), new int[] { rowId })) {
ServerRow row = part.getRow(rowId);
if (row != null) {
update(row, va.getArray());
}
}
}
}
use of com.tencent.angel.ps.impl.matrix.ServerPartition in project angel by Tencent.
the class GetPartitionResponse method deserialize.
@Override
public void deserialize(ByteBuf buf) {
super.deserialize(buf);
if (buf.readableBytes() == 0) {
partition = null;
return;
}
partition = new ServerPartition();
partition.deserialize(buf);
}
use of com.tencent.angel.ps.impl.matrix.ServerPartition in project angel by Tencent.
the class RecoverPartRequest method deserialize.
@Override
public void deserialize(ByteBuf buf) {
super.deserialize(buf);
part = new ServerPartition();
part.deserialize(buf);
int clockVecSize = buf.readInt();
if (clockVecSize > 0) {
taskIndexToClockMap = new Int2IntOpenHashMap(clockVecSize);
for (int i = 0; i < clockVecSize; i++) {
taskIndexToClockMap.put(buf.readInt(), buf.readInt());
}
}
}
use of com.tencent.angel.ps.impl.matrix.ServerPartition in project angel by Tencent.
the class BinaryAggrFunc method partitionGet.
@Override
public PartitionGetResult partitionGet(PartitionGetParam partKey) {
ServerPartition part = psContext.getMatrixStorageManager().getPart(partKey.getMatrixId(), partKey.getPartKey().getPartitionId());
int rowId1 = ((BinaryAggrParam.BinaryPartitionAggrParam) partKey).getRowId1();
int rowId2 = ((BinaryAggrParam.BinaryPartitionAggrParam) partKey).getRowId2();
if (Utils.withinPart(partKey.getPartKey(), new int[] { rowId1, rowId2 })) {
if (part != null) {
ServerRow row1 = part.getRow(rowId1);
ServerRow row2 = part.getRow(rowId2);
if (row1 != null && row2 != null) {
double result = processRows(row1, row2);
return new ScalarPartitionAggrResult(result);
}
}
}
return null;
}
use of com.tencent.angel.ps.impl.matrix.ServerPartition in project angel by Tencent.
the class FullAggrFunc method partitionGet.
@Override
public PartitionGetResult partitionGet(PartitionGetParam partKey) {
ServerPartition part = psContext.getMatrixStorageManager().getPart(partKey.getMatrixId(), partKey.getPartKey().getPartitionId());
double[][] result = null;
if (part != null) {
result = process(part, partKey.getPartKey());
}
PartitionKey key = partKey.getPartKey();
int[] partInfo = new int[] { key.getStartRow(), key.getEndRow(), (int) key.getStartCol(), (int) key.getEndCol() };
return new FullPartitionAggrResult(result, partInfo);
}
Aggregations