Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/sparselinearalgebra/graphblas-sharp

GPGPU-based GraphBLAS-like API implementation in F# (using Brahma.FSharp and OpenCL)
https://github.com/sparselinearalgebra/graphblas-sharp

dotnet fsharp gpu graph-algorithms graphblas linear-algebra matrix sparse-linear-algebra sparse-matrix

Last synced: 2 months ago
JSON representation

GPGPU-based GraphBLAS-like API implementation in F# (using Brahma.FSharp and OpenCL)

Awesome Lists containing this project

README

        

# GraphBLAS-sharp

[![FAKE Build](https://github.com/YaccConstructor/GraphBLAS-sharp/actions/workflows/build-on-push.yml/badge.svg)](https://github.com/YaccConstructor/GraphBLAS-sharp/actions/workflows/build-on-push.yml)
[![NuGet Badge](https://buildstats.info/nuget/GraphBLAS-sharp)](https://www.nuget.org/packages/GraphBLAS-sharp/)
[![License](https://img.shields.io/badge/License-MIT-red.svg)](https://opensource.org/licenses/MIT)

GraphBLAS# is a GPGPU-based [GraphBLAS](https://graphblas.org/)-like API implementation in F#. To utilize GPGPUs we use [Brahma.FSharp](https://github.com/YaccConstructor/Brahma.FSharp). So, GraphBLAS# can utilize any OpenCL-compatible device.

### Features
- ```Option<'t>``` to solve [explicit/implicit zeroes problem](https://github.com/GraphBLAS/LAGraph/issues/28#issuecomment-542952115). If graph has labels of type ```'t``` then adjacency matrix is ```Matrix>```. Sparse storage contains only values for ```Some<'t>``` cells.
- Elementwise operations have type ```AtLeastOne<'t1,'t2> -> Option<'t3>``` to be shure that ```None op None``` is ```None```. Also developer explicitly controls what should be ```None```. ```AtLeastOne``` defined as fallows:
```fsharp
type AtLeastOne<'t1, 't2> =
| Both of 't1*'t2
| Left of 't1
| Right of 't2
```
So, type of matrix-matrix elementwise operation is ```Matrix> -> Matrix> -> (AtLeastOne<'t1,'t2> -> Option<'t3>) -> Matrix>```.
- No semirings. Just functions. Of course one can implement semirings on the top of provided API.
- Minimal core: high-order functions allows us to minimaze core by functions unification. For example, such functions as matrix-matrix addition, matrix-matrix element-wise multiplication, masking all are partial case of `map2` function.

### Operations
- **Matrix-Matrix**
- [x] CSR-CSR `map2`
- [x] CSR-CSR `map2AtLeastOne`
- [x] COO-COO `map2`
- [x] COO-COO `map2AtLeastOne`
- [x] CSR-CSR multiplication
- [x] CSR-CSR Kronecker product
- **Vector-Matrix**
- [x] Dense-CSR multiplication
- [ ] Sparse-CSR multiplication
- **Vector-Vector**
- [x] Dense-Dense `map2`
- [x] Dense-Dense `map2AtLeastOne`
- [x] Sparse-Sparse `map2`
- [x] Sparse-Sparse `map2AtLeastOne`
- [ ] ...
- **Matrix**
- [x] `copy`
- [x] `map`
- [x] COO transpose
- [x] CSR transpose
- [x] CSC transpose
- [ ] ...
- **Vector**
- [x] `zeroCreate`
- [x] `ofList`
- [x] `copy`
- [x] `reduce`
- [ ] ...

### Graph Analysis Algorithms
- [ ] BFS
- [ ] Parent BFS
- [ ] Single Source Shortest Path
- [ ] Triangles Counting
- [ ] Local Clustering Coefficient
- [ ] Community Detection using Label Propagation
- [ ] Weakly Connected Components
- [ ] PageRank

### Evaluation
Matrices from [SuiteSparse matrix collection](https://sparse.tamu.edu/) which we choose for evaluation.


Matrix
Size
NNZ
Squared matrix NNZ


wing
62 032
243 088
714 200


luxembourg osm
114 599
119 666
393 261


amazon0312
400 727
3 200 440
14 390 544


amazon-2008
735 323
5 158 388
25 366 745


web-Google
916 428
5 105 039
29 710 164


webbase-1M
1 000 005
3 105 536
51 111 996


cit-Patents
3 774 768
16 518 948
469

Element-wise matrix-matrix evaluation results presented below. Time is measured in milliseconds. We perform our experiments on the PC with Ubuntu 20.04 installed and with the following hardware configuration: Intel Core i7–4790 CPU, 3.60GHz, 32GB DDR4 RAM with GeForce GTX 2070, 8GB GDDR6, 1.41GHz.


Matrix
Elemint-wise addition
Elemint-wise multiplication


GraphBLAS-sharp
SuiteSparse
CUSP
GraphBLAS-sharp
SuiteSparse


No AtLeastOne
AtLeastOne


wing
4,3 ± 0,8
4,3 ± 0,6
2,7 ± 0,9
1,5 ± 0,0
3,7 ± 0,5
3,5 ± 0,4


luxembourg osm
4,9 ± 0,7
4,1 ± 0,5
3,0 ± 1,1
1,2 ± 0,1
3,8 ± 0,6
3,0 ± 0,6


amazon0312
22,3 ± 1,3
22,1 ± 1,3
33,4 ± 0,8
11,0 ± 1,4
18,7 ± 0,9
35,7 ± 1,4


amazon-2008
38,7 ± 0,8
39,0 ± 1,0
55,9 ± 1,0
19,1 ± 1,4
34,5 ± 1,0
58,9 ± 1,9


web-Google
43,4 ± 0,8
43,4 ± 1,1
67,2 ± 7,5
21,3 ± 1,3
39,0 ± 1,2
66,2 ± 0,4


webbase-1M
63,6 ± 1,1
63,7 ± 1,3
86,5 ± 2,0
24,3 ± 1,3
54,5 ± 0,7
37,6 ± 5,6


cit-Patents
26,9 ± 0,7
26,0 ± 0,7
183,4 ± 5,4
10,8 ± 0,6
24,3 ± 0,7
162,2 ± 1,7

## Contributing
Contributions, issues and feature requests are welcome.
Feel free to check [issues](https://github.com/YaccConstructor/GraphBLAS-sharp/issues) page if you want to contribute.

## Build
Make sure the following **requirements** are installed on your system:
- [dotnet SDK](https://dotnet.microsoft.com/en-us/download/dotnet/5.0) 5.0 or higher
- OpenCL-compatible device and respective OpenCL driver

To build and run all tests:

- on Windows
```cmd
build.cmd
```

- on Linux/macOS
```shell
./build.sh
```
To find more options look at [MiniScaffold](https://github.com/TheAngryByrd/MiniScaffold). We use it in our project.

### Release
The release process is automated: NuGet packages publishing process is triggered by tag pushing to any branch.
To release new version one should
1. [Add release notes to CHANGELOG](https://github.com/TheAngryByrd/MiniScaffold/blob/master/Content/Library/README.md#releasing)
2. Run ```./build.sh Release [version]``` (on local machine)

## License
This project licensed under MIT License. License text can be found in the [license file](https://github.com/YaccConstructor/GraphBLAS-sharp/blob/master/LICENSE.md).