Search in sources :

Example 11 with ServerPartition

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;
}
Also used : ServerRow(com.tencent.angel.ps.impl.matrix.ServerRow) ServerPartition(com.tencent.angel.ps.impl.matrix.ServerPartition)

Example 12 with ServerPartition

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());
        }
    }
}
Also used : ServerRow(com.tencent.angel.ps.impl.matrix.ServerRow) ServerPartition(com.tencent.angel.ps.impl.matrix.ServerPartition)

Example 13 with ServerPartition

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());
        }
    }
}
Also used : ServerRow(com.tencent.angel.ps.impl.matrix.ServerRow) ServerPartition(com.tencent.angel.ps.impl.matrix.ServerPartition)

Example 14 with ServerPartition

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());
    }
}
Also used : ServerRow(com.tencent.angel.ps.impl.matrix.ServerRow) ServerPartition(com.tencent.angel.ps.impl.matrix.ServerPartition)

Example 15 with ServerPartition

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;
}
Also used : ParameterServerId(com.tencent.angel.ps.ParameterServerId) ServerPartition(com.tencent.angel.ps.impl.matrix.ServerPartition)

Aggregations

ServerPartition (com.tencent.angel.ps.impl.matrix.ServerPartition)18 ServerRow (com.tencent.angel.ps.impl.matrix.ServerRow)9 Response (com.tencent.angel.ml.matrix.transport.Response)2 FutureResult (com.tencent.angel.psagent.matrix.transport.FutureResult)2 PartitionKey (com.tencent.angel.PartitionKey)1 ParameterServerId (com.tencent.angel.ps.ParameterServerId)1 Int2IntOpenHashMap (it.unimi.dsi.fastutil.ints.Int2IntOpenHashMap)1