public abstract class GASEngine extends Object implements IGASEngine
IGASEngine
for dynamic activation of vertices. This implementation
maintains a frontier and lazily initializes the vertex state when the vertex
is visited for the first time. This is appropriate for algorithms, such as
BFS, that use a dynamic frontier.
TODO Algorithms that need to visit all vertices in each round (CC, BC, PR)
can be more optimially executed by a different implementation strategy. The
vertex state should be arranged in a dense map (maybe an array) and presized.
For example, this could be done on the first pass when we identify a vertex
index for each distinct V in visitation order.
TODO Vectored expansion with conditional materialization of attribute values
could be achieved using CONSTRUCT. This would force URI materialization as
well. If we drop down one level, then we can push in the frontier and avoid
the materialization. Or we can just write an operator that accepts a frontier
and returns the new frontier and which maintains an internal map containing
both the visited vertices, the vertex state, and the edge state.
TODO Some computations could be maintained and accelerated. A great example
is Shortest Path (as per RDF3X). Reachability queries for a hierarchy can
also be maintained and accelerated (again, RDF3X using a ferrari index).
TODO Option to materialize Literals (or to declare the set of literals of
interest) [Note: We can also require that people inline all URIs and Literals
if they need to have them materialized, but a materialization filter for
Gather and Scatter would be nice if it can be selective for just those
attributes or vertex identifiers that matter).Constructor and Description |
---|
GASEngine(int nthreads) |
Modifier and Type | Method and Description |
---|---|
ExecutorService |
getGASThreadPool()
If there is an
ExecutorService for the GASEngine , then
return it (nthreads GT 1). |
int |
getNThreads()
The parallelism for the SCATTER and GATHER phases.
|
Class<IGASSchedulerImpl> |
getSchedulerClass() |
protected Callable<Long> |
newFrontierStrategy(VertexTaskFactory<Long> taskFactory,
IStaticFrontier f)
Factory for the parallelism strategy that is used to map a task across
the frontier.
|
<VS,ES,ST> IGASContext<VS,ES,ST> |
newGASContext(IGraphAccessor graphAccessor,
IGASProgram<VS,ES,ST> gasProgram)
Obtain an execution context for the specified
IGASProgram . |
<VS,ES,ST> IGASState<VS,ES,ST> |
newGASState(IGraphAccessor graphAccessor,
IGASProgram<VS,ES,ST> gasProgram) |
IGASSchedulerImpl |
newScheduler() |
IStaticFrontier |
newStaticFrontier()
Return an
IStaticFrontier - this is the object that models the
frontier that is consumed during a given round of evaluation. |
void |
setSchedulerClass(Class<IGASSchedulerImpl> newValue) |
void |
shutdown()
Polite shutdown.
|
void |
shutdownNow()
Immediate shutdown.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getSortFrontier
public GASEngine(int nthreads)
indexManager
- The index manager.nthreads
- The number of threads to use for the SCATTER and GATHER
phases.public int getNThreads()
IGASEngine
getNThreads
in interface IGASEngine
public void shutdown()
IGASEngine
shutdown
in interface IGASEngine
public void shutdownNow()
IGASEngine
shutdownNow
in interface IGASEngine
protected Callable<Long> newFrontierStrategy(VertexTaskFactory<Long> taskFactory, IStaticFrontier f)
Callable
should be executed in the
caller's thread. The Callable
will schedule tasks that consume
the frontier. A variety of frontier strategies are implemented. Those
that execute in parallel do so using the thread pool associated with the
IGASEngine
.taskFactory
- The task to be mapped across the frontier.public ExecutorService getGASThreadPool()
ExecutorService
for the GASEngine
, then
return it (nthreads GT 1).UnsupportedOperationException
- if nthreads==1.public void setSchedulerClass(Class<IGASSchedulerImpl> newValue)
public Class<IGASSchedulerImpl> getSchedulerClass()
public IStaticFrontier newStaticFrontier()
IStaticFrontier
- this is the object that models the
frontier that is consumed during a given round of evaluation.
TODO Config overridespublic IGASSchedulerImpl newScheduler()
public <VS,ES,ST> IGASContext<VS,ES,ST> newGASContext(IGraphAccessor graphAccessor, IGASProgram<VS,ES,ST> gasProgram)
IGASEngine
IGASProgram
.newGASContext
in interface IGASEngine
VS
- The generic type for the per-vertex state. This is scoped to
the computation of the IGASProgram
.ES
- The generic type for the per-edge state. This is scoped to the
computation of the IGASProgram
.ST
- The generic type for the SUM. This is often directly related
to the generic type for the per-edge state, but that is not
always true. The SUM type is scoped to the GATHER + SUM
operation (NOT the computation).graphAccessor
- Indicates the graph to be processed.gasProgram
- The program to execute against that graph.public <VS,ES,ST> IGASState<VS,ES,ST> newGASState(IGraphAccessor graphAccessor, IGASProgram<VS,ES,ST> gasProgram)
Copyright © 2006–2019 SYSTAP, LLC DBA Blazegraph. All rights reserved.