Graph和init
在pagerank.cpp中对图进行初始化:
Graph<Empty> * graph;
graph = new Graph<Empty>();
具体实现在graph.hpp中,设置threads和sockets,其中threads—cpus—partitions,sockets—nodes—machines,threads_per_socket表示每个节点(机器)上分到的线程数(分区数):
Graph() {
threads = numa_num_configured_cpus();
sockets = numa_num_configured_nodes();
threads_per_socket = threads / sockets;
init();
}
init()函数设置分区数
void init() {
edge_data_size = std::is_same<EdgeData, Empty>::value ? 0 : sizeof(EdgeData);
unit_size = sizeof(VertexId) + edge_data_size;
edge_unit_size &