Skip to content

Commit 0af9b62

Browse files
committed
change default value for gds, gdrcopy and mofed flags
With this change, we now always try to dynamically detect if the drivers are present or not. Current code takes care of failure cases to fail-safe and we are leveraging that for dynamic driver detection. Signed-off-by: Rahul Sharma <[email protected]>
1 parent 9fc04c5 commit 0af9b62

2 files changed

Lines changed: 13 additions & 9 deletions

File tree

cmd/nvidia-device-plugin/main.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,16 +103,19 @@ func main() {
103103
},
104104
&cli.BoolFlag{
105105
Name: "gdrcopy-enabled",
106+
Value: true,
106107
Usage: "ensure that containers that request NVIDIA GPU resources are started with GDRCopy support",
107108
EnvVars: []string{"GDRCOPY_ENABLED"},
108109
},
109110
&cli.BoolFlag{
110111
Name: "gds-enabled",
112+
Value: true,
111113
Usage: "ensure that containers that request NVIDIA GPU resources are started with GPUDirect Storage support",
112114
EnvVars: []string{"GDS_ENABLED"},
113115
},
114116
&cli.BoolFlag{
115117
Name: "mofed-enabled",
118+
Value: true,
116119
Usage: "ensure that containers that request NVIDIA GPU resources are started with MOFED support",
117120
EnvVars: []string{"MOFED_ENABLED"},
118121
},

internal/plugin/server.go

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -336,6 +336,16 @@ func (plugin *nvidiaDevicePlugin) getAllocateResponse(requestIds []string) (*plu
336336
plugin.updateResponseForMPS(response)
337337
}
338338

339+
if plugin.config.Flags.GDRCopyEnabled != nil && *plugin.config.Flags.GDRCopyEnabled {
340+
response.Envs["NVIDIA_GDRCOPY"] = "enabled"
341+
}
342+
if plugin.config.Flags.GDSEnabled != nil && *plugin.config.Flags.GDSEnabled {
343+
response.Envs["NVIDIA_GDS"] = "enabled"
344+
}
345+
if plugin.config.Flags.MOFEDEnabled != nil && *plugin.config.Flags.MOFEDEnabled {
346+
response.Envs["NVIDIA_MOFED"] = "enabled"
347+
}
348+
339349
// The following modifications are only made if at least one non-CDI device
340350
// list strategy is selected.
341351
if plugin.deviceListStrategies.AllCDIEnabled() {
@@ -352,15 +362,6 @@ func (plugin *nvidiaDevicePlugin) getAllocateResponse(requestIds []string) (*plu
352362
if plugin.config.Flags.Plugin.PassDeviceSpecs != nil && *plugin.config.Flags.Plugin.PassDeviceSpecs {
353363
response.Devices = append(response.Devices, plugin.apiDeviceSpecs(*plugin.config.Flags.NvidiaDevRoot, requestIds)...)
354364
}
355-
if plugin.config.Flags.GDRCopyEnabled != nil && *plugin.config.Flags.GDRCopyEnabled {
356-
response.Envs["NVIDIA_GDRCOPY"] = "enabled"
357-
}
358-
if plugin.config.Flags.GDSEnabled != nil && *plugin.config.Flags.GDSEnabled {
359-
response.Envs["NVIDIA_GDS"] = "enabled"
360-
}
361-
if plugin.config.Flags.MOFEDEnabled != nil && *plugin.config.Flags.MOFEDEnabled {
362-
response.Envs["NVIDIA_MOFED"] = "enabled"
363-
}
364365
return response, nil
365366
}
366367

0 commit comments

Comments
 (0)