Skip to content

Commit 0addba4

Browse files
committed
1.0.0
1 parent 3f2df70 commit 0addba4

File tree

1 file changed

+58
-0
lines changed

1 file changed

+58
-0
lines changed

README.md

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,61 @@
11
# `riften::Forkpool`
22

3+
A bleeding-edge, lock-free, wait-free, continuation-stealing scheduler for C++20. This project uses C++20's coroutines to implement continuation-stealing scheduler without the use of any macros/inline assembly. The interface is designed to mirror [`Cilk`](https://en.wikipedia.org/wiki/Cilk).
4+
5+
```C++
6+
#include "riften/thiefpool.hpp"
7+
8+
using namespace riften;
9+
10+
Task<int> fib(int n) { // Define a task to be run on the threadpool
11+
if (n < 2) {
12+
co_return n;
13+
} else {
14+
Future a = co_await fork(fib, n - 1); // Tasks can recursivly spawn tasks
15+
Future b = co_await fork(fib, n - 2);
16+
17+
co_await tag_sync(); // Sync before consuminging the futures
18+
19+
co_return *a + *b;
20+
}
21+
}
22+
23+
int main(){
24+
25+
int result = root(fib, 10) // Submit a root task to the threadpool and block until it completes
26+
27+
return 0;
28+
}
29+
30+
```
31+
32+
33+
34+
## Installation
35+
36+
The recommended way to consume this library is through [CPM.cmake](https://github.com/cpm-cmake/CPM.cmake), just add:
37+
38+
```CMake
39+
CPMAddPackage("gh:ConorWilliams/Forkpool#v1.0.0")
40+
```
41+
to your `CMakeLists.txt` and you're good to go!
42+
43+
## Tests
44+
45+
To compile and run the tests:
46+
```zsh
47+
mkdir build && cd build
48+
cmake ../test
49+
make && make test
50+
```
51+
52+
## Reference
53+
54+
This project implements many of the ideas in (available in `reference/`):
55+
56+
1. F. Schmaus et al., “Nowa: A Wait-Free Continuation-Stealing
57+
Concurrency Platform”. In: 2021 IEEE International Parallel and
58+
Distributed Processing Symposium (IPDPS). 2021.
59+
60+
2. C. -X. Lin, T. -W. Huang and M. D. F. Wong, "An Efficient Work-Stealing Scheduler for Task Dependency Graph," 2020 IEEE 26th International Conference on Parallel and Distributed Systems (ICPADS), 2020, pp. 64-71, doi: 10.1109/ICPADS51040.2020.00018.
361

0 commit comments

Comments
 (0)