mirror of
https://github.com/netbirdio/gvisor.git
synced 2026-05-22 17:12:49 -07:00
Add ffmpeg GPU test with h264_nvenc video codec (which uses NVENC).
This test does NOT work yet in gVisor. Updates #9452 PiperOrigin-RevId: 682127429
This commit is contained in:
committed by
gVisor bot
parent
cb418b7f09
commit
b89f53b2ce
@@ -304,7 +304,7 @@ cos-gpu-smoke-tests: gpu-smoke-images $(RUNTIME_BIN)
|
||||
# This is a superset of those needed for smoke tests.
|
||||
# It includes non-GPU images that are used as part of GPU tests,
|
||||
# e.g. busybox and python.
|
||||
gpu-images: gpu-smoke-images load-gpu_pytorch load-gpu_ollama load-gpu_ollama_client load-basic_busybox load-basic_python load-gpu_stable-diffusion-xl load-gpu_vllm load-gpu_nccl-tests
|
||||
gpu-images: gpu-smoke-images load-gpu_pytorch load-gpu_ollama load-gpu_ollama_client load-basic_busybox load-basic_alpine load-basic_python load-gpu_stable-diffusion-xl load-gpu_vllm load-gpu_nccl-tests load-benchmarks_ffmpeg
|
||||
.PHONY: gpu-images
|
||||
|
||||
gpu-all-tests: gpu-images gpu-smoke-tests $(RUNTIME_BIN)
|
||||
@@ -314,6 +314,7 @@ gpu-all-tests: gpu-images gpu-smoke-tests $(RUNTIME_BIN)
|
||||
@$(call sudo,test/gpu:imagegen_test,--runtime=$(RUNTIME) -test.v $(ARGS))
|
||||
@$(call sudo,test/gpu:sr_test,--runtime=$(RUNTIME) -test.v $(ARGS))
|
||||
@$(call sudo,test/gpu:nccl_test,--runtime=$(RUNTIME) -test.v $(ARGS))
|
||||
@$(call sudo,test/gpu:ffmpeg_test,--runtime=$(RUNTIME) -test.v $(ARGS))
|
||||
@$(call sudo,test/gpu:sniffer_test,--runtime=$(RUNTIME) -test.v $(ARGS))
|
||||
.PHONY: gpu-all-tests
|
||||
|
||||
@@ -324,6 +325,7 @@ cos-gpu-all-tests: gpu-images cos-gpu-smoke-tests $(RUNTIME_BIN)
|
||||
@$(call sudo,test/gpu:imagegen_test,--runtime=$(RUNTIME) -test.v --cos-gpu $(ARGS))
|
||||
@$(call sudo,test/gpu:sr_test,--runtime=$(RUNTIME) -test.v --cos-gpu $(ARGS))
|
||||
@$(call sudo,test/gpu:nccl_test,--runtime=$(RUNTIME) -test.v --cos-gpu $(ARGS))
|
||||
@$(call sudo,test/gpu:ffmpeg_test,--runtime=$(RUNTIME) -test.v --cos-gpu $(ARGS))
|
||||
@$(call sudo,test/gpu:sniffer_test,--runtime=$(RUNTIME) -test.v --cos-gpu $(ARGS))
|
||||
.PHONY: cos-gpu-all-tests
|
||||
|
||||
|
||||
@@ -89,6 +89,20 @@ go_test(
|
||||
],
|
||||
)
|
||||
|
||||
go_test(
|
||||
name = "ffmpeg_test",
|
||||
srcs = ["ffmpeg_test.go"],
|
||||
# runsc is needed to invalidate the bazel cache in case of any code changes.
|
||||
data = ["//runsc"],
|
||||
tags = [
|
||||
"manual",
|
||||
"noguitar",
|
||||
"notap",
|
||||
],
|
||||
visibility = ["//:sandbox"],
|
||||
deps = ["//pkg/test/dockerutil"],
|
||||
)
|
||||
|
||||
go_test(
|
||||
name = "imagegen_test",
|
||||
srcs = ["imagegen_test.go"],
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
// Copyright 2020 The gVisor Authors.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
package ffmpeg_test
|
||||
|
||||
import (
|
||||
"context"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"gvisor.dev/gvisor/pkg/test/dockerutil"
|
||||
)
|
||||
|
||||
// TestFffmpegGPU runs ffmpeg in a GPU container using NVENC.
|
||||
func TestFffmpegGPU(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
isGVisor, err := dockerutil.IsGVisorRuntime(ctx, t)
|
||||
if err != nil {
|
||||
t.Fatalf("Failed to determine if runtime is gVisor: %v", err)
|
||||
}
|
||||
if isGVisor {
|
||||
t.Skip("This test is currently broken in gVisor")
|
||||
}
|
||||
container := dockerutil.MakeContainer(ctx, t)
|
||||
defer container.CleanUp(ctx)
|
||||
opts, err := dockerutil.GPURunOpts(dockerutil.SniffGPUOpts{
|
||||
Capabilities: "NVIDIA_DRIVER_CAPABILITIES=video",
|
||||
AllowIncompatibleIoctl: true,
|
||||
})
|
||||
if err != nil {
|
||||
t.Fatalf("Failed to get GPU run options: %v", err)
|
||||
}
|
||||
opts.Image = "benchmarks/ffmpeg"
|
||||
cmd := strings.Split("ffmpeg -i video.mp4 -c:v h264_nvenc -preset fast output.mp4", " ")
|
||||
if output, err := container.Run(ctx, opts, cmd...); err != nil {
|
||||
t.Errorf("failed to run container: %v; output:\n%s", err, output)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user