Skip to content
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

[Feature Request] Updates on getting OpenCL and CUDA GPU support? #3789

Closed
chenchen2015 opened this issue Jan 20, 2019 · 27 comments
Closed

[Feature Request] Updates on getting OpenCL and CUDA GPU support? #3789

chenchen2015 opened this issue Jan 20, 2019 · 27 comments

Comments

@chenchen2015
Copy link

Gratings WSL team,

I just want to again bring up the good old "OpenCL and CUDA GPU support" topic that has been discussed many times.

Numerous previous discussions (e.g. #829 #1788 #327 ) have directed people like me to this highly voted feature request on User Voice forum. As a matter of fact, it is the HIGHEST voted feature request on the forum (which has more than 2 times the votes than the second requested feature, as of 1/20/2019). I saw a survey (#2422 ) done on August 2017, presumably to collect some early user preferences for initial project targeting. The last update on the User Voice forum was on April 2018 which was 10 months ago.

If possible, could you guys please let us know the status of this feature request and ideally, what's the estimated time frame of this project? Will we see an update in the next few months, or by the end of this year?

@lefnire
Copy link

lefnire commented Feb 28, 2019

Closed. Silence. Love it

@neil-119
Copy link

Guys, this is what our developers are mainly going to use WSL for (other than some types of IoT development). Would love to hear some update for this.

@chenchen2015
Copy link
Author

chenchen2015 commented Apr 16, 2019

Not trying to blame the team or anything, my guess is that this is one of those features that is too complicated for the team to address given the current support they are getting from MS and other factors internally and externally (third-party drivers, etc.).

Given the current feedback from everywhere, I would guess GPU support is not going to come in the near future. I have switched to dual boot native Ubuntu for that reason though it's not the ideal solution (definitely less convenient than WSL + GPU support). Happy to learn other solutions though. The last time I tried, Hyper-V does not seem to work with GPU. VirtualBox doesn't either.

@lefnire
Copy link

lefnire commented Apr 16, 2019

@chenchen2015 agreed. It's a shame VirtualBox / Docker can't (or too hard) to get GPU support either, dual-boot is only option at present

@therealkenc
Copy link
Collaborator

therealkenc commented Apr 17, 2019

my guess is that this is one of those features that is too complicated for the team to address

That doesn't appear to be the case. The devs have held two questionnaires on CUDA here and here. If this was in the "yeah, never going to happen because impossible" category (like say, probably, insmod native-linux-kernel-module) then one wouldn't go to the trouble to conduct a survey.

The entirely-not-silent response the question posed in this duplicate issue submission was:

We are quite aware of the demand of this feature and are working to see how best we can support it..... The challenge here is not just technical but also logistical and other. Because there are multiple players involved here, and not everything is in direct control. But, we are exploring all possibilities here.

Separately,

what's the estimated time frame of this project?

Imagine, just for a moment, if opening a duplicate issue on a github bug tracker was actually an effective way to get an answer to that. Say, more effective than adding a me2 or +1 to an existing issue (also ineffective).

If there was an estimated time frame for CUDA on WSL it goes without saying that the UserVoice status would have flipped from "on the backlog" to "working on it" and you'd have got an email notification answering the rhetorical. The as-of-this-instant answer being... no... there is no estimated time frame for this project. Which is a altogether different answer than there is no timeframe and never will be because impossible.

It's a shame VirtualBox / Docker can't (or too hard) to get GPU support either

Indeed. This is a good-as-any reason to hold out optimism. Unlike say the ever-popular nmap ask there isn't a good (or at least, particularly ideal) CUDA story on Windows for the out-of-box Linux-first tooling people are asking for.

@erogol
Copy link

erogol commented May 26, 2019

Here is how I got it working with a little bit of hacking http://www.erogol.com/using-windows-wsl-for-deep-learning-development/

Hope it helps!!

@chenchen2015
Copy link
Author

GPU support seems to be on WSL 2 feature backlog as well (with high priority) according to Microsoft Docs on WSL 2

Can I access the GPU in WSL 2? Are there plans to increase hardware support?

In initial releases of WSL 2 hardware access support will be limited, e.g: you will be unable to access the GPU, serial or USBs . However, adding better device support is high on our backlog, as this opens many more use cases for developers that wish to interact with these devices. In the meantime, you can always use WSL 1 which has serial port and USB access. Please stay tuned to this blog and WSL team members on Twitter to stay informed about the latest features coming to insider builds and reach out to give us feedback on what devices you’d like to interact with!

Thanks, WSL team! Looking forward to see how this goes...

@therealkenc
Copy link
Collaborator

WSL 1 which has serial port and USB access.

That line has been nagging me a mildly, because it conflates USB device support with RS232 devices support that happens to be implemented on a Universal Serial Bus. That confuses rather than informs the answer to the FAQ question "Can I access the GPU in WSL 2". There is no USB device access in WSL1, which is #2195 #3745 and a dozen dupes with informal landing zone #412.

[Funny thing, in the context of the question: you can do compute over a USB interface -- if we had USB support.]

Which is not a complaint that USB device support is missing in either WSL2 or WSL1 (I have no horse in that race). Just that the whole "in the meantime" clause above will lead to people to believe they need to be on WSL1 for USB device support; which does not exist.

@petesherick
Copy link

At this point, you are better off spinning up a nix VM in the cloud

@turowicz
Copy link

turowicz commented Mar 2, 2020

At this point, you are better off spinning up a nix VM in the cloud

But then you can't justify buying large GPUs for your engineers so they can play games in spare time.

@XenorPLxx
Copy link

This is one of the first Google results for "WSL Cuda". I guess it's worth mentioning that it's going to finally happen soon https://developer.nvidia.com/cuda/wsl.

@CrazedCoding
Copy link

@XenorPLxx Nice find.

Has anyone found any concrete examples or tutorials on WSL 2 and CUDA, yet??

@XenorPLxx
Copy link

XenorPLxx commented Jun 9, 2020

There's a little bit of info here and there, but the timeframe states 'in a few months', so I guess it's not coming to us that "soon".

@Erik-Sovereign
Copy link

It is stated here that a public preview will start in June https://news.developer.nvidia.com/microsoft-and-nvidia-announce-june-preview-for-gpu-acceleration-support-for-wsl/

(It seems you need to be in the Windows Insider Fast Ring and apply for the Nvidia Developer Program, both is free and easy to do)

@CrazedCoding
Copy link

CrazedCoding commented Jun 9, 2020

Thank you for the swift replies, and useful links @XenorPLxx and @Erik-Sovereign

I am perplexed. I am a member of both the Windows Insider Fast Ring, as well as the Nvidia Developer Program, but there still seems to be no support, or even documentation at this point...

I have been searching all day. I even attempted to see if it worked out-of-the-box as claimed, but WSL2 doesn't seem to come with Dxgkrnl, d3d12, or anything.

-----------EDIT-----------

After sifting through some seriously depressing comments about this project on Reddit (https://www.reddit.com/r/programming/comments/gmtg8q/directx_linux/), I found a link on SU post (https://superuser.com/questions/1504421/is-there-a-way-to-unite-wsl2-ubuntu-tensorflow-gpu-cuda-and-pycharmwindows/) with a link that might be helpful:

https://ubuntu.com/blog/ubuntu-20-04-lts-arrives

If I understand correctly, one must use the Ubuntu 20.04 on Windows from the Windows Store (in addition to having the Windows Insider Fast Ring / NVidia Developer Program access) to do this. I will attempt to do this now and report the results here.

-----------EDIT-----------
WSL2 Is AWESOME

The Reddit trolls were wrong. Lol. Attached is the picture proof. It works.

First get WSL2 set up for the latest version of Windows 10 with the Insider's program and such. There are plenty of Google results on this part.

After that it's a little less documented. It's essentially just like compiling and installing a linux kernal. The main trick is to obtain the latest release version of WSL2: WSL2-Linux-Kernel-4.19.121-microsoft-standard.tar.gz from here: https://github.com/microsoft/WSL2-Linux-Kernel/releases

Remember that Windows does not allow case-insensitive duplicates of files and folders. Therefore, make sure to move the tar.gz file to your WSL2 download is inside the WSL2 Unix file-system before trying to extract/compile the kernel.

To do this, use the cp command and the /mnt/c/Users/<Your Windows Username>/Downloads/WSL2-Linux-Kernel-4.19.121-microsoft-standard.tar.gz location of your WSL2 Unix Distro.

Use this command to set up a x-server display (once you have the latest WSL2 kernal installed): export DISPLAY=$(grep -m 1 nameserver /etc/resolv.conf | awk '{print $2}'):0.0

One final note: this was the last tutorial I was reading (before I figured out mesa-utils's glxgears was working [and started messing around with entire xubuntu desktops]): https://microhobby.com.br/blog/2019/09/21/compiling-your-own-linux-kernel-for-windows-wsl2/

It explains how to boot from your new WSL2/linux kernel image once it's compiled.

Happy coding fellas, thanks for your help!!!

@turowicz
Copy link

turowicz commented Jun 10, 2020

Guys remain calm, this is a bleeding edge preview kinder surprise 🥚 pre-alpha component in Windows and it will most likely come with tons of issues and lack documentation. Just give it some time it will most certainly be usable.

@CrazedCoding
Copy link

@turowicz Thank you ^^ Please see my updated post (which is too long to quote again).

#3789 (comment)

@benhillis
Copy link
Member

@CrazedCoding - We have not yet shipped the GPU support to Insiders.

@CrazedCoding
Copy link

@benhillis Ah sorry I totally missed the topic of this issue (OpenCL and CUDA). I was just happy that OpenGL worked at all (and pretty fast if you look at the measurements).

I'll try to test OpenCL and CUDA (when the time comes) and make another post here.

Thanks again.

@CrazedCoding
Copy link

@everyone

https://blogs.windows.com/windowsdeveloper/2020/06/17/gpu-accelerated-ml-training-inside-the-windows-subsystem-for-linux/

Looks like it might be part of a a recent patch: Windows 10 Insider Preview 20150.1000 (rs_prerelease)

@ablankenship10
Copy link

ablankenship10 commented Jul 14, 2020

Has anyone successfully gotten this to work? I am able to run a CUDA sample application, however having issue installing OpenCL afterwards (followed this: https://gist.github.com/Brainiarc7/dc80b023af5b4e0d02b33923de7ba1ed). clinfo shows Number of platforms: 0

Trying to get OpenCV for python3 working with GPU acceleration

EDIT: I've also confirmed that running through nvidia's setup (which successfully enabled CUDA for me) does not seem to be able to run OpenCL even with the docker containers (despite also successfully running CUDA docker examples). Attempting to run clinfo inside an nvidia docker container still shows 0 platforms available.

@ghost
Copy link

ghost commented Aug 6, 2020

I need OpenCL to run olcvanitygen!

@turowicz
Copy link

turowicz commented Aug 7, 2020

All frameworks and applications such as OpenCL and Triton need to adjust their code for WSL as the CUDA driver is not exposed in the same way as barebone driver. It is possible that in the next release of the driver Nvidia will modify it so it looks the same, but the current situation is different.

cc @deadeyegoodwin

@jeanmonet
Copy link

I couldn't find this information. Is there (or will there be) GPU/CUDA support in WSL 1?

@ghost
Copy link

ghost commented Apr 19, 2021

I couldn't find this information. Is there (or will there be) GPU/CUDA support in WSL 1?

Ohhhhh, hmmmmm, Maybe you just need WSL 2.

@jeanmonet
Copy link

Ohhhhh, hmmmmm, Maybe you just need WSL 2.

Went for WSL 2, works like a charm.

@nelsonjchen
Copy link

The CUDA GPU support is obviously out but if anybody is interested in OpenCL, it might be worth paying attention to this issue:

#6951

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests