Skip to content

Commit 3df1493

Browse files
committed
Completed draft of Resources subsection
1 parent a9d24f0 commit 3df1493

File tree

1 file changed

+19
-19
lines changed

1 file changed

+19
-19
lines changed

doc/ch_conceptual_design/resources.rst

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,17 @@ As mentioned in :numref:`ch_conceptual_design/algorithms:Algorithms`, the typica
99

1010
where the types :cpp:`P1, Pn...` represent data products, and the types :cpp:`Rm...` represent resources.
1111

12-
Phlex calls *resources* the object that can be used by an algorithm to let the framework know that the algorithm requires access to a shared entity which is not semantically related to the data-product set hierarchy.
13-
Note that in the requirements that the word "resource" is sometimes used in a more general sense.
14-
In this section we are only referring to the specific kind of resource described above.
12+
.. note::
13+
Phlex calls *resources* the object that can be used by an algorithm to let the framework know that the algorithm requires access to a shared entity which is not semantically related to the data-product set hierarchy.
14+
Note that in the requirements that the word "resource" is sometimes used in a more general sense.
15+
In this section we are only referring to the specific kind of resource described above.
1516

1617
An example registration of an algorithm that requires both a data product and a resource is found in :numref:`ch_conceptual_design/hofs/observers:Observers`.
1718
The details of the registration code express to the framework which arguments correspond to data products and which correspond to resources :need:`DUNE 52`.
1819
They may be stateless objects (e.g. a resource that denotes that an algorithm requires the use of a specific thread-unsafe library) or stateful objects (e.g. a resource that denotes access to a GPU, when the platform on which the framework program is running contains several GPUs).
1920
Neither of these examples contain mutable state.
2021
Resources (unlike data products) may have mutable state accessible to the algorithm (e.g. a histogram instance that could be shared across multiple algorithms).
21-
For resources that are mutable, the framework ensures that two algorithms are not interacting with the resource at the same time.
22+
For resources that are thread-unsafe, the framework ensures that two algorithms are not interacting with the resource at the same time.
2223
The framework is responsible for efficiently scheduling algorithms based, in part, upon the availability of resources :need:`DUNE 50`.
2324

2425
Examples of resources include:
@@ -34,20 +35,25 @@ Whereas data products have provenance associated with them, resources do not.
3435
Limited Resources
3536
-----------------
3637

37-
.. todo::
38+
Some resources are used to indicate that an algorithm requires sole use of some program entity.
39+
One example of such an entity is a thread-unsafe library, where the framework must ensure that only one algorithm is interacting with that library at any time :need:`DUNE 45`, :need:`DUNE 145`.
40+
A second example of a limited resource is a fixed number of GPUs present on a particular platform, where Phlex must ensure that each algorithm requiring the use of a GPU has sole access to the GPU it is running on for the duration of the algorithm's execution.
41+
A third example of a limited resource could be an algorithm's declaration that it requires spawning some number of threads for it execution (rather than using the framework's task-based execution model).
42+
Such an algorithm could declare the need for the reservation of some number of threads by requiing that number of thread resources :need:`DUNE 152`.
43+
The framework would then ensure that only as many threads as the configuration has provided can be used by algoirthms at any one time.
44+
These resources are called *limited resources*, because the framework is responsible for limiting the access to the resource to one algorithm at a time.
3845

39-
Refer to :need:`DUNE 45`, :need:`DUNE 145`
4046

41-
Explain what a limited resource is and why it is useful.
47+
An algorithm to be used by Phlex indicates that it requires a limited resource by requiring an argument that denotes such a resource.
4248

4349
GPUs
4450
----
4551

46-
.. todo::
52+
In order to allow algorithms to make use of GPUs, and to allow the composition of workflows that involve both CPU-based and GPU-based algorithms, Phlex provides a mechanism for an algorithm that requires access to a GPU to declare that fact :need:`DUNE 54`.
53+
This is done by making the algorithm accept a resource that denotes the GPU.
54+
Phlex can support running on platforms that provide access to more than one GPU while ensuring that a given algorithm has sole access to the GPU it requires while it is executing.
55+
Phlex also provides, through the same mechanism, the ability for an algorithm to specify that it requires remote access to a GPU.
4756

48-
Refer to :need:`DUNE 54`
49-
50-
Say what access to the GPU resource provides (perhaps sole access to the GPU hardware for the time the resource is in scope).
5157

5258
Random Number Resource
5359
----------------------
@@ -63,15 +69,9 @@ Counter-based random number generators (CBRNGs) [Wiki-CBRNG]_ each contain one i
6369
User-defined Resources
6470
----------------------
6571

66-
.. todo::
67-
68-
Refer to :need:`DUNE 149`, :need:`DUNE 152`
69-
70-
.. code:: c++
72+
While Phlex will provide some commonly-used types to represent resources, it will also be possible for users to create new types to represent a new type of resouce, with no modifications to the Phlex framework code :need:`DUNE 149`.
73+
Such resource types have no dependency on Phlex, so that a user algorithm employing such a resource does not thereby incur any dependency on the framework.
7174

72-
PHLEX_REGISTER_RESOURCE(config)
73-
{
74-
}
7575

7676
.. only:: html
7777

0 commit comments

Comments
 (0)