Ejemplo n.º 1
0
  @Override
  protected void sendOrdersToStorageNodes() throws IOException {
    for (String nodeId : storageNodes) {
      System.err.println("XXX storage node: " + nodeId);
      OrderTernaryOpBody.Builder order = OrderTernaryOpBody.newBuilder();

      order.setPiecesToSend(pieces2BeSentProto(nodeId));
      order.setAwaitingUpdates(awaitingUpdateProto(nodeId));
      order.setMissingPieces(MatrixPieceListBody.getDefaultInstance());

      sendOrder(order, nodeId);
    }
  }
Ejemplo n.º 2
0
  @Override
  protected void sendOrdersToComputingNodes() throws IOException {
    OrderTernaryOp.Builder operation = OrderTernaryOp.newBuilder();

    Matrix output = operands.get(0);
    Matrix firstOp = operands.get(1);
    Matrix secondOp = operands.get(2);

    TypeBody type =
        TypeBody.newBuilder()
            .setElementType(firstOp.getElementType())
            .setSemiRing(firstOp.getSemiRing())
            .build();

    operation.setOutputMatrixId(output.getMatrixId());
    operation.setFirstOperandMatrixId(firstOp.getMatrixId());
    operation.setSecondOperandMatrixId(secondOp.getMatrixId());
    operation.setType(type);

    for (NodeWorkZonePair nwzp : tasks) {
      Node computingNode = nwzp.computingNode;

      OrderTernaryOpBody.Builder order = OrderTernaryOpBody.newBuilder();
      MatrixPieceListBody.Builder missingPieces = MatrixPieceListBody.newBuilder();

      for (WorkZone wz : nwzp.workZones) {
        fillInOperation(order, wz, operation);
        updateMissingPieces(missingPieces, wz, computingNode);
      }
      order.setMissingPieces(missingPieces.build());
      order.setPiecesToSend(pieces2BeSentProto(computingNode.getNodeId()));
      order.setAwaitingUpdates(awaitingUpdateProto(computingNode.getNodeId()));

      sendOrder(order, computingNode.getNodeId());
    }
  }