Search in sources :

Example 1 with MatrixClock

use of com.tencent.angel.protobuf.generated.MLProtos.MatrixClock in project angel by Tencent.

the class MasterClient method getTaskMatrixClocks.

/**
 * Get task clocks for all matrices from Master
 *
 * @return task clocks for all matrices from Master
 * @throws ServiceException
 */
public Int2ObjectOpenHashMap<Int2IntOpenHashMap> getTaskMatrixClocks() throws ServiceException {
    GetTaskMatrixClockResponse response = masterProxy.getTaskMatrixClocks(null, GetTaskMatrixClockRequest.newBuilder().build());
    Int2ObjectOpenHashMap<Int2IntOpenHashMap> taskIdToMatrixClocksMap = new Int2ObjectOpenHashMap<>(response.getTaskMatrixClocksCount());
    List<TaskMatrixClock> taskMatrixClocks = response.getTaskMatrixClocksList();
    int size = taskMatrixClocks.size();
    int matrixNum;
    for (int i = 0; i < size; i++) {
        Int2IntOpenHashMap matrixIdToClockMap = new Int2IntOpenHashMap(taskMatrixClocks.get(i).getMatrixClocksCount());
        taskIdToMatrixClocksMap.put(taskMatrixClocks.get(i).getTaskId().getTaskIndex(), matrixIdToClockMap);
        List<MatrixClock> matrixClocks = taskMatrixClocks.get(i).getMatrixClocksList();
        matrixNum = matrixClocks.size();
        for (int j = 0; j < matrixNum; j++) {
            matrixIdToClockMap.put(matrixClocks.get(j).getMatrixId(), matrixClocks.get(j).getClock());
        }
    }
    return taskIdToMatrixClocksMap;
}
Also used : Int2ObjectOpenHashMap(it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap) MatrixClock(com.tencent.angel.protobuf.generated.MLProtos.MatrixClock) Int2IntOpenHashMap(it.unimi.dsi.fastutil.ints.Int2IntOpenHashMap)

Aggregations

MatrixClock (com.tencent.angel.protobuf.generated.MLProtos.MatrixClock)1 Int2IntOpenHashMap (it.unimi.dsi.fastutil.ints.Int2IntOpenHashMap)1 Int2ObjectOpenHashMap (it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap)1