Skip to content

Commit 92841d8

Browse files
GordonGordon
authored andcommitted
CP013: Make modifications based on feedback.
* Add minor corrections. * Add requirement for execution_resource iterators to be random access. * Add section to background discussing handle partial errors on topology discovery.
1 parent 0d49b0c commit 92841d8

File tree

1 file changed

+28
-9
lines changed

1 file changed

+28
-9
lines changed

affinity/cpp-20/d0796r3.md

Lines changed: 28 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,13 @@ From a historic perspective, programming models for traditional high-performance
165165
166166
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].
167167
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.
169175
170176
### Resource lifetime
171177
@@ -286,7 +292,7 @@ An `execution_resource` object can be queried for a pointer to it's parent `exec
286292

287293
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**.
288294

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*]
290296
291297
Below *(Listing 3)* is an example of iterating over every **execution resource** within the **system topology** and printing out their capabilities.
292298

@@ -343,7 +349,7 @@ auto &execResource = execContext.resource();
343349

344350
// systemResource[0] should be equal to execResource
345351

346-
for (const execution::execution_resource res : execResource()) {
352+
for (const execution::execution_resource &res : execResource) {
347353
std::cout << res.name() << "\n";
348354
}
349355
```
@@ -393,10 +399,11 @@ The `execution_resource` which underlies the current thread of execution can be
393399
class execution_resource {
394400
public:
395401

402+
using value_type = execution_resource;
396403
using pointer = execution_resource *;
397404
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;
400407
using reference = execution_resource &;
401408
using const_reference = const execution_resource &;
402409
using size_type = std::size_t;
@@ -413,7 +420,7 @@ The `execution_resource` which underlies the current thread of execution can be
413420
const_iterator begin() const noexcept;
414421
const_iterator end() const noexcept;
415422

416-
const_reference operator[](int child) const noexcept;
423+
const_reference operator[](std::size_t child) const noexcept;
417424

418425
const_pointer member_of() const noexcept;
419426

@@ -522,6 +529,18 @@ The `execution_resource` class provides an abstraction over a system's hardware,
522529

523530
> [*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*]
524531
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+
525544
### `execution_resource` constructors
526545

527546
execution_resource() = delete;
@@ -551,13 +570,13 @@ The `execution_resource` class provides an abstraction over a system's hardware,
551570

552571
const_iterator begin() const noexcept;
553572

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.
555574

556575
const_iterator end() const noexcept;
557576

558577
*Returns:* A const iterator to the end of the child `execution_resource`s.
559578

560-
const_reference operator[](int child) const noexcept;
579+
const_reference operator[](std::size_t child) const noexcept;
561580

562581
*Returns:* A const reference to the specified child `execution_resource`s.
563582

@@ -581,7 +600,7 @@ The `execution_resource` class provides an abstraction over a system's hardware,
581600

582601
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*.
583602

584-
### `execution_context` types
603+
### `execution_context` member types
585604

586605
using executor_type = see-below;
587606

0 commit comments

Comments
 (0)