use of com.tencent.angel.ps.impl.matrix.ServerPartition in project angel by Tencent.
the class UnaryAggrFunc method partitionGet.
@Override
public PartitionGetResult partitionGet(PartitionGetParam partKey) {
ServerPartition part = psContext.getMatrixStorageManager().getPart(partKey.getMatrixId(), partKey.getPartKey().getPartitionId());
if (part != null) {
int rowId = ((UnaryAggrParam.UnaryPartitionAggrParam) partKey).getRowId();
if (Utils.withinPart(part.getPartitionKey(), new int[] { rowId })) {
ServerRow row = part.getRow(rowId);
double result = processRow(row);
return new ScalarPartitionAggrResult(result);
}
}
return null;
}
use of com.tencent.angel.ps.impl.matrix.ServerPartition in project angel by Tencent.
the class CompressUpdateFunc method partitionUpdate.
@Override
public void partitionUpdate(PartitionUpdateParam partParam) {
ServerPartition part = psContext.getMatrixStorageManager().getPart(partParam.getMatrixId(), partParam.getPartKey().getPartitionId());
if (part != null) {
CompressUpdateParam.CompressPartitionUpdateParam cp = (CompressUpdateParam.CompressPartitionUpdateParam) partParam;
ServerRow row = part.getRow(cp.getRowId());
if (row != null) {
update(row, cp.getArraySlice());
}
}
}
use of com.tencent.angel.ps.impl.matrix.ServerPartition in project angel by Tencent.
the class MFUpdateFunc method partitionUpdate.
@Override
public void partitionUpdate(PartitionUpdateParam partParam) {
ServerPartition part = psContext.getMatrixStorageManager().getPart(partParam.getMatrixId(), partParam.getPartKey().getPartitionId());
if (part != null) {
MFUpdateParam.MFPartitionUpdateParam mf = (MFUpdateParam.MFPartitionUpdateParam) partParam;
int[] rowIds = mf.getRowIds();
if (Utils.withinPart(partParam.getPartKey(), rowIds)) {
ServerRow[] rows = new ServerRow[rowIds.length];
for (int i = 0; i < rowIds.length; i++) {
rows[i] = part.getRow(rowIds[i]);
}
update(rows, mf.getFunc());
}
}
}
use of com.tencent.angel.ps.impl.matrix.ServerPartition in project angel by Tencent.
the class MMUpdateFunc method partitionUpdate.
@Override
public void partitionUpdate(PartitionUpdateParam partParam) {
ServerPartition part = psContext.getMatrixStorageManager().getPart(partParam.getMatrixId(), partParam.getPartKey().getPartitionId());
if (part != null) {
MMUpdateParam.MMPartitionUpdateParam vs2 = (MMUpdateParam.MMPartitionUpdateParam) partParam;
int[] rowIds = vs2.getRowIds();
ServerRow[] rows = new ServerRow[rowIds.length];
for (int i = 0; i < rowIds.length; i++) {
rows[i] = part.getRow(rowIds[i]);
}
update(rows, vs2.getScalars());
}
}
use of com.tencent.angel.ps.impl.matrix.ServerPartition in project angel by Tencent.
the class MatrixTransportClient method getPart.
@Override
public Future<ServerPartition> getPart(PartitionKey partKey, int clock) {
ParameterServerId serverId = PSAgentContext.get().getMatrixMetaManager().getMasterPS(partKey);
GetPartitionRequest request = new GetPartitionRequest(partKey, clock);
FutureResult<ServerPartition> future = new FutureResult<>();
requestToResultMap.put(request, future);
addToGetQueueForServer(serverId, request);
startGet();
return future;
}
Aggregations