Search in sources :

Example 6 with ServerPartition

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

Example 7 with ServerPartition

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

Example 8 with ServerPartition

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());
        }
    }
}
Also used : Int2IntOpenHashMap(it.unimi.dsi.fastutil.ints.Int2IntOpenHashMap) ServerPartition(com.tencent.angel.ps.impl.matrix.ServerPartition)

Example 9 with ServerPartition

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

Example 10 with ServerPartition

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);
}
Also used : PartitionKey(com.tencent.angel.PartitionKey) 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