You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Add minor corrections.
* Add requirement for execution_resource iterators to be random access.
* Add section to background discussing handle partial errors on topology
discovery.
Copy file name to clipboardExpand all lines: affinity/cpp-20/d0796r3.md
+28-9Lines changed: 28 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -165,7 +165,13 @@ From a historic perspective, programming models for traditional high-performance
165
165
166
166
Some of these programming models also address *fault tolerance*. In particular, PVM has native support for this, providing a mechanism [[27]][pvm-callback] which can notify a program when a resource is added or removed from a system. MPI lacks a native *fault tolerance* mechanism, but there have been efforts to implement fault tolerance on top of MPI [[28]][mpi-post-failure-recovery] or by extensions[[29]][mpi-fault-tolerance].
167
167
168
-
Due to the complexity involved in standardizing *dynamic resource discovery* and *fault tolerance*, these are currently out of the scope of this paper. However, we leave open the possibility of accommodating both in the future, by not overconstraining *resources*' lifetimes (see next section).
168
+
Due to the complexity involved in standardizing *dynamic resource discovery* and *fault tolerance*, these are currently out of the scope of this paper. However, we leave open the possibility of accommodating both in the future, by not over constraining *resources*' lifetimes (see next section).
169
+
170
+
### Reporting errors in topology discovery
171
+
172
+
As querying the topology of a system can invoke a number of different system and third-party library, we have to consider what will happen when a call to one of these fails. Firstly we want to be able to report this failure so that it can be reported or handled in user code. Secondly as there will often be more than one source of topology discovery we have to avoid short-circuiting the discovery on an error and preventing potentially valid topology information being reported to users. For example if a system were to report both Hwloc and OpenCL execution resources and one of these failed we want the other to still be able to return it's resources.
173
+
174
+
A potential solution to this could be support partial errors in topology discovery, where querying the system for it's topology could be permitted to fail but still return a valid topology structure representing the topology that was discovered successfully. The way in which these errors are reported (i.e. exceptions or error values) would have to be decided, exceptions could be problematic as it could unwind the stack before capturing important topology information so perhaps an error value based approach would be preferable.
169
175
170
176
### Resource lifetime
171
177
@@ -286,7 +292,7 @@ An `execution_resource` object can be queried for a pointer to it's parent `exec
286
292
287
293
An `execution_resource` object can also be queried for the amount concurrency it can provide, the total number of **threads of execution** supported by the associated **execution resource**.
288
294
289
-
> [*Note:* An **execution resource** is not limited to resources which execute work, but also a general resource where no execution can take place but memory can be allocated such as off-chip memory. *--end note*]
295
+
> [*Note:* An **execution resource** is not limited to resources which execute work, but also a general resource where no execution can take place but memory can be allocated, such as off-chip memory. *--end note*]
290
296
291
297
Below *(Listing 3)* is an example of iterating over every **execution resource** within the **system topology** and printing out their capabilities.
292
298
@@ -343,7 +349,7 @@ auto &execResource = execContext.resource();
343
349
344
350
// systemResource[0] should be equal to execResource
345
351
346
-
for (const execution::execution_resource res : execResource()) {
352
+
for (const execution::execution_resource &res : execResource) {
347
353
std::cout << res.name() << "\n";
348
354
}
349
355
```
@@ -393,10 +399,11 @@ The `execution_resource` which underlies the current thread of execution can be
393
399
class execution_resource {
394
400
public:
395
401
402
+
using value_type = execution_resource;
396
403
using pointer = execution_resource *;
397
404
using const_pointer = const execution_resource *;
398
-
using iterator = execution_resource *;
399
-
using const_iterator = const execution_resource *;
405
+
using iterator = see-below;
406
+
using const_iterator = see-below;
400
407
using reference = execution_resource &;
401
408
using const_reference = const execution_resource &;
402
409
using size_type = std::size_t;
@@ -413,7 +420,7 @@ The `execution_resource` which underlies the current thread of execution can be
@@ -522,6 +529,18 @@ The `execution_resource` class provides an abstraction over a system's hardware,
522
529
523
530
> [*Note:* Creating an `execution_resource` may require initializing the underlying software abstraction when the `execution_resource` is constructed, in order to discover other `execution_resource`s accessible through it. However, an `execution_resource` is nonowning. *--end note*]
524
531
532
+
### `execution_resource` member types
533
+
534
+
iterator
535
+
536
+
*Requires:*`iterator` to model `RandomAccessIterator` with the value type `execution_resource::value_type`.
537
+
538
+
const_iterator
539
+
540
+
*Requires:*`const_iterator` to model `RandomAccessIterator` with the value type `execution_resource::value_type`.
541
+
542
+
iterator_traits<>iterator_category
543
+
525
544
### `execution_resource` constructors
526
545
527
546
execution_resource() = delete;
@@ -551,13 +570,13 @@ The `execution_resource` class provides an abstraction over a system's hardware,
551
570
552
571
const_iterator begin() const noexcept;
553
572
554
-
*Returns:* A const iterator to the beggining of the child `execution_resource`s.
573
+
*Returns:* A const iterator to the beginning of the child `execution_resource`s.
555
574
556
575
const_iterator end() const noexcept;
557
576
558
577
*Returns:* A const iterator to the end of the child `execution_resource`s.
*Returns:* A const reference to the specified child `execution_resource`s.
563
582
@@ -581,7 +600,7 @@ The `execution_resource` class provides an abstraction over a system's hardware,
581
600
582
601
The `execution_context` class provides an abstraction for managing a number of lightweight execution agents executing work on an `execution_resource` and any `execution_resource`s encapsulated by it. The `execution_resource` which an `execution_context` encapsulates is referred to as the *contained resource*.
0 commit comments