@@ -9,9 +9,10 @@ import (
9
9
"path/filepath"
10
10
"strings"
11
11
12
- "github.com/NVIDIA/nvidia-container-toolkit/internal/config/image"
13
12
"github.com/opencontainers/runtime-spec/specs-go"
14
13
"golang.org/x/mod/semver"
14
+
15
+ "github.com/NVIDIA/nvidia-container-toolkit/internal/config/image"
15
16
)
16
17
17
18
const (
@@ -22,6 +23,7 @@ const (
22
23
envNVVisibleDevices = "NVIDIA_VISIBLE_DEVICES"
23
24
envNVMigConfigDevices = "NVIDIA_MIG_CONFIG_DEVICES"
24
25
envNVMigMonitorDevices = "NVIDIA_MIG_MONITOR_DEVICES"
26
+ envNVImexChannels = "NVIDIA_IMEX_CHANNELS"
25
27
envNVDriverCapabilities = "NVIDIA_DRIVER_CAPABILITIES"
26
28
)
27
29
@@ -37,6 +39,7 @@ type nvidiaConfig struct {
37
39
Devices string
38
40
MigConfigDevices string
39
41
MigMonitorDevices string
42
+ ImexChannels string
40
43
DriverCapabilities string
41
44
// Requirements defines the requirements DSL for the container to run.
42
45
// This is empty if no specific requirements are needed, or if requirements are
@@ -271,6 +274,13 @@ func getMigMonitorDevices(env map[string]string) *string {
271
274
return nil
272
275
}
273
276
277
+ func getImexChannels (env map [string ]string ) * string {
278
+ if chans , ok := env [envNVImexChannels ]; ok {
279
+ return & chans
280
+ }
281
+ return nil
282
+ }
283
+
274
284
func (c * HookConfig ) getDriverCapabilities (env map [string ]string , legacyImage bool ) image.DriverCapabilities {
275
285
// We use the default driver capabilities by default. This is filtered to only include the
276
286
// supported capabilities
@@ -324,6 +334,11 @@ func getNvidiaConfig(hookConfig *HookConfig, image image.CUDA, mounts []Mount, p
324
334
log .Panicln ("cannot set MIG_MONITOR_DEVICES in non privileged container" )
325
335
}
326
336
337
+ var imexChannels string
338
+ if c := getImexChannels (image ); c != nil {
339
+ imexChannels = * c
340
+ }
341
+
327
342
driverCapabilities := hookConfig .getDriverCapabilities (image , legacyImage ).String ()
328
343
329
344
requirements , err := image .GetRequirements ()
@@ -335,6 +350,7 @@ func getNvidiaConfig(hookConfig *HookConfig, image image.CUDA, mounts []Mount, p
335
350
Devices : devices ,
336
351
MigConfigDevices : migConfigDevices ,
337
352
MigMonitorDevices : migMonitorDevices ,
353
+ ImexChannels : imexChannels ,
338
354
DriverCapabilities : driverCapabilities ,
339
355
Requirements : requirements ,
340
356
}
0 commit comments