Skip to content

Commit b56d1ec

Browse files
committed
Add "fake-mode" option to GPU plugin for scalability testing
Devices can be faked for scalability testing when non-standard paths are used (container runtimes hard-code some checks for standard /dev & /sys paths which need to be avoided when faking devices). If one wants to run both normal GPU plugin and faked one in same cluster, all nodes providing fake "i915" resources should be labeled differently from ones with real GPU plugin + devices, so that real GPU workloads can be limited to correct nodes with a suitable nodeSelector. Signed-off-by: Eero Tamminen <[email protected]>
1 parent fe258df commit b56d1ec

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

cmd/gpu_plugin/gpu_plugin.go

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2017-2021 Intel Corporation. All Rights Reserved.
1+
// Copyright 2017-2022 Intel Corporation. All Rights Reserved.
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.
@@ -367,8 +367,10 @@ func (dp *devicePlugin) Allocate(request *pluginapi.AllocateRequest) (*pluginapi
367367
}
368368

369369
func main() {
370+
var prefix string
370371
var opts cliOptions
371372

373+
flag.StringVar(&fprefix, "fake-mode", "", "Prefix for devfs & sysfs paths")
372374
flag.BoolVar(&opts.enableMonitoring, "enable-monitoring", false, "whether to enable 'i915_monitoring' (= all GPUs) resource")
373375
flag.BoolVar(&opts.resourceManagement, "resource-manager", false, "fractional GPU resource management")
374376
flag.IntVar(&opts.sharedDevNum, "shared-dev-num", 1, "number of containers sharing the same GPU device")
@@ -393,7 +395,15 @@ func main() {
393395

394396
klog.V(1).Infof("GPU device plugin started with %s preferred allocation policy", opts.preferredAllocationPolicy)
395397

396-
plugin := newDevicePlugin(sysfsDrmDirectory, devfsDriDirectory, opts)
398+
var sysfs, devfs string
399+
if prefix != "" {
400+
sysfs = prefix + sysfsDrmDirectory
401+
devfs = prefix + devfsDriDirectory
402+
} else {
403+
sysfs = sysfsDrmDirectory
404+
devfs = devfsDriDirectory
405+
}
406+
plugin := newDevicePlugin(sysfs, devfs, opts)
397407
manager := dpapi.NewManager(namespace, plugin)
398408
manager.Run()
399409
}

0 commit comments

Comments
 (0)