dmlc--dgl
5b9147c464
* add rtfd * rrr * update * change env * temp fix * update * fix * fix * add * conf * Move file_pattern from Makefile to conf.py * remove yml * fix * fix * fix * fix * remove yml * remove yml * add doc docker * add dgl install script * change name * change dockerfile * fix * name * add * fix * fix * fix * fix * fix docker * delete sphinx.py for doc-build backend * Add softmax to test backend * Add group apply function and tests * Delete unnecessary file * Update comments and test * Fix lint * remove unused bucketing code * group apply edge bucketing code * gen degree bucket schedule for group apply edge * schedule and graph code * fix compiling * fix * fix lint * naming * harder test case * fix comments * more comments * tweak function name
60 行
2.1 KiB
C++
60 行
2.1 KiB
C++
/*!
|
|
* Copyright (c) 2018 by Contributors
|
|
* \file dgl/scheduler.h
|
|
* \brief Operations on graph index.
|
|
*/
|
|
#ifndef DGL_SCHEDULER_H_
|
|
#define DGL_SCHEDULER_H_
|
|
|
|
#include <vector>
|
|
#include "runtime/ndarray.h"
|
|
|
|
namespace dgl {
|
|
|
|
typedef dgl::runtime::NDArray IdArray;
|
|
|
|
namespace sched {
|
|
|
|
/*!
|
|
* \brief Generate degree bucketing schedule
|
|
* \param msg_ids The edge id for each message
|
|
* \param vids The destination vertex for each message
|
|
* \param recv_ids The recv nodes (for checking zero degree nodes)
|
|
* \note If there are multiple messages going into the same destination vertex, then
|
|
* there will be multiple copies of the destination vertex in vids
|
|
* \return a vector of 5 IdArrays for degree bucketing. The 5 arrays are:
|
|
* degrees: degrees for each bucket
|
|
* nids: destination node ids
|
|
* nid_section: number of nodes in each bucket (used to split nids)
|
|
* mids: message ids
|
|
* mid_section: number of messages in each bucket (used to split mids)
|
|
*/
|
|
std::vector<IdArray> DegreeBucketing(const IdArray& msg_ids, const IdArray& vids,
|
|
const IdArray& recv_ids);
|
|
|
|
/*!
|
|
* \brief Generate degree bucketing schedule for group_apply edge
|
|
* \param uids One end vertex of edge by which edges are grouped
|
|
* \param vids The other end vertex of edge
|
|
* \param eids Edge ids
|
|
* \note This function always generate group_apply schedule based on degrees of
|
|
* nodes in uids. Therefore, if group_apply by source nodes, then uids
|
|
* should be source. If group_apply by destination nodes, then uids
|
|
* should be destination.
|
|
* \return a vector of 5 IdArrays for degree bucketing. The 5 arrays are:
|
|
* degrees: degrees for each bucket
|
|
* new_uids: uids reordered by degree bucket
|
|
* new_vids: vids reordered by degree bucket
|
|
* new_edis: eids reordered by degree bucket
|
|
* sections: number of edges in each degree bucket (used to partition
|
|
* new_uids, new_vids, and new_eids)
|
|
*/
|
|
std::vector<IdArray> GroupEdgeByNodeDegree(const IdArray& uids,
|
|
const IdArray& vids, const IdArray& eids);
|
|
|
|
} // namespace sched
|
|
|
|
} // namespace dgl
|
|
|
|
#endif // DGL_SCHEDULER_H_
|