32 #ifndef GRAPHCHI_FUNCTIONALENGINE_DEF
33 #define GRAPHCHI_FUNCTIONALENGINE_DEF
40 template <
typename VertexDataType,
typename EdgeDataType,
typename fvertex_t>
45 _m.set(
"engine",
"functional");
50 virtual void load_before_updates(std::vector<fvertex_t> &vertices) {
51 logstream(
LOG_DEBUG) <<
"Processing in-edges." << std::endl;
53 if (!this->memoryshard->loaded()) {
54 this->memoryshard->load();
58 this->memoryshard->load_vertices(this->sub_interval_st, this->sub_interval_en, vertices,
true,
false);
61 this->vertex_data_handler->load(this->sub_interval_st, this->sub_interval_en);
64 this->iomgr->wait_for_reads();
69 virtual void init_vertices(std::vector<fvertex_t> &vertices,
71 int nvertices = vertices.size();
74 for(
int i=0; i < nvertices; i++) {
75 degree d = this->degree_handler->get_degree(this->sub_interval_st + i);
77 int outc = d.outdegree;
78 vertices[i] = fvertex_t(this->chicontext, this->sub_interval_st + i, inc, outc);
79 if (this->scheduler != NULL) {
80 bool is_sched = this->scheduler->is_scheduled(this->sub_interval_st + i);
82 vertices[i].scheduled =
true;
84 ecounter += inc + outc;
88 vertices[i].scheduled =
true;
89 ecounter += inc + outc;
92 this->work += ecounter;
97 virtual void load_after_updates(std::vector<fvertex_t> &vertices) {
98 logstream(
LOG_DEBUG) <<
"Processing out-edges (broadcast)." << std::endl;
99 for(
int p=0; p < this->nshards; p++) {
101 if (p != this->exec_interval) {
102 this->sliding_shards[p]->read_next_vertices(vertices.size(), this->sub_interval_st, vertices,
103 this->scheduler != NULL && this->iter == 0);
106 this->memoryshard->load_vertices(this->sub_interval_st, this->sub_interval_en, vertices,
false,
true);