YiTu
YiTu is an easy-to-use runtime to fully exploit the hybrid parallelism of different hardwares (e.g., GPU) to efficiently support the execution of various kinds of graph algorithms (e.g., GNNs).
Install / Use
/learn @CGCL-codes/YiTuREADME
YiTu
YiTu is an easy-to-use runtime designed to fully exploit hybrid parallelism across various hardware platforms (e.g., GPUs) to efficiently execute a wide range of graph algorithms, including graph neural networks (GNNs). It offers optimized support for heterogeneous and temporal graphs, enabling advanced analysis on complex, diverse, and dynamic graph structures. YiTu includes four modules: YITU_H, which handles heterogeneous graphs; YITU_T, focused on temporal graph analysis; YITU_GNN, dedicated to the implementation of standard Graph Neural Networks (GNNs); and YITU_GP, which offers advanced tools for graph analysis. Each module is designed to address specific aspects of graph processing and analysis, enabling efficient handling of diverse graph types and tasks.Next are the specific descriptions of each module.
<div align=center> <img src="https://github.com/czk23/YiTu/blob/main/images/system_design.png"> </div>Introduction
YITU_GNN
YITU_GNN is a specialized module within YiTu that focuses on the implementation and analysis of standard Graph Neural Networks (GNNs). It allows users to efficiently build and experiment with popular GNN architectures, such as Graph Convolutional Networks (GCN) and Graph Attention Networks (GAT). With a flexible API, YITU_GNN enables easy customization of models and optimizes performance for large-scale graph training. By integrating with other modules in YiTu, it enhances the system's overall capabilities, making it a powerful tool for tasks like node classification, link prediction, and graph classification, ultimately facilitating deeper insights into graph-structured data.
YITU_GP
YITU_GP is a dedicated module within YiTu that specializes in graph analysis functionalities. This module provides users with advanced tools and algorithms for extracting insights from graph-structured data, enabling a wide range of analytical tasks. With YITU_GP, users can perform various operations, including community detection, centrality measures, and so on. The module is designed to handle large graphs efficiently, ensuring that users can analyze complex relationships and patterns within their data. By integrating seamlessly with other modules in YiTu, YITU_GP enhances the overall analytical capabilities of the system, making it an essential component for applications requiring in-depth graph analysis and interpretation.
YITU_T
YITU_T is a specialized module within YiTu that focuses on the functionalities related to temporal graphs. It enables the processing and analysis of time-evolving graph data, allowing for the exploration of dynamic relationships and changes over time. With YITU_T, users can efficiently manage temporal aspects of graphs, supporting tasks such as event forecasting, trend analysis, and social network dynamics. This module ensures that users can effectively handle the complexities of temporal data, providing tools to analyze how graph structures evolve and interact in real-time. By integrating these capabilities, YITU_T enhances YiTu’s overall functionality, making it a powerful tool for applications requiring advanced temporal graph analysis.
YITU_H
YITU_H is a dedicated module within YiTu that focuses on the functionalities related to heterogeneous graphs. It enables the handling of graphs with multiple types of nodes and edges, allowing for a rich representation of complex relationships. With YITU_H, users can efficiently manage diverse graph structures, making it particularly suitable for applications such as recommendation systems, knowledge graphs, and multi-relational data analysis. This module ensures seamless integration and processing of various graph elements, providing tools to explore and analyze the interactions among different types of entities. By enhancing YiTu’s capabilities in dealing with heterogeneous graphs, YITU_H empowers users to unlock deeper insights and drive advanced analyses across diverse applications.
Installation
Provide two installation methods:
- Build docker image
- Install with conda
Building Docker Image
- First, build a virtual environment with Docker, and YiTu_GNN can run on the environment. Docker installation please reference.
By running the following commands, we can construct a docker image called YiTu_GNN, on which all subsequent experiments will be performed.
cd YiTu_GNN/docker
docker build -f Dockerfile -t YiTu_GNN .
- starting docker container:
docker run --gpus all -e NCCL_SOCKET_IFNAME=eno1 --rm -dit --shm-size="5g" --network=host --name YiTu_GNN YiTu_GNN /bin/bash
- --gpus all:indicating that all GPUs will be used
- -e NCCL_SOCKET_IFNAME=eno1: setting the Network Interface Card to be used
- --shm-size="5g": setting the size of shared memory
- --network=host: indicating that host network will be used
- installing YiTu_GNN in docker container:
# 1. copy YiTu_GNN to docker container
docker cp YiTu_GNN YiTu_GNN:/home
# 2. enter docker container
docker exec -it YiTu_GNN bash
cd /home/YiTu_GNN
# 3. install YiTu_GNN
python setup.py install
Installing with Conda
- installing cmake:
version=3.18
build=0
mkdir ~/temp
cd ~/temp
wget https://cmake.org/files/v$version/cmake-$version.$build-Linux-x86_64.sh
sudo mkdir /opt/cmake
sudo sh cmake-$version.$build-Linux-x86_64.sh --prefix=/opt/cmake --skip-license
sudo ln -s /opt/cmake/bin/cmake /usr/local/bin/cmake
cd ~
rm -rf ~/temp
- installing conda:
export LANG=C.UTF-8 LC_ALL=C.UTF-8
export PATH=/opt/conda/bin:$PATH
apt-get update --fix-missing && \
apt-get install -y wget bzip2 ca-certificates curl git && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
wget --quiet https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O ~/miniconda.sh && \
/bin/bash ~/miniconda.sh -b -p /opt/conda && \
rm ~/miniconda.sh && \
/opt/conda/bin/conda clean -ya && \
ln -s /opt/conda/etc/profile.d/conda.sh /etc/profile.d/conda.sh && \
echo ". /opt/conda/etc/profile.d/conda.sh" >> ~/.bashrc && \
echo "conda activate base" >> ~/.bashrc
export TINI_VERSION=v0.16.1
source ~/.bashrc
- installing related dependency packages:
conda create -n YiTu_GNN python=3.7.5
conda activate YiTu_GNN
conda install -y astunparse numpy ninja pyyaml mkl \
mkl-include setuptools cffi \
typing_extensions future six \
requests dataclasses \
pytest nose cython scipy \
networkx matplotlib nltk \
tqdm pandas scikit-learn && \
conda install -y -c pytorch magma-cuda102
conda install pytest -c conda-forge
pip3 install rdflib
# stand-alone dependency packages
apt-get update && apt-get install -y --no-install-recommends \
libboost-all-dev \
libgoogle-perftools-dev \
protobuf-compiler && \
rm -rf /var/lib/apt/lists/*
- installing pytorch from source
mkdir ~/temp
cd ~/temp
# download the PyTorch source code that can support parameters with multiple versions
git clone --recursive https://github.com/Ningsir/pytorch.git -b multi-version
cd pytorch
# if you are updating an existing checkout
git submodule sync
git submodule update --init --recursive
# Compile and install PyTorch
export CMAKE_PREFIX_PATH=${CONDA_PREFIX:-"$(dirname $(which conda))/../"}
USE_NINJA=OFF python setup.py install --cmake
cd ~
rm -rf ~/temp
Possible problem: Lack of valgrind.h
Solution: cd third_party/valgrind && git checkout VALGRIND_3_18_0
- installing DGL:
conda install -y -c dglteam dgl-cuda10.2=0.7.1
- installing YiTu_GNN
python setup.py install
- To use the heterogeneous graph training module, run the following commands on ./YiTu_GNN/YiTu_H directory:
python setup.py install
- To use the Temporal GNN training module, run the following commands on ./YiTu_GNN/YiTu_T directory:
python setup.py build_ext --inplace
Compilation
Environment requrements:
- G++==7.5.0
- cuda==10.2
- Openmpi==2.1.1
- Python=3.7
Run the following commands on root/examples/YiTu_GNN/NDP directory:
#compile graph algorithms with NDP
cmake .
make
#compile graph algorithms without NDP
cd nondp
make
cd ..
#compile graph formats converters
cd tools
make
cd ..
Data Preprocessing
1. YiTu_GNN
Without NDP
Downloading Dataset:
cd /home/data
git clone https://github.com/kimiyoung/planetoid.git
Preprocessing:
python example/YiTu_GNN/single/data_process.py --data_path /home/data/planetoid/data --dataset citeseer
python example/YiTu_GNN/single/data_process.py --data_path /home/data/planetoid/data --dataset cora
python example/YiTu_GNN/single/data_process.py --data_path /home/data/planetoid/data --dataset pubmed
With NDP
Dataset Format (vnum represents the number of vertices)
adj.npz: graph adjacency matrix, shape(vnum, vnum), saved asscipy.sparsecoo matrix format.labels.npy: vertex label, shape(vnum,), saved asnumpy.arrayformat.test.npy,train.npy,val.npy: boolean array, shape(vnum,), saved asnumpy.arrayformat.feat.npy(optional): feature of vertex, shape(vnum, feat-size), saved asnumpy.array, can be generated randomly if not provided.
Downloading Dataset and Converting Dataset Format
mkdir reddit
curl --output reddit/reddit.zip https://data.dgl.ai/dataset/reddit.zip
unzip -d reddit reddit/reddit.zip
python examples/YiTu_GNN/NDP/data/dgl2NDP.py --dataset reddit --out-dir /home/reddit
Subgraph generation
-
hash partition
python YiTu_GNN/NDP/partition/hash.py --num-hops 2 --partition 1 --dataset /home/reddit -
dg-based partition
python YiTu_GNN/NDP/partition/dg.py --num-hops 2 --partition 1 --dataset /home/reddit
2. YiTu_GP
Input Graph Formats
The followings are two graph file ex
