A GraphLab core is the base (or core) data structure in GraphLab. More...
#include <core.hpp>
Public Types | |
|
typedef graphlab::types < graphlab::graph< VertexType, EdgeType > > | types |
Public Member Functions | |
| core () | |
| default constructor does nothing | |
| types::graph & | graph () |
| Get a modifiable reference to the graph associated with this core. | |
| const types::graph & | graph () const |
| Get a constant reference to the graph associated with this core. | |
| void | set_scheduler_type (const std::string &scheduler_type) |
| Set the type of scheduler. | |
| void | set_scope_type (const std::string &scope_type) |
| Set the scope consistency model used in this engine. | |
| void | set_engine_type (const std::string &engine_type) |
| Set the engine type. | |
| void | set_metrics_type (const std::string &metrics_type) |
| Sets the output format of any recorded metrics. | |
| void | reset () |
| Destroys a created engine (if any). | |
| void | set_ncpus (size_t ncpus) |
| Set the number of cpus that the engine will use. | |
| types::iengine & | engine () |
| bool | rebuild_engine () |
| Destroys and reconstructs the current engine, reprocessing the engine arguments. | |
| void | set_engine_options (const engine_options &opts) |
| Set the engine options by passing in an engine options object. | |
| imetrics_reporter & | get_reporter () |
| const engine_options & | get_engine_options () const |
| Returns the engine options. | |
| scheduler_options & | sched_options () |
| Returns a modifiable reference to the scheduler options. | |
| const scheduler_options & | sched_options () const |
| Returns a constant reference to the scheduler options. | |
| bool | parse_engine_options (int argc, char **argv) |
| Set the engine options by simply parsing the command line arguments. | |
| double | start () |
| Run the engine until a termination condition is reached or there are no more tasks remaining to execute. | |
| void | add_task (vertex_id_t vertex, typename types::update_function func, double priority) |
| Add a single update function to a single vertex. | |
| void | add_task (typename types::update_task task, double priority) |
| Add a single task with a fixed priority. | |
| void | add_tasks (const std::vector< vertex_id_t > &vertices, typename types::update_function func, double priority) |
| Add the update function to all the veritces in the provided vector with the given priority. | |
| void | add_task_to_all (typename types::update_function func, double priority) |
| Add the given function to all vertices using the given priority. | |
| size_t | last_update_count () |
| Get the number of updates executed by the engine. | |
| void | fill_metrics () |
| void | reset_metrics () |
| void | report_metrics () |
| Outputs the recorded metrics. | |
| void | set_sync (glshared_base &shared, typename types::iengine::sync_function_type sync, glshared_base::apply_function_type apply, const any &zero, size_t sync_interval=0, typename types::iengine::merge_function_type merge=NULL, vertex_id_t rangelow=0, vertex_id_t rangehigh=-1) |
| Registers a sync with the engine. | |
| void | sync_now (glshared_base &shared) |
A GraphLab core is the base (or core) data structure in GraphLab.
Because many GraphLab programs will consists of a graph and an engine we have created a single data-structure, called a core, which manages all the pieces of GraphLab including engine and scheduler construction parameters.
The core is templatized over the VertexType and EdgeType however by using the ref types typedef, one can simply create a core by doing the following:
gl::core glcore;
cd The core contains the
The core also manages the engine and scheduler construction parameters.
The core will invisibly recreate the engine each time engine options are modified. This will mean that this internal behavior of the core should be pretty much "transparent" for the typical use case where engine options and scheduler options are defined before tasks are added to the scheduler.
Otherwise, modifications to the engine options will result in the clearing of all scheduler tasks.
Definition at line 85 of file core.hpp.
| types::iengine& graphlab::core< VertexType, EdgeType >::engine | ( | ) | [inline] |
| void graphlab::core< VertexType, EdgeType >::set_engine_type | ( | const std::string & | engine_type | ) | [inline] |
Set the engine type.
This will destroy the current engine and any tasks associated with the current scheduler.
| void graphlab::core< VertexType, EdgeType >::set_metrics_type | ( | const std::string & | metrics_type | ) | [inline] |
| void graphlab::core< VertexType, EdgeType >::set_ncpus | ( | size_t | ncpus | ) | [inline] |
| void graphlab::core< VertexType, EdgeType >::set_scheduler_type | ( | const std::string & | scheduler_type | ) | [inline] |
Set the type of scheduler.
This will destroy the current engine and any tasks currently associated with the scheduler. See Schedulers for the list of supported schedulers.
| void graphlab::core< VertexType, EdgeType >::set_scope_type | ( | const std::string & | scope_type | ) | [inline] |
Set the scope consistency model used in this engine.
This will destroy the current engine and any tasks associated with the current scheduler. The available scopes are:
See Scopes for details
| void graphlab::core< VertexType, EdgeType >::set_sync | ( | glshared_base & | shared, | |
| typename types::iengine::sync_function_type | sync, | |||
| glshared_base::apply_function_type | apply, | |||
| const any & | zero, | |||
| size_t | sync_interval = 0, |
|||
| typename types::iengine::merge_function_type | merge = NULL, |
|||
| vertex_id_t | rangelow = 0, |
|||
| vertex_id_t | rangehigh = -1 | |||
| ) | [inline] |
Registers a sync with the engine.
Registers a sync with the engine. The sync will be performed approximately every "interval" updates, and will perform a reduction over all vertices from rangelow to rangehigh inclusive. The merge function may be NULL, in which it will not be used. However, it is highly recommended to provide a merge function since this allow the sync operation to be parallelized.
The sync operation is guaranteed to be strictly sequentially consistent with all other execution.
| shared | The shared variable to synchronize | |
| sync | The reduction function | |
| apply | The final apply function which writes to the shared value | |
| zero | The initial zero value passed to the reduction | |
| sync_interval | Frequency at which the sync is initiated. Corresponds approximately to the number of update function calls before the sync is reevaluated. If 0, the sync will only be evaluated once at engine start, and will never be evaluated again. Defaults to 0. | |
| merge | Combined intermediate reduction value. defaults to NULL. in which case, it will not be used. | |
| rangelow | he lower range of vertex id to start syncing. The range is inclusive. i.e. vertex with id 'rangelow' and vertex with id 'rangehigh' will be included. Defaults to 0. | |
| rangehigh | The upper range of vertex id to stop syncing. The range is inclusive. i.e. vertex with id 'rangelow' and vertex with id 'rangehigh' will be included. Defaults to infinity. |
| void graphlab::core< VertexType, EdgeType >::sync_now | ( | glshared_base & | shared | ) | [inline] |
1.7.1