Skip to content

Commit

Permalink
Specify all capabilities in TestGPUCheckpointRestore.
Browse files Browse the repository at this point in the history
This test was broken by 5e6589e ("Update CUDA test compatibility to keep
up with added gVisor support.") which requires all
images/gpu/cuda-tests/run_sample.go users to specify "all" driver capabilities.

PiperOrigin-RevId: 713156072
  • Loading branch information
ayushr2 authored and gvisor-bot committed Jan 8, 2025
1 parent 8b7b69c commit 515d60f
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 11 deletions.
11 changes: 5 additions & 6 deletions pkg/test/dockerutil/gpu.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,12 @@ const (
)

const (
// AllGPUCapabilities is the environment variable that enables all NVIDIA
// AllGPUCapabilitiesEnv is the environment variable that enables all NVIDIA
// GPU capabilities within a container.
AllGPUCapabilities = "NVIDIA_DRIVER_CAPABILITIES=all"
AllGPUCapabilitiesEnv = "NVIDIA_DRIVER_CAPABILITIES=all"

// DefaultGPUCapabilities is the environment variable that enables default
// NVIDIA GPU capabilities within a container.
DefaultGPUCapabilities = "NVIDIA_DRIVER_CAPABILITIES=compute,utility"
// DefaultGPUCapabilities are the driver capabilities enabled by default.
DefaultGPUCapabilities = "compute,utility"
)

// GPURunOpts returns Docker run options with GPU support enabled.
Expand Down Expand Up @@ -79,7 +78,7 @@ func GPURunOpts(sniffGPUOpts SniffGPUOpts) (RunOpts, error) {
ReadOnly: true,
})
}
gpuEnv := []string{sniffGPUOpts.GPUCapabilities()}
gpuEnv := []string{"NVIDIA_DRIVER_CAPABILITIES=" + sniffGPUOpts.GPUCapabilities()}

if !*setCOSGPU {
return RunOpts{
Expand Down
4 changes: 2 additions & 2 deletions test/gpu/cuda_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,7 @@ func (*FullyCompatible) IsExpectedFailure(ctx context.Context, env *TestEnvironm
// getContainerOpts returns the container run options to run CUDA tests.
func getContainerOpts() (dockerutil.RunOpts, error) {
opts, err := dockerutil.GPURunOpts(dockerutil.SniffGPUOpts{
Capabilities: dockerutil.AllGPUCapabilities,
Capabilities: dockerutil.AllGPUCapabilitiesEnv,
})
if err != nil {
return dockerutil.RunOpts{}, fmt.Errorf("failed to get GPU run options: %w", err)
Expand Down Expand Up @@ -885,7 +885,7 @@ func TestCUDA(t *testing.T) {
t.Errorf(
" $ docker run --runtime=%s --gpus=all -e %s --rm %s /run_sample %s",
dockerutil.Runtime(),
dockerutil.AllGPUCapabilities,
dockerutil.AllGPUCapabilitiesEnv,
runOpts.Image,
failedTests[0],
)
Expand Down
4 changes: 2 additions & 2 deletions test/gpu/ffmpeg_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func TestFffmpegEncodeGPU(t *testing.T) {
container := dockerutil.MakeContainer(ctx, t)
defer container.CleanUp(ctx)
opts, err := dockerutil.GPURunOpts(dockerutil.SniffGPUOpts{
Capabilities: "NVIDIA_DRIVER_CAPABILITIES=video",
Capabilities: "video",
AllowIncompatibleIoctl: true, // TODO(gvisor.dev/issue/9452): Remove once supported in gVisor.
})
if err != nil {
Expand All @@ -60,7 +60,7 @@ func TestFffmpegDecodeGPU(t *testing.T) {
container := dockerutil.MakeContainer(ctx, t)
defer container.CleanUp(ctx)
opts, err := dockerutil.GPURunOpts(dockerutil.SniffGPUOpts{
Capabilities: "NVIDIA_DRIVER_CAPABILITIES=video",
Capabilities: "video",
AllowIncompatibleIoctl: true, // TODO(gvisor.dev/issue/9452): Remove once supported in gVisor.
})
if err != nil {
Expand Down
4 changes: 3 additions & 1 deletion test/gpu/sr_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@ func TestGPUCheckpointRestore(t *testing.T) {
c := dockerutil.MakeContainer(ctx, t)
defer c.CleanUp(ctx)

opts, err := dockerutil.GPURunOpts(dockerutil.SniffGPUOpts{})
opts, err := dockerutil.GPURunOpts(dockerutil.SniffGPUOpts{
Capabilities: "all",
})
if err != nil {
t.Fatalf("failed to get GPU run options: %v", err)
}
Expand Down

0 comments on commit 515d60f

Please sign in to comment.