Skip to content

Update GPU tests to work on ARM #11527

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
File renamed without changes.
7 changes: 7 additions & 0 deletions pkg/test/dockerutil/dockerutil.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import (
"os"
"os/exec"
"regexp"
rt "runtime"
"strconv"
"strings"
"testing"
Expand Down Expand Up @@ -242,6 +243,12 @@ func runtimeMap() (map[string]any, error) {
return rs, nil
}

// IsRunningOnARM returns true if the current runtime is running on an ARM
// machine.
func IsRunningOnARM() bool {
return strings.HasPrefix(rt.GOARCH, "arm")
}

// Save exports a container image to the given Writer.
//
// Note that the writer should be actively consuming the output, otherwise it
Expand Down
5 changes: 4 additions & 1 deletion test/gpu/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,10 @@ go_test(
"notap",
],
visibility = ["//:sandbox"],
deps = ["//test/gpu/stablediffusion"],
deps = [
"//pkg/test/dockerutil",
"//test/gpu/stablediffusion",
],
)

go_test(
Expand Down
5 changes: 5 additions & 0 deletions test/gpu/imagegen_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,16 @@ import (
"testing"
"time"

"gvisor.dev/gvisor/pkg/test/dockerutil"
"gvisor.dev/gvisor/test/gpu/stablediffusion"
)

// TestStableDiffusionXL generates an image with Stable Diffusion XL.
func TestStableDiffusionXL(t *testing.T) {
if dockerutil.IsRunningOnARM() {
fbIssue := "https://github.com/facebookresearch/xformers/issues/1071"
t.Skipf("%s does not run on ARM due to library issues: see: %q", t.Name(), fbIssue)
}
ctx := context.Background()
sdxl := stablediffusion.NewDockerXL(t)
generateCtx, generateCancel := context.WithTimeout(ctx, 15*time.Minute)
Expand Down
3 changes: 3 additions & 0 deletions test/gpu/pytorch_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ import (

// runPytorch runs the given script and command in a PyTorch container.
func runPytorch(ctx context.Context, t *testing.T, scriptPath string, args ...string) {
if dockerutil.IsRunningOnARM() {
t.Skipf("%s is not supported on ARM for now.", t.Name())
}
t.Helper()
c := dockerutil.MakeContainer(ctx, t)
opts, err := dockerutil.GPURunOpts(dockerutil.SniffGPUOpts{})
Expand Down
3 changes: 3 additions & 0 deletions test/gpu/smoke_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ import (
)

func TestGPUHello(t *testing.T) {
if dockerutil.IsRunningOnARM() {
t.Skipf("%s is not supported on ARM due to cross compile errors.", t.Name())
}
ctx := context.Background()
c := dockerutil.MakeContainer(ctx, t)
defer c.CleanUp(ctx)
Expand Down
3 changes: 3 additions & 0 deletions test/gpu/vllm/vllm_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ import (

// BenchmarkVLLM runs a vLLM workload.
func BenchmarkVLLM(b *testing.B) {
if dockerutil.IsRunningOnARM() {
b.Skipf("%s is not supported on ARM for now.", b.Name())
}
doVLLMTest(b)
}

Expand Down