tmp/tmp0tpblznt/{from.md → to.md}
RENAMED
|
@@ -0,0 +1,103 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
## Parallel scheduler <a id="exec.par.scheduler">[[exec.par.scheduler]]</a>
|
| 2 |
+
|
| 3 |
+
``` cpp
|
| 4 |
+
namespace std::execution {
|
| 5 |
+
class parallel_scheduler {
|
| 6 |
+
unspecified
|
| 7 |
+
};
|
| 8 |
+
}
|
| 9 |
+
```
|
| 10 |
+
|
| 11 |
+
`parallel_scheduler` models `scheduler`.
|
| 12 |
+
|
| 13 |
+
Let `sch` be an object of type `parallel_scheduler`, and let
|
| 14 |
+
`BACKEND-OF(sch)` be `*ptr`, where `sch` is associated with `ptr`.
|
| 15 |
+
|
| 16 |
+
The expression `get_forward_progress_guarantee(sch)` has the value
|
| 17 |
+
`forward_progress_guarantee::{}parallel`.
|
| 18 |
+
|
| 19 |
+
Let `sch2` be an object of type `parallel_scheduler`. Two objects `sch`
|
| 20 |
+
and `sch2` compare equal if and only if `BACKEND-OF(sch)` and
|
| 21 |
+
`BACKEND-OF(sch2)` refer to the same object.
|
| 22 |
+
|
| 23 |
+
Let `rcvr` be a receiver. A *proxy for `rcvr` with base `B`* is an
|
| 24 |
+
lvalue `r` of type `B` such that:
|
| 25 |
+
|
| 26 |
+
- `r.set_value()` has effects equivalent to
|
| 27 |
+
`set_value(std::move(rcvr))`.
|
| 28 |
+
- `r.set_error(e)`, where `e` is an `exception_ptr` object, has effects
|
| 29 |
+
equivalent to `set_error(std::move({}rcvr), std::move(e))`.
|
| 30 |
+
- `r.set_stopped()` has effects equivalent to
|
| 31 |
+
`set_stopped(std::move(rcvr))`.
|
| 32 |
+
|
| 33 |
+
A *preallocated backend storage for a proxy* `r` is an object `s` of
|
| 34 |
+
type `span<byte>` such that the range `s` remains valid and may be
|
| 35 |
+
overwritten until one of `set_value`, `set_error`, or `set_stopped` is
|
| 36 |
+
called on `r`.
|
| 37 |
+
|
| 38 |
+
[*Note 1*: The storage referenced by `s` can be used as temporary
|
| 39 |
+
storage for operations launched via calls to
|
| 40 |
+
`parallel_scheduler_backend`. — *end note*]
|
| 41 |
+
|
| 42 |
+
A *bulk chunked proxy for `rcvr` with callable `f` and arguments `args`*
|
| 43 |
+
is a proxy `r` for `rcvr` with base
|
| 44 |
+
`system_context_replaceability::bulk_item_receiver_proxy` such that
|
| 45 |
+
`r.execute(i, j)` for indices `i` and `j` has effects equivalent to
|
| 46 |
+
`f(i, j, args...)`.
|
| 47 |
+
|
| 48 |
+
A *bulk unchunked proxy for `rcvr` with callable `f` and arguments
|
| 49 |
+
`args`* is a proxy `r` for `rcvr` with base
|
| 50 |
+
`system_context_replaceability::bulk_item_receiver_proxy` such that
|
| 51 |
+
`r.execute(i, i + 1)` for index `i` has effects equivalent to
|
| 52 |
+
`f(i, args...)`.
|
| 53 |
+
|
| 54 |
+
Let `b` be `BACKEND-OF(sch)`, let `sndr` be the object returned by
|
| 55 |
+
`schedule(sch)`, and let `rcvr` be a receiver. If `rcvr` is connected to
|
| 56 |
+
`sndr` and the resulting operation state is started, then:
|
| 57 |
+
|
| 58 |
+
- If `sndr` completes successfully, then `b.schedule(r, s)` is called,
|
| 59 |
+
where
|
| 60 |
+
- `r` is a proxy for `rcvr` with base
|
| 61 |
+
`system_context_replaceability::receiver_proxy` and
|
| 62 |
+
- `s` is a preallocated backend storage for `r`.
|
| 63 |
+
- All other completion operations are forwarded unchanged.
|
| 64 |
+
|
| 65 |
+
`parallel_scheduler` provides a customized implementation of the
|
| 66 |
+
`bulk_chunked` algorithm [[exec.bulk]]. If a receiver `rcvr` is
|
| 67 |
+
connected to the sender returned by `bulk_chunked(sndr, pol, shape, f)`
|
| 68 |
+
and the resulting operation state is started, then:
|
| 69 |
+
|
| 70 |
+
- If `sndr` completes with values `vals`, let `args` be a pack of lvalue
|
| 71 |
+
subexpressions designating `vals`, then
|
| 72 |
+
`b.schedule_bulk_chunked(shape, r, s)` is called, where
|
| 73 |
+
- `r` is a bulk chunked proxy for `rcvr` with callable `f` and
|
| 74 |
+
arguments `args` and
|
| 75 |
+
- `s` is a preallocated backend storage for `r`.
|
| 76 |
+
- All other completion operations are forwarded unchanged.
|
| 77 |
+
|
| 78 |
+
[*Note 2*: Customizing the behavior of `bulk_chunked` affects the
|
| 79 |
+
default implementation of `bulk`. — *end note*]
|
| 80 |
+
|
| 81 |
+
`parallel_scheduler` provides a customized implementation of the
|
| 82 |
+
`bulk_unchunked` algorithm [[exec.bulk]]. If a receiver `rcvr` is
|
| 83 |
+
connected to the sender returned by
|
| 84 |
+
`bulk_unchunked(sndr, pol, shape, f)` and the resulting operation state
|
| 85 |
+
is started, then:
|
| 86 |
+
|
| 87 |
+
- If `sndr` completes with values `vals`, let `args` be a pack of lvalue
|
| 88 |
+
subexpressions designating `vals`, then
|
| 89 |
+
`b.schedule_bulk_unchunked(shape, r, s)` is called, where
|
| 90 |
+
- `r` is a bulk unchunked proxy for `rcvr` with callable `f` and
|
| 91 |
+
arguments `args` and
|
| 92 |
+
- `s` is a preallocated backend storage for `r`.
|
| 93 |
+
- All other completion operations are forwarded unchanged.
|
| 94 |
+
|
| 95 |
+
``` cpp
|
| 96 |
+
parallel_scheduler get_parallel_scheduler();
|
| 97 |
+
```
|
| 98 |
+
|
| 99 |
+
*Effects:* Let `eb` be the result of
|
| 100 |
+
`system_context_replaceability::query_parallel_scheduler_backend()`. If
|
| 101 |
+
`eb == nullptr` is `true`, calls `terminate` [[except.terminate]].
|
| 102 |
+
Otherwise, returns a `parallel_scheduler` object associated with `eb`.
|
| 103 |
+
|