Skip to content

Commit

Permalink
[docs] update (#217)
Browse files Browse the repository at this point in the history
* update

* update

* update

* update

* update

* update

* update

* update

* remove useless code

* update

---------

Co-authored-by: gyzhou2000 <[email protected]>
Co-authored-by: gyzhou2000 <[email protected]>
  • Loading branch information
3 people authored Jul 15, 2024
1 parent 340d5f5 commit 3ce4e17
Show file tree
Hide file tree
Showing 51 changed files with 390 additions and 2,607 deletions.
62 changes: 0 additions & 62 deletions .circleci/config.yml

This file was deleted.

14 changes: 0 additions & 14 deletions .circleci/requirements.txt

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/test_push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
pip install -r .circleci/requirements.txt
pip install -r requirements.txt
- name: Install Other dependencies Package
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test_pypi_package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
pip install -r .circleci/requirements.txt
pip install -r requirements.txt
- name: Install TensorLayerx
run: |
Expand Down
2 changes: 2 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ Contribution is always welcomed. Please feel free to open an issue or email to y
- Zihao Zhao (Gamma Lab)
- Feng Guo (Gamma Lab)
- Shujie Li (Gamma Lab)
- Jiayi Gao (Gamma Lab)
- Yuxuan Shan (BUPT)
- Zeyao Ma (BUPT)
- Yiming Jia (BUPT)
Expand All @@ -49,6 +50,7 @@ Contribution is always welcomed. Please feel free to open an issue or email to y
- Jiarui Tan (BUPT)
- Zhaojun Sun (BUPT)
- Jiayi Guo (BUPT)
- Xinyan Zhu (BUPT)

Advisor

Expand Down
26 changes: 15 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -439,20 +439,22 @@ Now, GammaGL supports about 60 models, we welcome everyone to use or contribute
| [HiD-Net [AAAI 2023]](./examples/hid_net) | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
| [FusedGAT [MLSys 2022]](./examples/fusedgat) | | :heavy_check_mark: | | |
| [GLNN [ICLR 2022]](./examples/glnn) | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
| [HEAT [T-ITS 2022]](./examples/heat) | | :heavy_check_mark: | | |
| [DFAD-GNN [IJCAI 2022]](./examples/dfad_gnn) | | :heavy_check_mark: | | |
| [GNN-LF-HF [WWW 2021]](./examples/gnnlfhf) | | :heavy_check_mark: | | |
| [DNA [ICLR 2019]](./examples/dna) | | :heavy_check_mark: | | |


| Contrastive Learning | TensorFlow | PyTorch | Paddle | MindSpore |
| -------------------------------------------------- | ------------------ | ------------------ | ------------------ | ------------------ |
| [DGI [ICLR 2019]](./examples/dgi) | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
| [GRACE [ICML 2020 Workshop]](./examples/grace) | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
| [GRADE [NeurIPS 2022]](./examples/grade) | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
| [MVGRL [ICML 2020]](./examples/mvgrl) | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
| [InfoGraph [ICLR 2020]](./examples/infograph) | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
| [MERIT [IJCAI 2021]](./examples/merit) | :heavy_check_mark: | | :heavy_check_mark: | :heavy_check_mark: |
| [GNN-POT [NeurIPS 2023]](./examples/grace_pot) | | :heavy_check_mark: | | |
| [MAGCL [AAAI 2023]](./examples/magcl) | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
| Contrastive Learning | TensorFlow | PyTorch | Paddle | MindSpore |
| ---------------------------------------------- | ------------------ | ------------------ | ------------------ | ------------------ |
| [DGI [ICLR 2019]](./examples/dgi) | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
| [GRACE [ICML 2020 Workshop]](./examples/grace) | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
| [GRADE [NeurIPS 2022]](./examples/grade) | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
| [MVGRL [ICML 2020]](./examples/mvgrl) | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
| [InfoGraph [ICLR 2020]](./examples/infograph) | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
| [MERIT [IJCAI 2021]](./examples/merit) | :heavy_check_mark: | | :heavy_check_mark: | :heavy_check_mark: |
| [GNN-POT [NeurIPS 2023]](./examples/grace_pot) | | :heavy_check_mark: | | |
| [MAGCL [AAAI 2023]](./examples/magcl) | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
| [Sp2GCL [NeurIPS 2023]](./examples/sp2gcl) | | :heavy_check_mark: | | |

| Heterogeneous Graph Learning | TensorFlow | PyTorch | Paddle | MindSpore |
| -------------------------------------------------- | ------------------ | ------------------ | ------------------ | ------------------ |
Expand All @@ -466,6 +468,8 @@ Now, GammaGL supports about 60 models, we welcome everyone to use or contribute
| [MetaPath2Vec [KDD 2017]](./examples/metapath2vec) | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
| [HERec [TKDE 2018]](./examples/herec) | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
| [HeCo [KDD 2021]](./examples/heco) | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | |
| [DHN [TKDE 2023]](./examples/dhn) | | :heavy_check_mark: | | |
| [HEAT [T-ITS 2023]](./examples/heat) | | :heavy_check_mark: | | |

> Note
>
Expand Down
4 changes: 2 additions & 2 deletions docs/source/notes/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ Install from pip

.. code:: bash
pip install gammgl
pip install gammagl
Install from source
-------------------
Expand Down Expand Up @@ -114,7 +114,7 @@ Install from source

.. code:: bash
python setup.py bulid_ext --inplace
python setup.py build_ext --inplace
How to Run
----------
Expand Down
67 changes: 26 additions & 41 deletions profiler/mpops/complete_test/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ In order for users to clearly understand the details of operator testing, we hav

## Dataset

The location of the dataset is `GammaGL/profiler/mpops/edge_index`, `cora.npy` corresponds to the `Cora` dataset, `pubmed.npy` corresponds to the `PubMed` dataset, `ogbn-arxiv.npy` corresponds to the `Ogbn-Arxiv` dataset.
You need to run the `test.py` in the `edge_index/` path to download the dataset. The location of the dataset is `GammaGL/profiler/mpops/edge_index`, `cora.npy` corresponds to the `Cora` dataset, `pubmed.npy` corresponds to the `PubMed` dataset, `ogbn-arxiv.npy` corresponds to the `Ogbn-Arxiv` dataset.

You can use `np.load(path_to_the_dataset)` to load the corresponding dataset.

Expand All @@ -14,55 +14,40 @@ The information of the dataset is as follows:
| :--------: | :-------------: | :-------------: |
| Cora | 2708 | 13264 |
| PubMed | 19717 | 108368 |
| Ogbn-Arxiv | 169344 | 2315598 |
| Ogbn-Arxiv | 169343 | 2315598 |

## Directory of the test code folder

The location of the test code is `GammaGL/profiler/mpops/complete_test`. The following is the directory structure of the `complete_test` folder, `:` followed by the file description.

```
complete_test
├── mp_cpu: code folder to test the efficiency of message passing process under CPU
│ ├── dgl_mp_cpu.py
│ ├── ms_mp_cpu.py
│ ├── pd_ext_sum_cpu.py
│ ├── pd_mp_cpu.py
│ ├── pyg_mp_cpu.py
│ ├── spmm_sum_cpu.py
│ ├── tf_mp_cpu.py
│ ├── th_ext_max_cpu.py
│ └── th_mp_cpu.py
├── mp_gpu: code folder to test the efficiency of message passing process under GPU
│ ├── dgl_mp_gpu.py
│ ├── ms_mp_gpu.py
│ ├── pd_ext_sum_gpu.py
│ ├── pd_mp_gpu.py
│ ├── pyg_mp_gpu.py
│ ├── spmm_sum_gpu.py
│ ├── tf_mp_gpu.py
│ ├── th_ext_max_gpu.py
│ └── th_mp_gpu.py
├── ops_cpu: code folder for testing the efficiency of operators under CPU
│ ├── ms_segment_ops_cpu.py
│ ├── pd_ext_segment_sum_cpu.py
│ ├── pd_segment_ops_cpu.py
│ ├── pyg_scatter_ops_cpu.py
│ ├── tf_segment_ops_cpu.py
│ ├── th_ext_segment_max_cpu.py
│ └── th_segment_ops_cpu.py
└── ops_gpu: code folder for testing the efficiency of operators under GPU
├── ms_segment_ops_gpu.py
├── pd_ext_segment_sum_gpu.py
├── pd_segment_ops_gpu.py
├── pyg_scatter_ops_gpu.py
├── tf_segment_ops_gpu.py
├── th_ext_segment_max_gpu.py
└── th_segment_ops_gpu.py
|-- README.md
|-- mp_cpu
| |-- dgl_mp_cpu.py
| |-- ggl_mp_cpu.py
| |-- pd_ext_sum_cpu.py
| |-- pyg_mp_cpu.py
| `-- spmm_sum_cpu.py
|-- mp_gpu
| |-- dgl_mp_gpu.py
| |-- ggl_mp_gpu.py
| |-- pd_ext_sum_gpu.py
| |-- pyg_mp_gpu.py
| `-- spmm_sum_gpu.py
|-- ops_cpu
| |-- ggl_segment_cpu.py
| |-- pd_ext_segment_sum_cpu.py
| `-- pyg_scatter_ops_cpu.py
`-- ops_gpu
|-- ggl_segment_gpu.py
|-- pd_ext_segment_sum_gpu.py
`-- pyg_scatter_ops_gpu.py
```

## How to run test code

Let's take `th_segment_ops_gpu.py` as an example.
Let's take `ggl_segment_gpu.py` as an example.

You can switch the program running position through `os.environ["CUDA_VISIBLE_DEVICES"] = "4"` , the `4` represents the fourth GPU in your server, and if you set it to `-1` , it will run on the CPU.

Expand All @@ -81,9 +66,9 @@ You can set the dataset to run by changing the list of `file_name` .

In order to accurately calculate the running time, we increase the running times of each operator. After getting the running time, we divide it by the running times to get the single running time of the operator. `iter` represents the number of times each operator runs.

For `th_segment_ops_gpu.py` , you can run it using:
For `ggl_segment_gpu.py` , you can run it using:

```bash
python th_segment_ops_gpu.py
python ggl_segment_gpu.py
```

82 changes: 82 additions & 0 deletions profiler/mpops/complete_test/mp_cpu/ggl_mp_cpu.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
import os
# os.environ['TL_BACKEND'] = "torch"
os.environ["CUDA_VISIBLE_DEVICES"] = "-1"
import tensorlayerx as tlx
from gammagl.mpops import *
import numpy as np
import time

relative_path = '/home/zgy/review/zgy/GammaGL/profiler/mpops/edge_index/'
file_name = ['cora.npy', 'pubmed.npy', 'ogbn-arxiv.npy']
embedding = [16, 64, 256]
iter = 10

operations = {
'segment_max': segment_max,
'unsorted_segmnet_max': unsorted_segment_max,
'segment_sum': segment_sum,
'unsorted_segment_sum': unsorted_segment_sum,
'segment_mean': segment_mean,
'unsorted_segment_mean': unsorted_segment_mean
}


def run_test(operation, x, dst, num_nodes):
edge_weight = tlx.ones(shape=(edge_index.shape[1],), dtype=tlx.float32)
edge_weight = tlx.expand_dims(edge_weight, -1)

msg = tlx.gather(x, src) # warm up
operation(msg, dst, num_nodes)

start = time.time()
for j in range(iter):
msg = tlx.gather(x, src)
msg = msg * edge_weight
operation(msg, dst, num_nodes)
end = time.time()
return end - start


with open('test_results.txt', 'w') as result_file:
for name in file_name:
path = relative_path + name
result_file.write(f"Loading data from {path}\n")
print(f"Loading data from {path}")
edge_index = np.load(path)

num_nodes = np.max(edge_index) + 1
src = tlx.convert_to_tensor(edge_index[0, :], tlx.int64)
dst = tlx.convert_to_tensor(edge_index[1, :], tlx.int64)
dst2 = None

# TensorFlow-specific preprocessing for sorted operations
if tlx.BACKEND == 'tensorflow' or tlx.BACKEND == 'paddle' or tlx.BACKEND == 'mindspore':
dst_numpy = tlx.convert_to_numpy(dst)
idx = np.argsort(dst_numpy)
dst2 = tlx.gather(tlx.convert_to_tensor(dst_numpy, dtype=tlx.int64), tlx.convert_to_tensor(idx, dtype=tlx.int64))

for embedding_dim in embedding:
result_file.write(f"** Testing embedding dimension {embedding_dim} **\n")
print(f"** Testing embedding dimension {embedding_dim} **")
x = tlx.convert_to_tensor(np.random.randn(num_nodes, embedding_dim), dtype=tlx.float32)

# Running tests for all operations
for op_name, op_func in operations.items():
dst_target = dst2 if dst2 is not None else dst
duration = run_test(op_func, x, dst_target, num_nodes)
result = f"{op_name}: {duration:.3f} seconds\n"
result_file.write(result)
print(result)

print(f"** Done testing embedding dimension {embedding_dim} **")
result_file.write(f"** Done testing embedding dimension {embedding_dim} **\n")

if tlx.BACKEND == 'paddle':
info = f"Data tensors are on device: {x.place}\n"
elif tlx.BACKEND == 'mindspore':
info = f"mindspore\n"
else:
info = f"Data tensors are on device: {x.device}\n"
print(info, end='')
result_file.write(info)

Loading

0 comments on commit 3ce4e17

Please sign in to comment.