Skip to content

Commit

Permalink
Update md
Browse files Browse the repository at this point in the history
	修改:     README.md
	重命名:   document/Decumentation.md -> document/Documentation.md
	新文件:   document/Quick_Start.md
	删除:     include/dawn/algorithm/gpu/sgemv.cuh
	删除:     include/dawn/algorithm/gpu/spgemm.cuh
	删除:     include/dawn/algorithm/gpu/spmv.cuh
	新文件:   test/Performance.md
	新文件:   test/Test_Guide.md
	删除:     test/performance.md
	新文件:   tool/process.sh
	删除:     tool/process_all.sh

	修改:     .gitattributes
  • Loading branch information
lxrzlyr committed May 7, 2024
1 parent 89ba954 commit 0e9ec61
Show file tree
Hide file tree
Showing 12 changed files with 255 additions and 1,217 deletions.
5 changes: 0 additions & 5 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
*.c filter=copyright
*.cc filter=copyright
*.h filter=copyright
*.cpp filter=copyright
*.hxx filter=copyright
*.cu filter=copyright
*.cuh filter=copyright
*.md filter=copyrightW
*.sh filter=copyright
169 changes: 22 additions & 147 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,154 +1,19 @@
# DAWN: An Noval SSSP/APSP Algorithm, CUDA/C++

DAWN is a novel shortest paths algorithm, which is suitable for weighted and unweighted graphs. DAWN requires $O(m)$ space and $O(S_{wcc} \cdot E_{wcc})$ times on the unweighted graphs, which can also process SSSP tasks and requires $O(E_{wcc}(i))$ time. $S_{wcc}$ and $E_{wcc}$ denote the number of nodes and edges included in the largest WCC (Weakly Connected Component) in the graphs.
DAWN is a novel shortest paths algorithm, which is suitable for weighted and unweighted graphs. In contrast to the prevalent optimization of state-of-the-art BFS implementation, which commonly rely on priority queues, our approach leverages matrix operations to endow DAWN with enhanced parallelism. DAWN is capable of solving the shortest path problems on graphs with negative weights, and can automatically exclude the influence of negative weight cycles.

DAWN is capable of solving the APSP and SSSP problems on graphs with negative weights, and can automatically exclude the influence of negative weight cycles.
DAWN requires $O(m)$ space and $O(S_{wcc} \cdot E_{wcc})$ times on the unweighted graphs, which can also process SSSP tasks and requires $O(E_{wcc}(i))$ time. $S_{wcc}$ and $E_{wcc}$ denote the number of nodes and edges included in the largest WCC (Weakly Connected Component) in the graphs.

The rapid closeness centrality algorithm based on DAWN has been implemented, while work on the betweenness centrality algorithm is still ongoing. We are very interested in developing a new BC algorithm based on DAWN, and we will not simply replicate the Brandes algorithm, which means that the BC algorithm will not appear in this library in the short term. We encourage colleagues to complete the implementation of the Brandes algorithm before the new algorithm is implemented.
| [**Examples**](https://github.com/lxrzlyr/DAWN-An-Noval-SSSP-APSP-Algorithm/tree/dev/algorithm) | [**Documentation**](https://github.com/lxrzlyr/DAWN-An-Noval-SSSP-APSP-Algorithm/tree/dev/document) | [**Test**](https://github.com/lxrzlyr/DAWN-An-Noval-SSSP-APSP-Algorithm/tree/dev/test) |
| ----------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- |
- Examples: Demonstrate the usage of algorithms in DAWN.
- Document: Provides the detailed description of DAWN, include the **Quick_Start** and **Code_Guide**. **Quick_Start** provides the guide for quickly working with DAWN. **Code_Guide** provides the detailed description for how to implement own algorithm in DAWN.
- Test: Provides the detailed information of Testing.

To add NEW functions within DAWN, please refer to the [document/Code_Guide](https://github.com/lxrzlyr/DAWN-An-Noval-SSSP-APSP-Algorithm/blob/dev/document/Code_Guide.md).

## Quick Start Guide
## Development Status

### 0. Before getting started

Depending on your GPU, you may also want to edit the CUDA_ARCHITECTURES variable in $PROJECT_ROOT/algorithm/gpu/CMakeLists.txt

```c++
export PROJECT_ROOT="to_your_project_path"
```

### 1. Modify $PROJECT_ROOT/algorithm/gpu/CMakeLists.txt

According to your GPU, we use RTX 3080ti for computing, so CUDA_ARCHITECTURES is set to 86

```c++
set(CUDA_ARCHITECTURES "86")
```
If the machine does not have a GPU available, DAWN will automatically detect the CUDA environment and only build artifacts for the CPU. However, if you are certain that the machine has a usable GPU and you have been unable to build artifacts for the GPU correctly, we suspect there may be an issue with the CUDA environment. Please further check for any path-related problems.
### 2.Download testing data
Unzip the compressed package and put it in the directory you need
The input data can be found on the Science Data Bank
```c++
URL=https://www.scidb.cn/s/6BjM3a
GRAPH_DIR="to_your_graph_path"
```

### 3. Dependencies

DAWN builds, runs, and has been tested on Ubuntu/Rocky Linux. Even though DAWN may work on other linux systems, we have not tested correctness or performance. DAWN is not available on Windows and cannot achieve the same performance on WSL systems. Please beware.

At the minimum, DAWN depends on the following software:

- A modern C++ compiler compliant with the C++ 14 standard
- GCC (>= 9.4.0 or Clang >= 10.0.0)
- CMake (>= 3.10)
- libomp (>= 10.0)

If you need run DAWN on the GPU, expand:

- CUDA (>= 11.0)
- thrust (>= 2.0)

### 4. Build and RUN

```c++
cd $PROJECT_ROOT
mkdir build && cd build
cmake .. && make -j
```

If compilation succeeds without errors, you can run your code as before, for example

```c++
cd $PROJECT_ROOT/build
./apsp_cpu SG $GRAPH_DIR/mouse_gene.mtx ../output.txt false 0 unweighted

./apsp_cpu SG $GRAPH_DIR/cage10.mtx ../output.txt false 0 weighted

```

When the version is built, it will also prepare SSSP and MSSP applications, which can be used directly.

If you need to use DAWN in your own solution, please check the source code under the **src****include** folder and call them.

#### Using script

```c++
cd ..
vim ./process.sh
MAIN = ${main}
GRAPH_DIR = ${test_graph}
OUTPUT= ${outputfile}
LOG_DIR= ${GRAPH_DIR}/log
ESC && wq
sudo chmod +x ../process.sh
bash ../process.sh
```
Please note that the normal operation of the batch script needs to ensure that the test machine meets the minimum requirements. Insufficient memory or GPU memory needs to be manually adjusted according to amount of resources.
#### For general graphs
```c++
CPU: Multi-threaded processor supporting OpenMP API
RAM: 8GB or more
GPU: 1GB or more
Compiler: NVCC of CUDA 11.0 above
OS: Ubuntu 20.04 and above
```

#### For large-scale graphs

```c++
CPU: Multi-threaded processor supporting OpenMP API
RAM: 24GB or more
GPU: 4GB or more
Compiler: NVCC of CUDA 11.0 above
OS: Ubuntu 20.04 and above
```

### 5.Release version

| Algorithm | Implementation | Weigthed |
| --------- | -------------- | -------- |
| APSP | GOVM | True |
| APSP | SOVM | False |
| MSSP | GOVM | True |
| MSSP | SOVM | False |
| SSSP | GOVM | True |
| BFS | SOVM | False |

For the GPU version, please make sure that there is enough GPU memory for the graph. The size of the thread block and the scale of the graph is set reasonably according to the device parameters.

```c++
int device;
cudaDeviceProp props;
cudaGetDevice(&device);
cudaGetDeviceProperties(&props, device);
printf("Max shared memory per block: %ld\n", props.sharedMemPerBlock);
```
### 6.Performance
We have presented a performance comparison of algorithms for DAWN, GAPBS, and Gunrock in a [table](https://github.com/lxrzlyr/DAWN-An-Noval-SSSP-APSP-Algorithm/blob/dev/test/performance.md). The benchmark tests were run on the Gunrock benchmark dataset and the Suite Sparse Collection dataset. The table provides specific information about the graphs and their corresponding runtime.
We provide the file **check_unweighted.py** and **check_weighted.py**, based on networkx, which can be used to check the results printed by DAWN.
We also provide the test code for Gunrock and GAPBS in the **test** directory. Due to differences in code build environments and other aspects among the repositories, it is not possible to pull and build them uniformly. If you need to verify the results of Gunrock and GAPBS, please visit the repositories for [Gunrock](https://github.com/gunrock/gunrock) and [GAPBS](https://github.com/sbeamer/gapbs) respectively, follow the repository build instructions, and replace the source files in the repository with the ones we provide. Alternatively, you can pull our modified fork branch and build directly([Gunrock](https://github.com/lxrzlyr/gunrock),[GAPBS](https://github.com/lxrzlyr/gapbs)).
### 7.Documentation
Please refer to [document/Documentation](https://github.com/lxrzlyr/DAWN-An-Noval-SSSP-APSP-Algorithm/blob/dev/document/Decumentation.md) for commands.
## New version
The version of DWAN on the weighted graph has been included in DAWN V2.1. Currently, DAWN includes the version that runs on unweighted graphs of int type index values, and the version that runs on negative weighted graphs of float type. (SOVM and GOVM have been the default implementation, if you want to use BOVM, please change the kernel function.)
Currently, the rapid closeness centrality algorithm based on DAWN has been implemented, while work on the betweenness centrality algorithm is still ongoing. We are very interested in developing a new BC algorithm based on DAWN, which means that the BC algorithm will not appear in this library in the short term. We encourage colleagues to complete the implementation of the Brandes algorithm before the new algorithm is implemented.

| Algorithm | Release |
| ------------------- | ------- |
Expand All @@ -158,9 +23,6 @@ The version of DWAN on the weighted graph has been included in DAWN V2.1. Curren
| BFS | V2.1 |
| BC | Doing |
| CC | V2.3 |
| SPGEMM | Doing |
| SPGEMV | Doing |
| SPMV | Doing |
| Cluster Analysis | Future |
| Community Detection | Future |

Expand All @@ -170,6 +32,19 @@ We welcome any interest and ideas related to DAWN and its applications. If you a

The DAWN component based on Gunrock may be released to the main/develop branch in the near future, so please stay tuned to the [Gunrock](https://github.com/gunrock/gunrock). We will release new features of DAWN and the application algorithms based on DAWN on this repository. If the algorithms are also needed by Gunrock, we will contribute them to the Gunrock repository later.

## How to Cite DAWN
Thank you for citing our work.

```bibtex
@InProceedings{Feng:2024:DAWN,
author = {Yelai Feng and Huaixi Wang and Yining Zhu and Xiandong Liu and Hongyi Lu and Qing Liu},
title = {DAWN: Matrix Operation-Optimized Algorithm for Shortest Paths Problem on Unweighted Graphs},
booktitle = {Proceedings of the 38th ACM International Conference on Supercomputing},
year = {2024},
doi = {10.1145/3650200.3656600}
}
```

## Copyright & License

All source code are released under [Apache 2.0](https://github.com/lxrzlyr/DAWN-An-Noval-SSSP-APSP-Algorithm/blob/4266d98053678ce76e34be64477ac2364f0f4291/LICENSE).
File renamed without changes.
92 changes: 92 additions & 0 deletions document/Quick_Start.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
# Quick Start Guide

## 0. Before getting started

If the machine does not have a GPU available, DAWN will automatically detect the CUDA environment and only build artifacts for the CPU.

```c++
export PROJECT_ROOT="to_your_project_path"
```
## 1. Modify $PROJECT_ROOT/algorithm/gpu/CMakeLists.txt

If you want to use the GPU version of DAWN, you need to modify the following code in $PROJECT_ROOT/algorithm/gpu/CMakeLists.txt. According to your GPU, we use RTX 3080TI for computing, so CUDA_ARCHITECTURES is set to 86.

```c++
set(CUDA_ARCHITECTURES "86")
```
Certainly, if you are unaware of the CUDA_ARCHITECTURES, we have implemented code to automatically select the CUDA_ARCHITECTURES. However, this may not necessarily be the most optimal choice.
If you are certain that the machine has a usable GPU and you have been unable to build artifacts for the GPU correctly, we suspect there may be an issue with the CUDA environment. Please further check for any path-related problems.
## 2. Download testing data
Unzip the compressed package and put it in the directory you need. The input data can be found on the Science Data Bank.
```c++
URL=https://www.scidb.cn/s/6BjM3a
GRAPH_DIR="to_your_graph_path"
```

## 3. Dependencies

DAWN builds, runs, and has been tested on Ubuntu/Rocky Linux. Even though DAWN may work on other linux systems, we have not tested correctness or performance. DAWN is not available on Windows and cannot achieve the same performance on WSL systems. Please beware.

At the minimum, DAWN depends on the following software:

```c++
- A modern C++ compiler compliant with the C++ 14 standard
- GCC (>= 9.4.0 or Clang >= 10.0.0)
- CMake (>= 3.10)
- libomp (>= 10.0)
```

If you need run DAWN on the GPU, expand:

```c++
- CUDA (>= 11.0)
- thrust (>= 2.0)
```

## 4. Build and RUN

```c++
cd $PROJECT_ROOT
mkdir build && cd build
cmake .. && make -j
```

If compilation succeeds without errors, you can run your code as before, for example

```c++
cd $PROJECT_ROOT/build
./sssp_cpu $GRAPH_DIR/XX.mtx ../output.txt false 0
./sssp_gpu $GRAPH_DIR/XXX.mtx ../output.txt 1024 false 0
```

If you need to use DAWN in your own solution, please check the source code under the **src****include** folder and call them.

### 4.1 Using script

```c++
cd ..
vim ./process.sh
MAIN = ${main}
GRAPH_DIR = ${test_graph}
OUTPUT= ${outputfile}
LOG_DIR= ${GRAPH_DIR}/log
ESC && wq
sudo chmod +x ../process.sh
bash ../process.sh
```
Please note that the normal operation of the batch script needs to ensure that the test machine meets the minimum requirements. Insufficient memory or GPU memory needs to be manually adjusted according to amount of resources. For the GPU version, please make sure that there is enough GPU memory for the graph.
```c++
// For general graphs
CPU: Multi-threaded processor supporting OpenMP API
RAM: 8GB or more
GPU: 1GB or more
Compiler: NVCC of CUDA 11.0 above
OS: Ubuntu 20.04 and above
```
Loading

0 comments on commit 0e9ec61

Please sign in to comment.