@@ -225,10 +225,10 @@ metadata:
225
225
```
226
226
227
227
Next, deploy four example apps that demonstrate how ` ResourceClaim ` s,
228
- ` ResourceClaimTemplate ` s, and custom ` ClaimParameter ` objects can be used to
229
- request access to resources in various ways:
228
+ ` ResourceClaimTemplate ` s, and custom ` GpuConfig ` objects can be used to
229
+ select and configure resources in various ways:
230
230
``` bash
231
- kubectl apply --filename=demo/gpu-test{1,2,3,4}.yaml
231
+ kubectl apply --filename=demo/gpu-test{1,2,3,4,5 }.yaml
232
232
```
233
233
234
234
And verify that they are coming up successfully:
@@ -242,10 +242,11 @@ gpu-test2 pod0 0/2 Pending 0 2s
242
242
gpu-test3 pod0 0/1 ContainerCreating 0 2s
243
243
gpu-test3 pod1 0/1 ContainerCreating 0 2s
244
244
gpu-test4 pod0 0/1 Pending 0 2s
245
+ gpu-test5 pod0 0/4 Pending 0 2s
245
246
...
246
247
```
247
248
248
- Use your favorite editor to look through each of the ` gpu-test{1,2,3,4}.yaml `
249
+ Use your favorite editor to look through each of the ` gpu-test{1,2,3,4,5 }.yaml `
249
250
files and see what they are doing. The semantics of each match the figure
250
251
below:
251
252
@@ -254,12 +255,16 @@ below:
254
255
Then dump the logs of each app to verify that GPUs were allocated to them
255
256
according to these semantics:
256
257
``` bash
257
- for example in $( seq 1 4 ) ; do \
258
+ for example in $( seq 1 5 ) ; do \
258
259
echo " gpu-test${example} :"
259
260
for pod in $( kubectl get pod -n gpu-test${example} --output=jsonpath=' {.items[*].metadata.name}' ) ; do \
260
261
for ctr in $( kubectl get pod -n gpu-test${example} ${pod} -o jsonpath=' {.spec.containers[*].name}' ) ; do \
261
262
echo " ${pod} ${ctr} :"
262
- kubectl logs -n gpu-test${example} ${pod} -c ${ctr} | grep GPU_DEVICE
263
+ if [ " ${example} " -lt 3 ]; then
264
+ kubectl logs -n gpu-test${example} ${pod} -c ${ctr} | grep -E " GPU_DEVICE_[0-9]+="
265
+ else
266
+ kubectl logs -n gpu-test${example} ${pod} -c ${ctr} | grep -E " GPU_DEVICE_[0-9]+"
267
+ fi
263
268
done
264
269
done
265
270
echo " "
@@ -270,43 +275,67 @@ This should produce output similar to the following:
270
275
``` bash
271
276
gpu-test1:
272
277
pod0 ctr0:
273
- declare -x GPU_DEVICE_0=" gpu-e7b42cb1-4fd8-91b2-bc77-352a0c1f5747 "
278
+ declare -x GPU_DEVICE_0=" gpu-ee3e4b55-fcda-44b8-0605-64b7a9967744 "
274
279
pod1 ctr0:
275
- declare -x GPU_DEVICE_0=" gpu-f11773a1-5bfb-e48b-3d98-1beb5baaf08e "
280
+ declare -x GPU_DEVICE_0=" gpu-9ede7e32-5825-a11b-fa3d-bab6d47e0243 "
276
281
277
282
gpu-test2:
278
283
pod0 ctr0:
284
+ declare -x GPU_DEVICE_0=" gpu-e7b42cb1-4fd8-91b2-bc77-352a0c1f5747"
285
+ declare -x GPU_DEVICE_1=" gpu-f11773a1-5bfb-e48b-3d98-1beb5baaf08e"
286
+
287
+ gpu-test3:
288
+ pod0 ctr0:
279
289
declare -x GPU_DEVICE_0=" gpu-0159f35e-99ee-b2b5-74f1-9d18df3f22ac"
290
+ declare -x GPU_DEVICE_0_SHARING_STRATEGY=" TimeSlicing"
291
+ declare -x GPU_DEVICE_0_TIMESLICE_INTERVAL=" Default"
280
292
pod0 ctr1:
281
293
declare -x GPU_DEVICE_0=" gpu-0159f35e-99ee-b2b5-74f1-9d18df3f22ac"
294
+ declare -x GPU_DEVICE_0_SHARING_STRATEGY=" TimeSlicing"
295
+ declare -x GPU_DEVICE_0_TIMESLICE_INTERVAL=" Default"
282
296
283
- gpu-test3 :
297
+ gpu-test4 :
284
298
pod0 ctr0:
285
299
declare -x GPU_DEVICE_0=" gpu-657bd2e7-f5c2-a7f2-fbaa-0d1cdc32f81b"
300
+ declare -x GPU_DEVICE_0_SHARING_STRATEGY=" TimeSlicing"
301
+ declare -x GPU_DEVICE_0_TIMESLICE_INTERVAL=" Default"
286
302
pod1 ctr0:
287
303
declare -x GPU_DEVICE_0=" gpu-657bd2e7-f5c2-a7f2-fbaa-0d1cdc32f81b"
304
+ declare -x GPU_DEVICE_0_SHARING_STRATEGY=" TimeSlicing"
305
+ declare -x GPU_DEVICE_0_TIMESLICE_INTERVAL=" Default"
288
306
289
- gpu-test4 :
290
- pod0 ctr0:
307
+ gpu-test5 :
308
+ pod0 ts- ctr0:
291
309
declare -x GPU_DEVICE_0=" gpu-18db0e85-99e9-c746-8531-ffeb86328b39"
310
+ declare -x GPU_DEVICE_0_SHARING_STRATEGY=" TimeSlicing"
311
+ declare -x GPU_DEVICE_0_TIMESLICE_INTERVAL=" Long"
312
+ pod0 ts-ctr1:
313
+ declare -x GPU_DEVICE_0=" gpu-18db0e85-99e9-c746-8531-ffeb86328b39"
314
+ declare -x GPU_DEVICE_0_SHARING_STRATEGY=" TimeSlicing"
315
+ declare -x GPU_DEVICE_0_TIMESLICE_INTERVAL=" Long"
316
+ pod0 sp-ctr0:
317
+ declare -x GPU_DEVICE_1=" gpu-93d37703-997c-c46f-a531-755e3e0dc2ac"
318
+ declare -x GPU_DEVICE_1_PARTITION_COUNT=" 10"
319
+ declare -x GPU_DEVICE_1_SHARING_STRATEGY=" SpacePartitioning"
320
+ pod0 sp-ctr1:
292
321
declare -x GPU_DEVICE_1=" gpu-93d37703-997c-c46f-a531-755e3e0dc2ac"
293
- declare -x GPU_DEVICE_2= " gpu-ee3e4b55-fcda-44b8-0605-64b7a9967744 "
294
- declare -x GPU_DEVICE_3= " gpu-9ede7e32-5825-a11b-fa3d-bab6d47e0243 "
322
+ declare -x GPU_DEVICE_1_PARTITION_COUNT= " 10 "
323
+ declare -x GPU_DEVICE_1_SHARING_STRATEGY= " SpacePartitioning "
295
324
```
296
325
297
326
In this example resource driver, no "actual" GPUs are made available to any
298
327
containers. Instead, a set of environment variables are set in each container
299
328
to indicate which GPUs * would* have been injected into them by a real resource
300
- driver.
329
+ driver and how they * would * have been configured .
301
330
302
- You can use the UUIDs of the GPUs set in these environment variables to verify
303
- that they were handed out in a way consistent with the semantics shown in the
304
- figure above.
331
+ You can use the UUIDs of the GPUs as well as the GPU sharing settings set in
332
+ these environment variables to verify that they were handed out in a way
333
+ consistent with the semantics shown in the figure above.
305
334
306
335
Once you have verified everything is running correctly, delete all of the
307
336
example apps:
308
337
``` bash
309
- kubectl delete --wait=false --filename=demo/gpu-test{1,2,3,4}.yaml
338
+ kubectl delete --wait=false --filename=demo/gpu-test{1,2,3,4,5 }.yaml
310
339
```
311
340
312
341
And wait for them to terminate:
@@ -320,6 +349,7 @@ gpu-test2 pod0 2/2 Terminating 0 31m
320
349
gpu-test3 pod0 1/1 Terminating 0 31m
321
350
gpu-test3 pod1 1/1 Terminating 0 31m
322
351
gpu-test4 pod0 1/1 Terminating 0 31m
352
+ gpu-test5 pod0 4/4 Terminating 0 31m
323
353
...
324
354
```
325
355
0 commit comments