Skip to content

Commit

Permalink
Enable plug udf cpp pregel algorithm to graphscope. (#2312)
Browse files Browse the repository at this point in the history
* enable compiling pregel app on local vm
* add cpp pregel type
  • Loading branch information
siyuan0322 authored Dec 7, 2022
1 parent 2d8d33a commit 156d88f
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 9 deletions.
11 changes: 7 additions & 4 deletions analytical_engine/core/app/pregel/pregel_context.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,13 @@ class PregelContext
* @tparam VID_T VID type
* @tparam COMPUTE_CONTEXT_T
*/
template <typename OID_T, typename VID_T, typename COMPUTE_CONTEXT_T>
class PregelContext<vineyard::ArrowFragment<OID_T, VID_T>, COMPUTE_CONTEXT_T>
: public LabeledVertexDataContext<vineyard::ArrowFragment<OID_T, VID_T>,
typename COMPUTE_CONTEXT_T::vd_t> {
template <typename OID_T, typename VID_T, typename VERTEX_MAP_T,
typename COMPUTE_CONTEXT_T>
class PregelContext<vineyard::ArrowFragment<OID_T, VID_T, VERTEX_MAP_T>,
COMPUTE_CONTEXT_T>
: public LabeledVertexDataContext<
vineyard::ArrowFragment<OID_T, VID_T, VERTEX_MAP_T>,
typename COMPUTE_CONTEXT_T::vd_t> {
using fragment_t = vineyard::ArrowFragment<OID_T, VID_T>;
using vid_t = typename fragment_t::vid_t;
using vd_t = typename COMPUTE_CONTEXT_T::vd_t;
Expand Down
4 changes: 2 additions & 2 deletions coordinator/gscoordinator/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ def compile_app(
"Skip running llvm4jni since env var LLVM4JNI_HOME not found or run.sh not found under LLVM4JNI_HOME"
)
logger.info(" ".join(cmake_commands))
elif app_type != "cpp_pie":
elif app_type not in ("cpp_pie", "cpp_pregel"):
if app_type == "cython_pregel":
pxd_name = "pregel"
cmake_commands += ["-DCYTHON_PREGEL_APP=True"]
Expand Down Expand Up @@ -1467,7 +1467,7 @@ def _codegen_app_info(attr, meta_file: str, java_class_path: str):
for app in config_yaml["app"]:
if app["algo"] == algo:
app_type = app["type"] # cpp_pie or cython_pregel or cython_pie, java_pie
if app_type == "cpp_pie":
if app_type in ("cpp_pie", "cpp_pregel"):
return (
app_type,
app["src"],
Expand Down
11 changes: 8 additions & 3 deletions python/graphscope/framework/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ class AppAssets(DAGNode):
Assets includes an algorithm name, and gar (for user defined algorithm),
a context type (one of 'tensor', 'vertex_data', 'vertex_property',
'labeled_vertex_data', 'dynamic_vertex_data', 'labeled_vertex_property'),
and its type (one of `cpp_pie`, `cython_pie`, `cython_pregel`),
and its type (one of `cpp_pie`, `cpp_pregel`, `cython_pie`, `cython_pregel`),
The instance of this class can be passed to init :class:`graphscope.framework.app.AppDAGNode`
"""
Expand Down Expand Up @@ -246,7 +246,7 @@ def context_type(self):

@property
def type(self):
"""Algorithm type, one of `cpp_pie`, `cython_pie`, `java_pie` or `cython_pregel`.
"""Algorithm type, one of `cpp_pie`, `cpp_pregel`, `cython_pie`, `java_pie` or `cython_pregel`.
Returns:
str: Algorithm type of this asset.
Expand Down Expand Up @@ -389,7 +389,12 @@ def __call__(self, *args, **kwargs):
if not isinstance(self._graph, DAGNode) and not self._graph.loaded():
raise RuntimeError("The graph is not loaded")

if self._app_assets.type in ["cython_pie", "cython_pregel", "java_pie"]:
if self._app_assets.type in [
"cpp_pregel",
"cython_pie",
"cython_pregel",
"java_pie",
]:
# cython app support kwargs only
check_argument(
not args, "Only support using keyword arguments in cython app."
Expand Down

0 comments on commit 156d88f

Please sign in to comment.