xiezhq-hermann / graphiler

Graphiler is a compiler stack built on top of DGL and TorchScript which compiles GNNs defined using user-defined functions (UDFs) into efficient execution plans.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Graphiler

DOI

Graphiler is a compiler stack built on top of DGL and TorchScript which compiles GNNs defined using user-defined functions (UDFs) into efficient execution plans. This allows creating high performance models while retaining the simplicity and expressiveness of the UDF interface.

Repo Structure

Graphiler
├── artifact                # scripts for running the artifact
├── docker
├── examples                # GNN models with different implementations
│   ├── GAT
│   ├── GCN
│   ├── HGT
│   └── RGCN
├── include
│   ├── dglgraph.h          # simplified Graph representation
│   └── mpdfg.h             # message passing data flow graph
├── python
│   ├── graphiler           # python wrapper
│   └── ...
└── src                     # source codes
    ├── builder             # MP-DFG builder
    ├── dglgraph.cpp
    ├── ops                 # graph primitives
    │   ├── broadcast
    │   ├── dgl_primitives
    │   │   ├── sddmm.cu
    │   │   ├── spmm.cu
    │   │   └── ...
    │   ├── segment_mm
    │   └── segment_softmax
    │   └── ...
    ├── optimizer           # optimization passes
    │   ├── dedup.cpp
    │   ├── fusion.cpp
    │   ├── optimizer.h
    │   ├── reorder.cpp
    │   └── split.cpp
    │   └── ...
    └── ...

Build Graphiler and get started

Play with docker

Docker is the easiest way to build the environment and reproduce the results. To make use of it, please make sure docker and NVIDIA Container Toolkit are properly installed and configured.

You can either build the image by yourself:

docker build -f docker/Dockerfile -t graphiler .

Or directly pull an pre-built image from docker hub:

docker pull expye/graphiler-ae:latest
docker tag expye/graphiler-ae:latest graphiler

To quickly verify the installation:

docker run --gpus all -i -t graphiler python examples/GAT/GAT.py pubmed 500

Build from scratch

You can follow these instructions to build Graphiler on your machine:

# To install CUDA 11.1:
# https://docs.nvidia.com/cuda/cuda-installation-guide-linux/index.html 
git clone https://github.com/xiezhq-hermann/graphiler.git
cd graphiler
pip install -r requirements.txt # install PyTorch, DGL, PyG, etc
mkdir build && cd build
cmake -DCMAKE_PREFIX_PATH="$(python -c 'import torch.utils; print(torch.utils.cmake_prefix_path)')" ..
make
mkdir -p ~/.dgl
mv libgraphiler.so ~/.dgl/
cd ..
python setup.py install
# path used in scripts
export GRAPHILER=$(pwd)

# quick sanity check
python $GRAPHILER/examples/GAT/GAT.py pubmed 500

Artifact Evaluation

Please go artifact directory for more information.

Reference

To cite Graphiler in your paper:

@inproceedings{graphiler,
 author = {Xie, Zhiqiang and Wang, Minjie and Ye, Zihao and Zhang, Zheng and Fan, Rui},
 booktitle = {Proceedings of Machine Learning and Systems},
 editor = {D. Marculescu and Y. Chi and C. Wu},
 pages = {515--528},
 title = {Graphiler: Optimizing Graph Neural Networks with Message Passing Data Flow Graph},
 url = {https://proceedings.mlsys.org/paper/2022/file/a87ff679a2f3e71d9181a67b7542122c-Paper.pdf},
 volume = {4},
 year = {2022}
}

About

Graphiler is a compiler stack built on top of DGL and TorchScript which compiles GNNs defined using user-defined functions (UDFs) into efficient execution plans.

License:Apache License 2.0


Languages

Language:Cuda 49.0%Language:C++ 32.6%Language:Python 14.2%Language:C 1.9%Language:Dockerfile 1.3%Language:CMake 0.7%Language:Shell 0.3%