libgrape-lite
A C++ library for parallel graph processing
Public Member Functions | Private Attributes | List of all members
grape::ParallelEngine Class Reference

Public Member Functions

void InitParallelEngine (const ParallelEngineSpec &spec=DefaultParallelEngineSpec())
 
ThreadPoolGetThreadPool ()
 
template<typename ITER_FUNC_T >
void ForEach (int from, int to, const ITER_FUNC_T &iter_func)
 
template<typename ITER_FUNC_T , typename VID_T >
void ForEach (const VertexRange< VID_T > &range, const ITER_FUNC_T &iter_func, int chunk_size=1024)
 Iterate on vertexes of a VertexRange concurrently. More...
 
template<typename ITER_FUNC_T , typename VID_T >
void ForEach (const DualVertexRange< VID_T > &range, const ITER_FUNC_T &iter_func, int chunk_size=1024)
 
template<typename ITER_FUNC_T , typename VID_T >
void ForEach (const VertexVector< VID_T > &vertices, const ITER_FUNC_T &iter_func, int chunk_size=1024)
 Iterate on discontinuous vertices concurrently. More...
 
template<typename ITERATOR_T , typename ITER_FUNC_T >
void ForEach (const ITERATOR_T &begin, const ITERATOR_T &end, const ITER_FUNC_T &iter_func, int chunk_size=1024)
 
template<typename INIT_FUNC_T , typename ITER_FUNC_T , typename FINALIZE_FUNC_T , typename VID_T >
void ForEach (const VertexRange< VID_T > &range, const INIT_FUNC_T &init_func, const ITER_FUNC_T &iter_func, const FINALIZE_FUNC_T &finalize_func, int chunk_size=1024)
 Iterate on vertexes of a VertexRange concurrently, initialize function and finalize function can be provided to each thread. More...
 
template<typename INIT_FUNC_T , typename ITER_FUNC_T , typename FINALIZE_FUNC_T , typename VID_T >
void ForEach (const DualVertexRange< VID_T > &range, const INIT_FUNC_T &init_func, const ITER_FUNC_T &iter_func, const FINALIZE_FUNC_T &finalize_func, int chunk_size=1024)
 
template<typename INIT_FUNC_T , typename ITER_FUNC_T , typename FINALIZE_FUNC_T , typename VID_T >
void ForEach (const VertexVector< VID_T > &vertices, const INIT_FUNC_T &init_func, const ITER_FUNC_T &iter_func, const FINALIZE_FUNC_T &finalize_func, int chunk_size=1024)
 Iterate on discontinuous vertices concurrently, initialize function and finalize function can be provided to each thread. More...
 
template<typename ITERATOR_T , typename INIT_FUNC_T , typename ITER_FUNC_T , typename FINALIZE_FUNC_T >
void ForEach (const ITERATOR_T &begin, const ITERATOR_T &end, const INIT_FUNC_T &init_func, const ITER_FUNC_T &iter_func, const FINALIZE_FUNC_T &finalize_func, int chunk_size=1024)
 Iterate a range specified by iterator pair concurrently. More...
 
template<typename ITER_FUNC_T , typename VID_T >
void ForEach (const DenseVertexSet< VertexRange< VID_T >> &dense_set, const ITER_FUNC_T &iter_func, int chunk_size=1024)
 Iterate on vertexes of a DenseVertexSet concurrently. More...
 
template<typename ITER_FUNC_T , typename VID_T >
void ForEach (const DenseVertexSet< VertexVector< VID_T >> &dense_set, const ITER_FUNC_T &iter_func, int chunk_size=1024)
 
template<typename ITER_FUNC_T , typename VID_T >
void ForEach (const DenseVertexSet< DualVertexRange< VID_T >> &dense_set, const ITER_FUNC_T &iter_func, int chunk_size=1024)
 
template<typename ITER_FUNC_T , typename VID_T >
void bitwise_iterate (VID_T begin, VID_T end, const Bitset &bitset, VID_T offset, int tid, const ITER_FUNC_T &iter_func)
 
template<typename ITER_FUNC_T , typename VID_T >
void wordwise_iterate (VID_T begin, VID_T end, const Bitset &bitset, VID_T offset, int tid, const ITER_FUNC_T &iter_func)
 
template<typename ITER_FUNC_T , typename VID_T >
void parallel_iterate (VID_T begin, VID_T end, const Bitset &bitset, VID_T offset, const ITER_FUNC_T &iter_func, int chunk_size)
 
template<typename ITER_FUNC_T , typename VID_T >
void ForEach (const DenseVertexSet< VertexRange< VID_T >> &dense_set, const VertexRange< VID_T > &range, const ITER_FUNC_T &iter_func, int chunk_size=1024)
 Iterate on vertexes of a DenseVertexSet concurrently. More...
 
template<typename ITER_FUNC_T , typename VID_T >
void ForEach (const DenseVertexSet< VertexVector< VID_T >> &dense_set, const VertexRange< VID_T > &range, const ITER_FUNC_T &iter_func, int chunk_size=1024)
 
template<typename ITER_FUNC_T , typename VID_T >
void ForEach (const DenseVertexSet< DualVertexRange< VID_T >> &dense_set, const VertexRange< VID_T > &range, const ITER_FUNC_T &iter_func, int chunk_size=1024)
 
template<typename ITER_FUNC_T , typename VID_T , typename VERTEX_SET_T >
void ForEach (const DenseVertexSet< VERTEX_SET_T > &dense_set, const VertexVector< VID_T > &vertices, const ITER_FUNC_T &iter_func, int chunk_size=1024)
 Iterate on vertexes of a DenseVertexSet concurrently. More...
 
template<typename INIT_FUNC_T , typename ITER_FUNC_T , typename FINALIZE_FUNC_T , typename VID_T >
void ForEach (const DenseVertexSet< VertexRange< VID_T >> &dense_set, const INIT_FUNC_T &init_func, const ITER_FUNC_T &iter_func, const FINALIZE_FUNC_T &finalize_func, int chunk_size=10 *1024)
 Iterate on vertexes of a DenseVertexSet concurrently, initialize function and finalize function can be provided to each thread. More...
 
template<typename INIT_FUNC_T , typename ITER_FUNC_T , typename FINALIZE_FUNC_T , typename VID_T >
void ForEach (const DenseVertexSet< VertexVector< VID_T >> &dense_set, const INIT_FUNC_T &init_func, const ITER_FUNC_T &iter_func, const FINALIZE_FUNC_T &finalize_func, int chunk_size=10 *1024)
 
template<typename INIT_FUNC_T , typename ITER_FUNC_T , typename FINALIZE_FUNC_T , typename VID_T >
void ForEach (const DenseVertexSet< DualVertexRange< VID_T >> &dense_set, const INIT_FUNC_T &init_func, const ITER_FUNC_T &iter_func, const FINALIZE_FUNC_T &finalize_func, int chunk_size=10 *1024)
 
uint32_t thread_num ()
 

Private Attributes

ThreadPool thread_pool_
 
uint32_t thread_num_
 

Member Function Documentation

◆ ForEach() [1/9]

template<typename ITER_FUNC_T , typename VID_T , typename VERTEX_SET_T >
void grape::ParallelEngine::ForEach ( const DenseVertexSet< VERTEX_SET_T > &  dense_set,
const VertexVector< VID_T > &  vertices,
const ITER_FUNC_T &  iter_func,
int  chunk_size = 1024 
)
inline

Iterate on vertexes of a DenseVertexSet concurrently.

Template Parameters
ITER_FUNC_TType of vertex program.
VID_TType of vertex id.
Parameters
dense_setThe vertex set to be iterated.
verticesThe vertices to be iterated.
iter_funcVertex program to be applied on each vertex.
chunk_sizeVertices granularity to be scheduled by threads.

◆ ForEach() [2/9]

template<typename INIT_FUNC_T , typename ITER_FUNC_T , typename FINALIZE_FUNC_T , typename VID_T >
void grape::ParallelEngine::ForEach ( const DenseVertexSet< VertexRange< VID_T >> &  dense_set,
const INIT_FUNC_T &  init_func,
const ITER_FUNC_T &  iter_func,
const FINALIZE_FUNC_T &  finalize_func,
int  chunk_size = 10 * 1024 
)
inline

Iterate on vertexes of a DenseVertexSet concurrently, initialize function and finalize function can be provided to each thread.

Template Parameters
INIT_FUNC_TType of thread init program.
ITER_FUNC_TType of vertex program.
FINALIZE_FUNC_TType of thread finalize program.
VID_TType of vertex id.
Parameters
dense_setThe vertex set to be iterated.
init_funcInitializing function to be invoked by each thread before iterating on vertexes.
iter_funcVertex program to be applied on each vertex.
finalize_funcFinalizing function to be invoked by each thread after iterating on vertexes.
chunk_sizeVertices granularity to be scheduled by threads.

◆ ForEach() [3/9]

template<typename ITER_FUNC_T , typename VID_T >
void grape::ParallelEngine::ForEach ( const DenseVertexSet< VertexRange< VID_T >> &  dense_set,
const ITER_FUNC_T &  iter_func,
int  chunk_size = 1024 
)
inline

Iterate on vertexes of a DenseVertexSet concurrently.

Template Parameters
ITER_FUNC_TType of vertex program.
VID_TType of vertex id.
Parameters
dense_setThe vertex set to be iterated.
iter_funcVertex program to be applied on each vertex.
chunk_sizeVertices granularity to be scheduled by threads.

◆ ForEach() [4/9]

template<typename ITER_FUNC_T , typename VID_T >
void grape::ParallelEngine::ForEach ( const DenseVertexSet< VertexRange< VID_T >> &  dense_set,
const VertexRange< VID_T > &  range,
const ITER_FUNC_T &  iter_func,
int  chunk_size = 1024 
)
inline

Iterate on vertexes of a DenseVertexSet concurrently.

Template Parameters
ITER_FUNC_TType of vertex program.
VID_TType of vertex id.
Parameters
dense_setThe vertex set to be iterated.
rangeThe vertex range to be iterated.
iter_funcVertex program to be applied on each vertex.
chunk_sizeVertices granularity to be scheduled by threads.

◆ ForEach() [5/9]

template<typename ITERATOR_T , typename INIT_FUNC_T , typename ITER_FUNC_T , typename FINALIZE_FUNC_T >
void grape::ParallelEngine::ForEach ( const ITERATOR_T &  begin,
const ITERATOR_T &  end,
const INIT_FUNC_T &  init_func,
const ITER_FUNC_T &  iter_func,
const FINALIZE_FUNC_T &  finalize_func,
int  chunk_size = 1024 
)
inline

Iterate a range specified by iterator pair concurrently.

Template Parameters
ITER_FUNC_TType of vertex program.
ITERATOR_TType of range iterator.
Parameters
beginThe begin iterator of range.
endThe end iterator of range.
init_funcInitializing function to be invoked by each thread before iterating on vertexes.
iter_funcVertex program to be applied on each vertex.
finalize_funcFinalizing function to be invoked by each thread after iterating on vertexes.
chunk_sizeVertices granularity to be scheduled by threads.

◆ ForEach() [6/9]

template<typename INIT_FUNC_T , typename ITER_FUNC_T , typename FINALIZE_FUNC_T , typename VID_T >
void grape::ParallelEngine::ForEach ( const VertexRange< VID_T > &  range,
const INIT_FUNC_T &  init_func,
const ITER_FUNC_T &  iter_func,
const FINALIZE_FUNC_T &  finalize_func,
int  chunk_size = 1024 
)
inline

Iterate on vertexes of a VertexRange concurrently, initialize function and finalize function can be provided to each thread.

Template Parameters
INIT_FUNC_TType of thread init program.
ITER_FUNC_TType of vertex program.
FINALIZE_FUNC_TType of thread finalize program.
VID_TType of vertex id.
Parameters
rangeThe vertex range to be iterated.
init_funcInitializing function to be invoked by each thread before iterating on vertexes.
iter_funcVertex program to be applied on each vertex.
finalize_funcFinalizing function to be invoked by each thread after iterating on vertexes.
chunk_sizeVertices granularity to be scheduled by threads.

◆ ForEach() [7/9]

template<typename ITER_FUNC_T , typename VID_T >
void grape::ParallelEngine::ForEach ( const VertexRange< VID_T > &  range,
const ITER_FUNC_T &  iter_func,
int  chunk_size = 1024 
)
inline

Iterate on vertexes of a VertexRange concurrently.

Template Parameters
ITER_FUNC_TType of vertex program.
VID_TType of vertex id.
Parameters
rangeThe vertex range to be iterated.
iter_funcVertex program to be applied on each vertex.
chunk_sizeVertices granularity to be scheduled by threads.

◆ ForEach() [8/9]

template<typename INIT_FUNC_T , typename ITER_FUNC_T , typename FINALIZE_FUNC_T , typename VID_T >
void grape::ParallelEngine::ForEach ( const VertexVector< VID_T > &  vertices,
const INIT_FUNC_T &  init_func,
const ITER_FUNC_T &  iter_func,
const FINALIZE_FUNC_T &  finalize_func,
int  chunk_size = 1024 
)
inline

Iterate on discontinuous vertices concurrently, initialize function and finalize function can be provided to each thread.

Template Parameters
INIT_FUNC_TType of thread init program.
ITER_FUNC_TType of vertex program.
FINALIZE_FUNC_TType of thread finalize program.
VID_TType of vertex id.
Parameters
verticesThe vertex array to be iterated.
init_funcInitializing function to be invoked by each thread before iterating on vertexes.
iter_funcVertex program to be applied on each vertex.
finalize_funcFinalizing function to be invoked by each thread after iterating on vertexes.
chunk_sizeVertices granularity to be scheduled by threads.

◆ ForEach() [9/9]

template<typename ITER_FUNC_T , typename VID_T >
void grape::ParallelEngine::ForEach ( const VertexVector< VID_T > &  vertices,
const ITER_FUNC_T &  iter_func,
int  chunk_size = 1024 
)
inline

Iterate on discontinuous vertices concurrently.

Template Parameters
ITER_FUNC_TType of vertex program.
VID_TType of vertex id.
Parameters
verticesThe vertex array to be iterated.
iter_funcVertex program to be applied on each vertex.
chunk_sizeVertices granularity to be scheduled by threads.