@@ -147,19 +147,23 @@ in the UMF repository.
147
147
148
148
TODO
149
149
150
- CTL statistics example
150
+ CTL example
151
151
==============================================================================
152
152
153
- You can find the full example code in the `examples/ctl/ctl_statistics_example.c `_ file
154
- in the UMF repository.
153
+ .. note ::
154
+ The CTL API is experimental and may change in future releases.
155
+
156
+ You can find the full example code in the `examples/ctl/ctl.c `_ file in the
157
+ UMF repository.
155
158
156
159
The sample configures an OS memory provider and a disjoint pool, reuses the
157
160
provider's canonical ``OS `` selector obtained at runtime, assigns a custom pool
158
161
name, and then mixes ``by_handle `` and ``by_name `` selectors to explore CTL
159
162
statistics. Wildcard nodes are used to choose provider counters, build a
160
163
four-segment ``{}.{} `` chain for the named pool, reset the peak tracker, and
161
- drill into per-bucket disjoint pool telemetry. The program prints hints on ``stderr ``
162
- explaining which tracing level is necessary when a statistic is unavailable.
164
+ drill into per-bucket disjoint pool telemetry. The program prints hints on
165
+ ``stderr `` explaining which tracing level is necessary when a statistic is
166
+ unavailable.
163
167
164
168
Build and run the example with::
165
169
@@ -176,6 +180,26 @@ Tracing level ``1`` enables slab usage counters, level ``2`` adds allocation
176
180
and free statistics, and level ``3 `` additionally emits verbose log messages
177
181
from the pool implementation.
178
182
183
+ Custom CTL example
184
+ ==============================================================================
185
+
186
+ You can find the full example code in the `examples/ctl/custom_ctl.c `_ file in
187
+ the UMF repository. The program implements a minimal memory provider with CTL
188
+ hooks that accept configuration values, execute runnables, and expose provider
189
+ state through the experimental API. It highlights converting wildcard segments
190
+ to ``printf ``-style format strings and reading integers supplied via
191
+ configuration defaults.
192
+
193
+ Build and run the example with::
194
+
195
+ cmake -B build
196
+ cmake --build build
197
+ ./build/examples/umf_example_ctl
198
+
199
+ Optionally supply a modulus via configuration defaults::
200
+
201
+ UMF_CONF="umf.provider.default.ctl.m=10" ./build/examples/umf_example_ctl
202
+
179
203
IPC example with Level Zero Memory Provider
180
204
==============================================================================
181
205
The full code of the example is in the `examples/ipc_level_zero/ipc_level_zero.c `_ file in the UMF repository.
@@ -260,7 +284,8 @@ the :any:`umfCloseIPCHandle` function is called.
260
284
.. _examples/cuda_shared_memory/cuda_shared_memory.c : https://github.com/oneapi-src/unified-memory-framework/blob/main/examples/cuda_shared_memory/cuda_shared_memory.c
261
285
.. _examples/ipc_level_zero/ipc_level_zero.c : https://github.com/oneapi-src/unified-memory-framework/blob/main/examples/ipc_level_zero/ipc_level_zero.c
262
286
.. _examples/custom_file_provider/custom_file_provider.c : https://github.com/oneapi-src/unified-memory-framework/blob/main/examples/custom_file_provider/custom_file_provider.c
263
- .. _examples/ctl/ctl_statistics_example.c : https://github.com/oneapi-src/unified-memory-framework/blob/main/examples/ctl/ctl_statistics_example.c
287
+ .. _examples/ctl/ctl.c : https://github.com/oneapi-src/unified-memory-framework/blob/main/examples/ctl/ctl.c
288
+ .. _examples/ctl/custom_ctl.c : https://github.com/oneapi-src/unified-memory-framework/blob/main/examples/ctl/custom_ctl.c
264
289
.. _examples/memspace : https://github.com/oneapi-src/unified-memory-framework/blob/main/examples/memspace/
265
290
.. _README : https://github.com/oneapi-src/unified-memory-framework/blob/main/README.md#memory-pool-managers
266
291
.. _umf/ipc.h : https://github.com/oneapi-src/unified-memory-framework/blob/main/include/umf/ipc.h
0 commit comments