Skip to content
/ cpp-template Public template

Use this template as an example to build your own c++ application and run on GraphScope cluster!

Notifications You must be signed in to change notification settings

GraphScope/cpp-template

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

⚙️ C++ Application Template for GraphScope

C++ Library Template CI

Use this template repo as an example to build your own C++ application and run on GraphScope!

Please note that this template is designed for applications with a scalar result for each vertex, e.g. the rank value on each vertex for PageRank algorithm.

Getting Started

Step 1. Install GraphScope

pip3 install graphscope 

Step 2. Use this template to develop your own application

Click "Use this template" button up-right.t to create your own repository, clone it to local.

# Make sure to replace the <username> and <repo-name> to the right values.

git clone https://github.com/<username>/<repo-name>.git 
cd <repo-name>

If you want to build and run the example app, skip this step below and go to Step 3. Otherwise, develop your own application by revising files in src.

  • my_app.h: Implement your algorithm logic here, e.g., PEval and IncEval in PIE model.
  • my_app_context.h: Auxiliary data structures for the intermediate data across iterations.

Step 3. Build and test your application

make build & cd build
cmake .. && make            # build the application.
make package                # package as a graphscope-recognized resource (.gar)
make test                   # run a simple test. 

Step 4. How to run .gar file on GraphScope

Here is an example to run the packaged gar file in GraphScope Python interface.

import graphscope

from graphscope.framework.app import load_app
from graphscope.dataset import load_p2p_network

sess = graphscope.session()
simple_graph = load_p2p_network(sess)._project_to_simple()

my_app = load_app('<path_to_your_gar_resource>')
result = my_app(simple_graph, 10)  # pass 10 as param1 defined in 'MyAppContext.h'

print(result.to_numpy('r'))

Codebase Explained

In the src folder, we provide a simple example of my_app, which computing the degree for each vertex.

.
├── CMakeLists.txt
├── FindGraphScope.cmake ➝  find graphscope module
├── README.md
└── src
    ├── my_app.h ➝ algorithm logics
    └── my_app_context.h ➝ context with auxiliary data for the algorithm

Useful Links

About

Use this template as an example to build your own c++ application and run on GraphScope cluster!

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published