An example for DGL cluster/subgraph manipulation
1.1. Download the cuda 11.6 library, you can refer to https://developer.nvidia.com/cuda-toolkit-archive, my system is x86_64, Ubuntu 18.04, refer to "runfile (local)" for download link
mkdir cuda_install
cd cuda_install
wget https://developer.download.nvidia.com/compute/cuda/11.6.2/local_installers/cuda_11.6.2_510.47.03_linux.run
sudo sh cuda_11.6.2_510.47.03_linux.run --silent --toolkit --installpath=/opt/cuda-11.6 --override
To switch between CUDA versions, you'll need to update your environment variables. You can create a shell script or an alias to easily switch between versions.
Create a script (e.g. “switch_cuda.sh”):
#!/bin/bash
export CUDA_HOME=/opt/cuda-$1
export PATH=$CUDA_HOME/bin:$PATH
export LD_LIBRARY_PATH=$CUDA_HOME/lib64:$LD_LIBRARY_PATH
Make the script executable:
chmod +x switch_cuda.sh
Now, you can easily switch between CUDA versions by running:
source switch_cuda.sh <version>
In this example, you need to activate CUDA 11.6:
source switch_cuda.sh 11.6
To check if the correct version is active, run:
nvcc --version
This should display the currently active CUDA version.
conda create --prefix ${HOME}/.conda/envs/torch_tf_pyg_dgl python=3.8
conda activate torch_tf_pyg_dgl
pip install torch==1.12.1+cu116 torchvision==0.13.1+cu116 torchaudio==0.12.1 --extra-index-url https://download.pytorch.org/whl/cu116
2.4 Install the pyg library according to https://github.com/pyg-team/pytorch_geometric
pip install torch-scatter -f https://data.pyg.org/whl/torch-1.12.1+cu116.html
pip install torch-sparse -f https://data.pyg.org/whl/torch-1.12.1+cu116.html
pip install torch-cluster -f https://data.pyg.org/whl/torch-1.12.1+cu116.html
pip install torch-spline-conv -f https://data.pyg.org/whl/torch-1.12.1+cu116.html
pip install torch-geometric
conda install -c "dglteam/label/cu116" dgl
pip install tensorflow==2.12.*
python GNN_partition_dgl.py
The code will create a test
folder to contain the partitioned graph output.
Reference: https://github.com/GATECH-EIC/GCoD Some minor package compatibility issues are fixed.
cd GCoD
bash GCN_cora.sh
2-layer GCN on Cora, Citeseer and PubMed datasets Reference: https://github.com/pyg-team/pytorch_geometric/blob/master/examples/gcn.py