當前位置: 首頁>>代碼示例>>Java>>正文


Java ByteArrayMessagesPerVertexStore類代碼示例

本文整理匯總了Java中org.apache.giraph.comm.messages.ByteArrayMessagesPerVertexStore的典型用法代碼示例。如果您正苦於以下問題:Java ByteArrayMessagesPerVertexStore類的具體用法?Java ByteArrayMessagesPerVertexStore怎麽用?Java ByteArrayMessagesPerVertexStore使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


ByteArrayMessagesPerVertexStore類屬於org.apache.giraph.comm.messages包,在下文中一共展示了ByteArrayMessagesPerVertexStore類的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: createNewServerData

import org.apache.giraph.comm.messages.ByteArrayMessagesPerVertexStore; //導入依賴的package包/類
/**
 * Prepare a ServerData object.
 *
 * @param conf Configuration
 * @param context Context
 * @return ServerData
 */
public static ServerData<IntWritable, IntWritable, IntWritable>
  createNewServerData(
  ImmutableClassesGiraphConfiguration conf, Mapper.Context context) {
  CentralizedServiceWorker<IntWritable, IntWritable, IntWritable> serviceWorker =
    MockUtils.mockServiceGetVertexPartitionOwner(1);
  ServerData<IntWritable, IntWritable, IntWritable> serverData =
    new ServerData<IntWritable, IntWritable, IntWritable>(
    serviceWorker, conf, ByteArrayMessagesPerVertexStore.newFactory(
      serviceWorker, conf), context);
  // Here we add a partition to simulate the case that there is one partition.
  serverData.getPartitionStore().addPartition(new SimplePartition());
  return serverData;
}
 
開發者ID:renato2099,項目名稱:giraph-gora,代碼行數:21,代碼來源:MockUtils.java

示例2: testByteArrayMessagesPerVertexStore

import org.apache.giraph.comm.messages.ByteArrayMessagesPerVertexStore; //導入依賴的package包/類
@Test
public void testByteArrayMessagesPerVertexStore() {
  try {
    testMessageStore(
        ByteArrayMessagesPerVertexStore.<IntWritable, IntWritable>newFactory(
            service, config),
        testData);
  } catch (IOException e) {
    e.printStackTrace();
  }
}
 
開發者ID:renato2099,項目名稱:giraph-gora,代碼行數:12,代碼來源:TestMessageStores.java

示例3: createMessageStoreFactory

import org.apache.giraph.comm.messages.ByteArrayMessagesPerVertexStore; //導入依賴的package包/類
/**
 * Decide which message store should be used for current application,
 * and create the factory for that store
 *
 * @return Message store factory
 */
private MessageStoreFactory<I, M, MessageStoreByPartition<I, M>>
createMessageStoreFactory() {
  boolean useOutOfCoreMessaging = USE_OUT_OF_CORE_MESSAGES.get(conf);
  if (!useOutOfCoreMessaging) {
    if (conf.useCombiner()) {
      if (LOG.isInfoEnabled()) {
        LOG.info("createMessageStoreFactory: " +
            "Using OneMessagePerVertexStore since combiner enabled");
      }
      return OneMessagePerVertexStore.newFactory(service, conf);
    } else {
      if (LOG.isInfoEnabled()) {
        LOG.info("createMessageStoreFactory: " +
            "Using ByteArrayMessagesPerVertexStore " +
            "since there is no combiner");
      }
      return ByteArrayMessagesPerVertexStore.newFactory(service, conf);
    }
  } else {
    int maxMessagesInMemory = MAX_MESSAGES_IN_MEMORY.get(conf);
    if (LOG.isInfoEnabled()) {
      LOG.info("createMessageStoreFactory: Using DiskBackedMessageStore, " +
          "maxMessagesInMemory = " + maxMessagesInMemory);
    }
    MessageStoreFactory<I, M, BasicMessageStore<I, M>> fileStoreFactory =
        SequentialFileMessageStore.newFactory(conf);
    MessageStoreFactory<I, M, FlushableMessageStore<I, M>>
        partitionStoreFactory =
        DiskBackedMessageStore.newFactory(conf, fileStoreFactory);
    return DiskBackedMessageStoreByPartition.newFactory(service,
        maxMessagesInMemory, partitionStoreFactory);
  }
}
 
開發者ID:zfighter,項目名稱:giraph-research,代碼行數:40,代碼來源:NettyWorkerServer.java

示例4: createNewServerData

import org.apache.giraph.comm.messages.ByteArrayMessagesPerVertexStore; //導入依賴的package包/類
public static ServerData<IntWritable, IntWritable, IntWritable, IntWritable>
createNewServerData(ImmutableClassesGiraphConfiguration conf,
    Mapper.Context context) {
  return new ServerData<IntWritable, IntWritable, IntWritable, IntWritable>(
      Mockito.mock(CentralizedServiceWorker.class),
      conf,
      ByteArrayMessagesPerVertexStore.newFactory(
          MockUtils.mockServiceGetVertexPartitionOwner(1), conf),
      context);
}
 
開發者ID:zfighter,項目名稱:giraph-research,代碼行數:11,代碼來源:MockUtils.java

示例5: testByteArrayMessagesPerVertexStore

import org.apache.giraph.comm.messages.ByteArrayMessagesPerVertexStore; //導入依賴的package包/類
@Test
public void testByteArrayMessagesPerVertexStore() {
  try {
    testMessageStore(
        ByteArrayMessagesPerVertexStore.newFactory(service, config),
        testData);
  } catch (IOException e) {
    e.printStackTrace();
  }
}
 
開發者ID:zfighter,項目名稱:giraph-research,代碼行數:11,代碼來源:TestMessageStores.java

示例6: computPartitionForLoopDatalog

import org.apache.giraph.comm.messages.ByteArrayMessagesPerVertexStore; //導入依賴的package包/類
/**
 * Compute a single partition
 *
 * @param computation Computation to use
 * @param partition Partition to compute
 */
private void computPartitionForLoopDatalog(Computation<I, V, E, M1, M2> computation, Partition<I, V, E> partition,
                                    PartitionStats partitionStats, long verticesComputedProgress)
        throws IOException, InterruptedException {

  for (Vertex<I, V, E> vertex : partition) {

    long start = System.currentTimeMillis();
    Iterable<M1> messages = null;
    if(configuration.useOutgoingMessageCombiner() == true)
      messages = ((OneMessagePerVertexStore) incoming_messageStore).getVertexMessagesImproved(vertex.getId(), partition.getId()); //When combiner is used
    else
      messages = ((ByteArrayMessagesPerVertexStore) incoming_messageStore).getVertexMessagesImproved(vertex.getId(), partition.getId()); //Without combiner
    long end = System.currentTimeMillis();

    getMessageTime += (end-start);
    getMessageCounter++;
    
    if (vertex.isHalted() && !Iterables.isEmpty(messages)) {
      if(vertex.isHalted())
      vertex.wakeUp();
    }
    if (!vertex.isHalted()) {
      context.progress();

      //------------------------------------------------------------
      computation.compute(vertex, messages);
      compute_incovations_counter++;
      //------------------------------------------------------------
      vertex.voteToHalt();
      // Need to unwrap the mutated edges (possibly)
      vertex.unwrapMutableEdges();
      //Compact edges representation if possible
      if (vertex instanceof Trimmable) {
        ((Trimmable) vertex).trim();
      }
      // Write vertex to superstep output (no-op if it is not used)
      vertexWriter.writeVertex(vertex);
      // Need to save the vertex changes (possibly)
      partition.saveVertex(vertex);


    }
    if (vertex.isHalted()) {
      partitionStats.incrFinishedVertexCount();
    }
    // Add statistics for this vertex
    partitionStats.incrVertexCount();
    partitionStats.addEdgeCount(vertex.getNumEdges());

    verticesComputedProgress++;
    if (verticesComputedProgress == VERTICES_TO_UPDATE_PROGRESS) {
      WorkerProgress.get().addVerticesComputed(verticesComputedProgress);
      verticesComputedProgress = 0;
    }

  } //end of for
}
 
開發者ID:wmoustafa,項目名稱:granada,代碼行數:64,代碼來源:ComputeCallable.java

示例7: computPartitionForLoopDatalogWhile

import org.apache.giraph.comm.messages.ByteArrayMessagesPerVertexStore; //導入依賴的package包/類
/**
 * Compute a single partition
 *
 * @param computation Computation to use
 * @param partition Partition to compute
 */
private void computPartitionForLoopDatalogWhile(Computation<I, V, E, M1, M2> computation, Partition<I, V, E> partition,
                                    PartitionStats partitionStats, long verticesComputedProgress)
        throws IOException, InterruptedException {

  for (Vertex<I, V, E> vertex : partition) {

  //TODO Smart for loop not working!
  //for(Object vertex_id: ((SimpleMessageStore) incoming_messageStore).get_has_messages_map(partition.getId()).keySet()) {
  //  Vertex<I, V, E> vertex = partition.getVertex((I)vertex_id);

    //LOG.info("Vicky ---> Current vertex=" + vertex.getId() + ":" + vertex.getValue() + ", getVertexMessages at superstep "
    //        + graphState.getSuperstep());

    long start = System.currentTimeMillis();
    Iterable<M1> messages = null;
    if(configuration.useOutgoingMessageCombiner() == true)
      messages = ((OneMessagePerVertexStore) incoming_messageStore).getVertexMessagesImproved(vertex.getId(), partition.getId()); //When combiner is used
    else
      messages = ((ByteArrayMessagesPerVertexStore) incoming_messageStore).getVertexMessagesImproved(vertex.getId(), partition.getId()); //Without combiner

    long end = System.currentTimeMillis();

    getMessageTime += (end-start);
    getMessageCounter++;

    if (vertex.isHalted() && !Iterables.isEmpty(messages)) {
      if(vertex.isHalted())
        vertex.wakeUp();
    }
    if (!vertex.isHalted()) {
      context.progress();
      //------------------------------------------------------------
      computation.compute(vertex, messages);
      compute_incovations_counter++;
      //------------------------------------------------------------
      vertex.voteToHalt();
      // Need to unwrap the mutated edges (possibly)
      vertex.unwrapMutableEdges();
      //Compact edges representation if possible
      if (vertex instanceof Trimmable) {
        ((Trimmable) vertex).trim();
      }
      // Write vertex to superstep output (no-op if it is not used)
      vertexWriter.writeVertex(vertex);
      // Need to save the vertex changes (possibly)
      partition.saveVertex(vertex);


    }
    if (vertex.isHalted()) {
      partitionStats.incrFinishedVertexCount();
    }
    // Add statistics for this vertex
    partitionStats.incrVertexCount();
    partitionStats.addEdgeCount(vertex.getNumEdges());

    verticesComputedProgress++;
    if (verticesComputedProgress == VERTICES_TO_UPDATE_PROGRESS) {
      WorkerProgress.get().addVerticesComputed(verticesComputedProgress);
      verticesComputedProgress = 0;
    }

  } //end of for
}
 
開發者ID:wmoustafa,項目名稱:granada,代碼行數:71,代碼來源:ComputeCallable.java


注:本文中的org.apache.giraph.comm.messages.ByteArrayMessagesPerVertexStore類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。