mirror of
https://github.com/NVIDIA/nvidia-container-toolkit
synced 2024-11-22 08:18:32 +00:00
Also trigger graphics modifier for display capability
Signed-off-by: Evan Lezar <elezar@nvidia.com>
This commit is contained in:
parent
cd7ee5a435
commit
73e65edaa9
@ -18,7 +18,6 @@ package modifier
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"strings"
|
|
||||||
|
|
||||||
"github.com/NVIDIA/nvidia-container-toolkit/internal/config"
|
"github.com/NVIDIA/nvidia-container-toolkit/internal/config"
|
||||||
"github.com/NVIDIA/nvidia-container-toolkit/internal/config/image"
|
"github.com/NVIDIA/nvidia-container-toolkit/internal/config/image"
|
||||||
@ -59,16 +58,8 @@ func requiresGraphicsModifier(cudaImage image.CUDA) (bool, string) {
|
|||||||
return false, "no devices requested"
|
return false, "no devices requested"
|
||||||
}
|
}
|
||||||
|
|
||||||
var hasGraphics bool
|
if !cudaImage.GetDriverCapabilities().Any(image.DriverCapabilityGraphics, image.DriverCapabilityDisplay) {
|
||||||
for _, c := range strings.Split(cudaImage["NVIDIA_DRIVER_CAPABILITIES"], ",") {
|
return false, "no required capabilities requested"
|
||||||
if c == "graphics" || c == "all" {
|
|
||||||
hasGraphics = true
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if !hasGraphics {
|
|
||||||
return false, fmt.Sprintf("Capability %q not selected", "graphics")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return true, ""
|
return true, ""
|
||||||
|
@ -69,6 +69,14 @@ func TestGraphicsModifier(t *testing.T) {
|
|||||||
},
|
},
|
||||||
expectedRequired: true,
|
expectedRequired: true,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
description: "devices with display capability creates modifier",
|
||||||
|
cudaImage: image.CUDA{
|
||||||
|
"NVIDIA_VISIBLE_DEVICES": "all",
|
||||||
|
"NVIDIA_DRIVER_CAPABILITIES": "display",
|
||||||
|
},
|
||||||
|
expectedRequired: true,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
description: "devices with display,graphics capability creates modifier",
|
description: "devices with display,graphics capability creates modifier",
|
||||||
cudaImage: image.CUDA{
|
cudaImage: image.CUDA{
|
||||||
|
Loading…
Reference in New Issue
Block a user