本文整理汇总了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;
}
示例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();
}
}
示例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);
}
}
示例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);
}
示例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();
}
}
示例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
}
示例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
}