From bc1c51356b5e94ef28e818acc65aef87833ef705 Mon Sep 17 00:00:00 2001 From: nullday Date: Wed, 2 Nov 2022 11:42:10 +0800 Subject: [PATCH] Bug/add support for wsl2 (#1134) * Skip gpu check when run environment in WSL2 Signed-off-by: nullday * Fix order of check Signed-off-by: nullday Signed-off-by: nullday --- pkg/envd/docker.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/pkg/envd/docker.go b/pkg/envd/docker.go index c621e51b3..95eceab07 100644 --- a/pkg/envd/docker.go +++ b/pkg/envd/docker.go @@ -581,7 +581,14 @@ func (e dockerEngine) GPUEnabled(ctx context.Context) (bool, error) { } logrus.WithField("info", info).Debug("docker info") nv := info.Runtimes["nvidia"] - return nv.Path != "", nil + if nv.Path != "" { + return true, nil + } else if strings.HasSuffix(info.KernelVersion, "WSL2") { + logrus.Warn("We couldn't detect if your runtime support GPU on WSL2, we will continue to run your environment.") + return true, nil + } else { + return false, nil + } } func (e dockerEngine) GetImage(ctx context.Context, image string) (dockertypes.ImageSummary, error) {