Announcing CUDA on Windows Subsystem for Linux 2

Originally published at: https://developer.nvidia.com/blog/announcing-cuda-on-windows-subsystem-for-linux-2/

Figure 1. Stack image showing layers involved while running Linux AI frameworks in WSL 2 containers. In response to popular demand, Microsoft announced a new feature of the Windows Subsystem for Linux 2 (WSL 2)—GPU acceleration—at the Build conference in May 2020. This feature opens the gate for many compute applications, professional tools, and workloads…

Great article! Since it was published in mid June maybe it can be updated to accurately reflect what has changed since then?

Would love to see information about redistribution. I was pointed towards WSL2 when asking why CUDA on mingw64 wasn’t supported while porting a GTK application to windows.

But I see no information about distributing a compiled binary with an installer to customers such that they can use my Cuda application without first doing a bunch of work to install WSL2/Linux containers.

Is this ready for customers who simply have windows 10/11 installed and buy my linux developed software? Is it point and click like the experience with MSVC compiled native EXEs with cuda?

I ask because the whole point of porting to windows for us is the easy install process and large existing install base. We already were dealing with a linux-only product that required customers to be linux-savy and if using WSL2 CUDA doesn’t alleviate that pain and customers still have to go toy with installing new subsystems/drivers/docker images I don’t think it’s going to work for us.

Please advise.

Installing WSL is not arduous. In Windows 11 it can be installed using the Windows Store, using the new WSL installation method. This is expected to be ported to Windows 10.

Docker is not required to run a deployed binary. It would be sufficient to simply have a WSL distribution installed. On a command line that can be as simple as wsl.exe --install to get Ubuntu up and running. That would be executed by an installation script, if you set one up.

The installation and use of WSL is by far the lowest bar I’ve seen for any Linux distribution in the last 20 years. The only issue that comes up is when the virtualization isn’t enabled on the CPU in bios, which is less and less a problem, as W11 requires that for many security features, and I believe is the default setting going forward.

If you would like to get some help, we maintain a support forum at www.reddit.com/r/bashonubuntuonwindows

Are there any plans to have the nvidia driver install do this step or at least prepare WSL2 for cuda use?

Is there a chance the WSL.exe --install step can fail or not meet system requirements?

How much disk space and network bandwidth will this install step take? How long should I tell the users to wait?

Honestly this feels like a really poor way to ship cuda windows software so I’m still going to pursue Mingw and just compile a small static-stub with Visual Studio since nvidia doesn’t feel the need to support Mingw(gcc) yet.

I’m also looking into rewriting my Cuda application to use the C-driver API which is lower level and can statically-link on windows into a nice and neat exe file.

I don’t so much need help as I believe the direction itself is wrong and not one I wish to follow. I already can tell my customers to install a windows VM and give a dedicated nvidia graphics card to the VM to use cuda accelerated code within the VM. No customer of mine will do that. Nor will they accept any “containers” or various permutations of the concept despite assurance it’s supported by Microsoft.

Step 1: Install Ubuntu on your windows machine with this command. (My customers are Manufacturing Plants and Universities that would immediately stop here)

If you want Cuda into manufacturing or university labs, I need a better way to get my GTK linux software running on windows without the fuss.

You support GCC on Arm with the Nanos, why can’t I use mingw(gcc) on X86-64 to do the same thing in Windows?

Well I’ve been over there on Reddit and basically finding what I thought originally here to be the case.

WSL is a piece of junk. It is NOT a valid replacement for the mingw toolchain. It’s difficult to develop in a VM, it requires trusting the end users machine can even run the “wsl --install” step which on my testing results in a VM that can’t even start, and when I switch to WSL version 1 it now has no $DISPLAY variable.

Mingw tool chain DOESNT REQUIRE VIRTUALIZATION. WSL with a gui apparently requires wslG which is not supported when virtualization is not enabled (such as in a vm).
Mingw tool chain produces a basic .exe binary that can just run. No network downloads of other linux distributions, permissions for network, issues with linux wsl having a different ip address than windows host, etc. Too many pitfalls.

I’m not accepting this Nvidia. You need to do better.

Hey coming back again to mention WSL2 does not support USB cameras which is kind of our applications main data collection method…

So anyone using CUDA with WSL2 cannot also use USB cameras. Bummer.