- Cite this project and paper.
@inproceedings{TC-GNN,
title={TC-GNN: Bridging Sparse GNN Computation and Dense Tensor Cores on GPUs},
author={Yuke Wang and Boyuan Feng and Zheng Wang and Guyue Huang and Yufei Ding},
booktitle={USENIX Annual Technical Conference (ATC)},
year={2023}
}
- TC-GNN has also been used by TC_SPMM@SparseTIR (ASPLOS'23), which is a part of TVM project. Thanks to Zihao Ye!
git clone --recursive [email protected]:YukeWang96/TCGNN-Pytorch.git
- Requirements:
Ubuntu 16.04+gcc >= 7.5cmake >= 3.14CUDA >= 11.0andnvcc >= 11.0- NVIDIA GPU with
sm >= 80(i.e., Ampere, like RTX3090).
- Go to
docker/ - Run
./build.sh - Run
./launch.sh
- 2.2.1 Install
condaon system Toturial. - 2.2.2 Create a
condaenvironment:
conda create -n env_name python=3.6
- 2.2.3 Install
Pytorch:
conda install pytorch torchvision torchaudio cudatoolkit=11.1 -c pytorch -c conda-forge
or using pip [Note that make sure the pip you use is the pip from current conda environment. You can check this by which pip]
pip install torch==1.8.0+cu111 torchvision==0.9.0+cu111 torchaudio==0.8.0 -f https://download.pytorch.org/whl/torch_stable.html
- 2.2.4 Install
Deep Graph Library (DGL).
conda install -c dglteam dgl-cuda11.0
pip install torch requests tqdm
- 2.2.5 Install
Pytorch-Geometric (PyG).
pip install torch-scatter -f https://pytorch-geometric.com/whl/torch-1.8.0+cu111.html
pip install torch-sparse -f https://pytorch-geometric.com/whl/torch-1.8.0+cu111.html
pip install torch-cluster -f https://pytorch-geometric.com/whl/torch-1.8.0+cu111.html
pip install torch-spline-conv -f https://pytorch-geometric.com/whl/torch-1.8.0+cu111.html
pip install torch-geometric
Go to TCGNN_conv/, then run
./0_build_tcgnn.sh
to install the TCGNN_conv modules with Pytorch binding. Note that this step is required for both Docker and Conda setup.
Get the preprocessed datasets
wget https://storage.googleapis.com/graph_dataset/tcgnn-ae-graphs.tar.gz
tar -zxvf tcgnn-ae-graphs.tar.gz && rm -rf tcgnn-ae-graphs.tar.gz
- Go to project root directory.
./0_run_tcgnn_model.shto run all TC-GNN experiments.- Check the results in
1_bench_gcn.csvand1_bench_agnn.csv.
- Go to
dgl_baseline/directory../0_run_dgl.shto run all dgl experiments.- Check the results in
Fig_6a_dgl_gcn.csvandFig_6a_dgl_agnn.csv.
- Go to
pyg_baseline/directory;./0_run_pyg.shto run all pyg experiments.- Check the results in
Fig_6b_PyG_gcn.csvandFig_6b_PyG_agnn.csv.
- Go to project root directory.
./0_run_tcgnn_single_kernel.shto run TC-GNN single kernel experiments.- Check the results in
1_bench_gcn.csvand1_bench_agnn.csv.
cd TCGNN-bSpmm/cusparse
./0_run_bSpMM.sh
- Check the results in
Fig_6c_cuSPARSE_bSpMM.csv.
python 3_cnt_TC_blk_SDDMM.py
python 3_cnt_TC_blk_SpMM.py
- Check the results in
3_cnt_TC_blk_SDDMM.csvand3_cnt_TC_blk_SDDMM.csv.
cd TCGNN-tsparse/
./0_run_tSparse.sh
- Check the results in
Table_5_tSparse.csv.
cd TCGNN-trition/python/bench
conda activate triton
./0_run_triton.sh
- Check the results in
1_run_triton.csv.
Building a new design based on TC-GNN is simple, there are only several steps:
- Add a compilation entry in
TCGNN.cppunderTCGNN_conv/. An example is shown below.
TC-GNN_ATC23/TCGNN_conv/TCGNN.cpp
Lines 63 to 86 in 0d40b53
TC-GNN_ATC23/TCGNN_conv/TCGNN.cpp
Line 265 in 0d40b53
- Add the operator implementation in
TCGNN_kernel.cppfile underTCGNN_conv/. An example is shown below.
TC-GNN_ATC23/TCGNN_conv/TCGNN_kernel.cu
Lines 175 to 220 in 0d40b53
- Add a CUDA kernel design in
TCGNN_kernel.cuh. An example is shown below.
TC-GNN_ATC23/TCGNN_conv/TCGNN_kernel.cu
Lines 336 to 454 in 0d40b53
- The compiled exectuable will be located under
build/.
cd docker
./launch.sh
./0_build_tcgnn.sh
-
Deep Graph Library
Wang, Minjie, et al. Deep graph library: A graph-centric, highly-performant package for graph neural networks.. The International Conference on Learning Representations (ICLR), 2019. -
Pytorch Geometric
Fey, Matthias, and Jan Eric Lenssen. Fast graph representation learning with PyTorch Geometric. The International Conference on Learning Representations (ICLR), 2019. -
ASpT
Hong, Changwan, et al. Adaptive sparse tiling for sparse matrix multiplication. In Proceedings of the 24th Symposium on Principles and Practice of Parallel Programming (PPoPP), 2019. -
tSparse
Zachariadis, O., et. al. Accelerating Sparse Matrix-Matrix Multiplication with GPU Tensor Cores Computers & Electrical Engineering (2020). -
cuSPARSELt
NVIDIA. Exploiting NVIDIA Ampere Structured Sparsity with cuSPARSELt.