Skip to content

Commit 6624da1

Browse files
authored
Merge pull request #1839 from ericniebler/update-readme
update the README
2 parents 6542592 + 0d02d44 commit 6624da1

File tree

4 files changed

+80
-122
lines changed

4 files changed

+80
-122
lines changed

.github/workflows/test-nvc++-22.11.sh

Lines changed: 0 additions & 27 deletions
This file was deleted.

.github/workflows/test-nvc++-22.7.sh

Lines changed: 0 additions & 27 deletions
This file was deleted.

.github/workflows/test-nvc++-22.9.sh

Lines changed: 0 additions & 27 deletions
This file was deleted.

README.md

Lines changed: 80 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,19 @@
11
# Senders - A Standard Model for Asynchronous Execution in C++
22

3-
`stdexec` is an experimental reference implementation of the _Senders_ model of asynchronous programming proposed by [**P2300 - `std::execution`**](http://wg21.link/p2300) for adoption into the C++ Standard.
3+
`stdexec` is an experimental reference implementation of the _Senders_ model of
4+
asynchronous programming proposed by [**P2300 -
5+
`std::execution`**](http://wg21.link/p2300) and accepted into the C++26 Standard.
46

57
**Purpose of this Repository:**
6-
1. Provide a proof-of-concept implementation of the design proposed in [P2300](http://wg21.link/p2300).
7-
2. Provide early access to developers looking to experiment with the Sender model.
8-
3. Collaborate with those interested in participating or contributing to the design of P2300 (contributions welcome!).
8+
9+
1. Provide a reference implementation for the C++26 additions to `std::execution`.
10+
11+
2. Get usage experience with the C++26 `std::execution` additions, as well as with
12+
not-yet-proposed extensions to `std::execution`.
13+
14+
3. Provide NVIDIA-specific extensions for running code on NVIDIA GPUs using standard C++.
15+
16+
4. Collaborate with those interested in extending `std::execution` for C++29.
917

1018
## Disclaimer
1119

@@ -18,7 +26,7 @@ The authors and NVIDIA do not guarantee that this code is fit for any purpose wh
1826
## Example
1927

2028
Below is a simple program that executes three senders concurrently on a thread pool.
21-
Try it live on [godbolt!](https://godbolt.org/z/3cseorf7M).
29+
Try it live on [godbolt!](https://godbolt.org/z/8MqaKEEfT).
2230

2331
```c++
2432
#include <stdexec/execution.hpp>
@@ -49,26 +57,11 @@ int main()
4957
// Launch the work and wait for the result
5058
auto [i, j, k] = stdexec::sync_wait(std::move(work)).value();
5159

52-
// Print the results:
60+
// Prints "0 1 4":
5361
std::printf("%d %d %d\n", i, j, k);
5462
}
5563
```
5664

57-
## Resources
58-
- [Working with Asynchrony Generically: A Tour of Executors: Part 1](https://www.youtube.com/watch?v=xLboNIf7BTg) ([Part 2](https://www.youtube.com/watch?v=6a0zzUBUNW4)) (Video): A comprehensive introduction to Senders and structured concurrency
59-
- [What are Senders Good For, Anyway?](https://ericniebler.com/2024/02/04/what-are-senders-good-for-anyway/) (Blog): Demonstrates the value of a standard async programming model by wrapping a C-style async API in a sender
60-
- [From Zero to Sender/Receiver in ~60 Minutes](https://www.youtube.com/watch?v=xiaqNvqRB2E) (Video): Live-coding a toy sender/receiver implementation from scratch
61-
- [A Unifying Abstraction for Async in C++](https://www.youtube.com/watch?v=h-ExnuD6jms) (Video): A simple introduction to the concepts behind P2300
62-
- [A Universal Async Abstraction for C++](https://cor3ntin.github.io/posts/executors/) (Blog): An introduction to Senders
63-
- [A Universal I/O Abstraction for C++](https://cor3ntin.github.io/posts/iouring/) (Blog): A look at how the Senders concepts interact with `io_uring` on Linux
64-
- [Structured Concurrency](https://www.youtube.com/watch?v=1Wy5sq3s2rg) (Video): An explanation of structured concurrency in C++ and its benefits
65-
- [Executors: a Change of Perspective](https://accu.org/journals/overload/29/165/teodorescu/) (Article): An article about the computational completeness of Senders
66-
- [Structured Concurrency in C++](https://accu.org/journals/overload/30/168/teodorescu/) (Article): An article about how Senders manifest the principles of structured concurrency
67-
- [Structured Networking in C++](https://www.youtube.com/watch?v=XaNajUp-sGY) (Video): A look at what a P2300-style networking library could look like
68-
- [HPCWire Article](https://www.hpcwire.com/2022/12/05/new-c-sender-library-enables-portable-asynchrony/): Provides a high-level overview of the Sender model and its benefits
69-
- [NVIDIA HPC SDK Documentation](https://docs.nvidia.com/hpc-sdk/index.html): Documentation for the NVIDIA HPC SDK
70-
- [P2300 - `std::execution`](https://wg21.link/p2300): Senders proposal to C++ Standard
71-
7265
## Structure
7366

7467
This library is header-only, so all the source code can be found in the `include/` directory. The physical and logical structure of the code can be summarized by the following table:
@@ -85,39 +78,62 @@ This library is header-only, so all the source code can be found in the `include
8578
There are a few ways to get `stdexec`:
8679
1. Clone from GitHub
8780
- `git clone https://github.com/NVIDIA/stdexec.git`
88-
2. Download the [NVIDIA HPC SDK starting with 22.11](https://developer.nvidia.com/nvidia-hpc-sdk-releases)
89-
3. (Recommended) Use [CMake Package Manager (CPM)](https://github.com/cpm-cmake/CPM.cmake) to automatically pull `stdexec` as part of your CMake project. [See below](#cmake-package-manager-cpm) for more information.
9081

91-
You can also try it directly on [godbolt.org](https://godbolt.org/z/acaE93xq3) where it is available as a C++ library or via the nvc++ compiler starting with version 22.11 ([see below](#nvhpc-sdk) for more details).
82+
2. Download the [NVIDIA HPC SDK starting with
83+
22.11](https://developer.nvidia.com/nvidia-hpc-sdk-releases)
84+
85+
3. (Recommended) Use [CMake Package Manager (CPM)](https://github.com/cpm-cmake/CPM.cmake)
86+
to automatically pull `stdexec` as part of your CMake project. [See
87+
below](#cmake-package-manager-cpm) for more information.
88+
89+
You can also try it directly on [godbolt.org](https://godbolt.org/z/acaE93xq3) where it is
90+
available as a C++ library or via the nvc++ compiler starting with version 22.11 ([see
91+
below](#nvhpc-sdk) for more details).
9292

9393
## Using `stdexec`
9494

9595
### Requirements
9696

97-
`stdexec` requires compiling with C++20 (`-std=c++20`) but otherwise does not have any dependencies and only requires a sufficiently new compiler:
97+
`stdexec` requires compiling with C++20 (`-std=c++20`) but otherwise does not have any
98+
dependencies and only requires a sufficiently new compiler:
9899

99100
- gcc 11+
100101
- clang 16+
101102
- XCode 16+
102-
- [nvc++ 22.11+](https://developer.nvidia.com/nvidia-hpc-sdk-releases) (required for [GPU support](#gpu-support)). If using `stdexec` from GitHub, then nvc++ 23.3+ is required.
103+
- [nvc++ 25.9+](https://developer.nvidia.com/nvidia-hpc-sdk-releases) (required for [GPU
104+
support](#gpu-support)).
105+
106+
> [!NOTE]
107+
> `stdexec` does not yet work with NVIDIA's nvcc compiler.
103108
104109
How you configure your environment to use `stdexec` depends on how you got `stdexec`.
105110

106111
### NVHPC SDK
107112

108-
Starting with the 22.11 release of the [NVHPC SDK](https://developer.nvidia.com/nvidia-hpc-sdk-releases), `stdexec` is available as an experimental, opt-in feature. Specifying the `--experimental-stdpar` flag to `nvc++` makes the `stdexec` headers available on the include path. You can then include any `stdexec` header as normal: `#include <stdexec/...>`, `#include <nvexec/...>`. See [godbolt example](https://godbolt.org/z/qc1h3sqEv).
113+
Starting with the 22.11 release of the [NVHPC
114+
SDK](https://developer.nvidia.com/nvidia-hpc-sdk-releases), `stdexec` is available as an
115+
experimental, opt-in feature. Specifying the `--experimental-stdpar` flag to `nvc++` makes
116+
the `stdexec` headers available on the include path. You can then include any `stdexec`
117+
header as normal: `#include <stdexec/...>`, `#include <nvexec/...>`. See [godbolt
118+
example](https://godbolt.org/z/qc1h3sqEv).
109119

110-
GPU features additionally require specifying `-stdpar=gpu`. For more details, see [GPU Support](#gpu-support).
120+
GPU features additionally require specifying `-stdpar=gpu`. For more details, see [GPU
121+
Support](#gpu-support).
111122

112123
### GitHub
113124

114-
As a header-only C++ library, technically all one needs to do is add the `stdexec` `include/` directory to your include path as `-I<stdexec root>/include` in addition to specifying any necessary compile options.
125+
As a (mostly) header-only C++ library, technically all one needs to do is add the
126+
`stdexec` `include/` directory to your include path as `-I<stdexec root>/include` in
127+
addition to specifying any necessary compile options.
115128

116-
For simplicity, we recommend using the [CMake targets](#cmake) that `stdexec` provides as they encapsulate the necessary configuration.
129+
For simplicity, we recommend using the [CMake targets](#cmake) that `stdexec` provides as
130+
they encapsulate the necessary configuration.
117131

118132
#### cmake
119133

120-
If your project uses CMake, then after cloning `stdexec` simply add the following to your `CMakeLists.txt`:
134+
If your project uses CMake, then after cloning `stdexec` simply add the following to your
135+
`CMakeLists.txt`:
136+
121137
```
122138
add_subdirectory(<stdexec root>)
123139
```
@@ -128,27 +144,32 @@ This will make the `STDEXEC::stdexec` target available to link with your project
128144
target_link_libraries(my_project PRIVATE STDEXEC::stdexec)
129145
```
130146

131-
This target encapsulates all of the necessary configuration and compiler flags for using `stdexec`.
147+
This target encapsulates all of the necessary configuration and compiler flags for using
148+
`stdexec`.
132149

133150

134151
#### CMake Package Manager (CPM)
135152

136-
To further simplify obtaining and including `stdexec` in your CMake project, we recommend using [CMake Package Manager (CPM)](https://github.com/cpm-cmake/CPM.cmake) to fetch and configure `stdexec`.
153+
To further simplify obtaining and including `stdexec` in your CMake project, we recommend
154+
using [CMake Package Manager (CPM)](https://github.com/cpm-cmake/CPM.cmake) to fetch and
155+
configure `stdexec`.
137156

138157
Complete example:
158+
139159
```
140160
cmake_minimum_required(VERSION 3.25.0 FATAL_ERROR)
141161
142162
project(stdexecExample)
143163
144-
# Get CPM
145-
# For more information on how to add CPM to your project, see: https://github.com/cpm-cmake/CPM.cmake#adding-cpm
164+
# Get CPM. For more information on how to add CPM to your project, see:
165+
# https://github.com/cpm-cmake/CPM.cmake#adding-cpm
146166
include(CPM.cmake)
147167
148168
CPMAddPackage(
149169
NAME stdexec
150170
GITHUB_REPOSITORY NVIDIA/stdexec
151-
GIT_TAG main # This will always pull the latest code from the `main` branch. You may also use a specific release version or tag
171+
GIT_TAG main # This will always pull the latest code from the `main` branch.
172+
# You may also use a specific release version or tag.
152173
)
153174
154175
add_executable(main example.cpp)
@@ -159,17 +180,20 @@ target_link_libraries(main STDEXEC::stdexec)
159180
### GPU Support
160181

161182
`stdexec` provides schedulers that enable execution on NVIDIA GPUs:
183+
162184
- `nvexec::stream_scheduler`
163185
- Single GPU scheduler that executes on the first available GPU (device 0)
164-
- Defined in [`<nvexec/stream_context.cuh>`](https://github.com/NVIDIA/stdexec/blob/main/include/nvexec/stream_context.cuh)
186+
- Defined in
187+
[`<nvexec/stream_context.cuh>`](https://github.com/NVIDIA/stdexec/blob/main/include/nvexec/stream_context.cuh)
188+
165189
- `nvexec::multi_gpu_stream_scheduler`
166190
- Executes on all visible GPUs
167-
- Defined in [`<nvexec/multi_gpu_context.cuh>`](https://github.com/NVIDIA/stdexec/blob/main/include/nvexec/multi_gpu_context.cuh)
191+
- Defined in
192+
[`<nvexec/multi_gpu_context.cuh>`](https://github.com/NVIDIA/stdexec/blob/main/include/nvexec/multi_gpu_context.cuh)
168193

169194
These schedulers are only supported when using the `nvc++` compiler with `-stdpar=gpu`.
170195

171-
Example: https://godbolt.org/z/4cEMqY8r9
172-
196+
Example: https://godbolt.org/z/h7rh5qGhj
173197

174198
## Building
175199

@@ -183,7 +207,7 @@ The following tools are needed:
183207
* One of the following supported C++ compilers:
184208
* GCC 11+
185209
* clang 12+
186-
* nvc++ 22.11 (nvc++ 23.3+ for `stdexec` from GitHub)
210+
* nvc++ 25.9
187211

188212
Perform the following actions:
189213

@@ -223,6 +247,21 @@ cmake -S . -B build/clang++ -G<gen> \
223247
cmake --build build/clang++
224248
```
225249

250+
## Resources
251+
- [Working with Asynchrony Generically: A Tour of Executors: Part 1](https://www.youtube.com/watch?v=xLboNIf7BTg) ([Part 2](https://www.youtube.com/watch?v=6a0zzUBUNW4)) (Video): A comprehensive introduction to Senders and structured concurrency
252+
- [What are Senders Good For, Anyway?](https://ericniebler.com/2024/02/04/what-are-senders-good-for-anyway/) (Blog): Demonstrates the value of a standard async programming model by wrapping a C-style async API in a sender
253+
- [From Zero to Sender/Receiver in ~60 Minutes](https://www.youtube.com/watch?v=xiaqNvqRB2E) (Video): Live-coding a toy sender/receiver implementation from scratch
254+
- [A Unifying Abstraction for Async in C++](https://www.youtube.com/watch?v=h-ExnuD6jms) (Video): A simple introduction to the concepts behind P2300
255+
- [A Universal Async Abstraction for C++](https://cor3ntin.github.io/posts/executors/) (Blog): An introduction to Senders
256+
- [A Universal I/O Abstraction for C++](https://cor3ntin.github.io/posts/iouring/) (Blog): A look at how the Senders concepts interact with `io_uring` on Linux
257+
- [Structured Concurrency](https://www.youtube.com/watch?v=1Wy5sq3s2rg) (Video): An explanation of structured concurrency in C++ and its benefits
258+
- [Executors: a Change of Perspective](https://accu.org/journals/overload/29/165/teodorescu/) (Article): An article about the computational completeness of Senders
259+
- [Structured Concurrency in C++](https://accu.org/journals/overload/30/168/teodorescu/) (Article): An article about how Senders manifest the principles of structured concurrency
260+
- [Structured Networking in C++](https://www.youtube.com/watch?v=XaNajUp-sGY) (Video): A look at what a P2300-style networking library could look like
261+
- [HPCWire Article](https://www.hpcwire.com/2022/12/05/new-c-sender-library-enables-portable-asynchrony/): Provides a high-level overview of the Sender model and its benefits
262+
- [NVIDIA HPC SDK Documentation](https://docs.nvidia.com/hpc-sdk/index.html): Documentation for the NVIDIA HPC SDK
263+
- [P2300 - `std::execution`](https://wg21.link/p2300): Senders proposal to C++ Standard
264+
226265
### Tooling
227266

228267
For users of **VSCode**, stdexec provides a

0 commit comments

Comments
 (0)