Slashdot Mirror


Ask Slashdot: Can Linux Run a GPU-Computing Application Written For Windows?

dryriver writes: I have been told that Linux can run Windows software using Wine or perhaps a VM. What happens if that Windows software is a GPU-computing application -- accessing the GPU through HLSL/GLSL/CUDA/OpenCL or similar interfaces? Can Wine or other solutions run that software at a decent speed under Linux? Or is GPU-computing software written for the Windows platform unsuitable for use -- emulated or otherwise -- under Linux? This sounds like one of those cases where there's a theoretical answer and then your own real-world experiences. So leave your best answers in the comments. Can Linux run a GPU-computing application that's written for Windows?

63 of 117 comments (clear)

  1. Maybe by JustAnotherOldGuy · · Score: 2, Insightful

    Maybe.

    --
    Just cruising through this digital world at 33 1/3 rpm...
    1. Re: Maybe by YayaY · · Score: 1

      Just try it. How hard could it be?

      --
      Votator.com implements a fair voting scheme (free
    2. Re: Maybe by Narcocide · · Score: 2

      I tried it. It works (for some values of "works") but the question is wrong. I had Rage working in Wine on Linux *with* CUDA support using someone's special wine-cuda wrapper hack, and it worked amazingly well, for all of 2 weeks then never worked again. I won't bore you with the sad technical details but the take away is that the real question that should be asked here is "Can Linux run a GPU-Computing application written for Windows without Nvidia's permission?"

      References:
      the code
      back when it worked

  2. yes by qume · · Score: 5, Informative

    PCI express passthrough is the term to search for.

    A good writeup:

    https://www.reddit.com/r/pcmasterrace/comments/2z0evz/gpu_passthrough_or_how_to_play_any_game_at_near/

    1. Re:yes by Anonymous Coward · · Score: 1

      What are you talking about? The original post literally asked "Can Wine or other solutions run that software at a decent speed under Linux? Or is GPU-computing software written for the Windows platform unsuitable for use -- emulated or otherwise -- under Linux?"

      And the answer is KVM and Xen works far better than wine when GPU's are involved, and can achieve almost native result compare to Windows when you have a decent motherboard and CPU that supports full visualization features. A lot of people are playing windows games using KVM and they work just fine. Alternatively if you have access to the source code, you can also port the host part of the code to Linux. The OpenCL / CUDA device code and API calls are already cross platform compatible, and they both distribute runtime for Linux. For a commercial example, take a look at Amazon EC2, all of the GPUs are managed by hypervisor and all you got are VMs.

    2. Re:yes by jimtheowl · · Score: 1

      Yes it is. Read again.

    3. Re:yes by LinuxIsGarbage · · Score: 1

      What are you talking about? The original post literally asked "Can Wine or other solutions run that software at a decent speed under Linux? Or is GPU-computing software written for the Windows platform unsuitable for use -- emulated or otherwise -- under Linux?"

      If someone is trying to build up cheap compute boxes for an application already written, they may be looking to build it without having to buy a licence. Wine would satisfy this, a VM with Windows installed wouldn't.

    4. Re:yes by Trax3001BBS · · Score: 1

      PCI express passthrough is the term to search for.

      A good writeup:

      https://www.reddit.com/r/pcmasterrace/comments/2z0evz/gpu_passthrough_or_how_to_play_any_game_at_near/

      Sure answered my question, I have two different Nvidia cards (GTX-570/760) did wonder if they would work together under VT-D (Linux Mint-Cinn), looks like they will. Now it's just a matter of DirectX.

  3. It worked for F@H by Ken_g6 · · Score: 5, Informative

    It used to be there was no Linux Folding@Home application. But there was a way to run the Windows CUDA application on Linux, and I did for a couple of years.

    Here's a guide for that: http://www.overclockers.com/de...

    --
    (T>t && O(n)--) == sqrt(666)
  4. But how fast? by whoever57 · · Score: 4, Interesting

    Even if it runs under something like WINE, how fast does it run?

    I would assume that if you need something that uses CUDA, performance is important.

    --
    The real "Libtards" are the Libertarians!
    1. Re:But how fast? by SirSlud · · Score: 1

      WINE is the software. This is asking if you can hit the hardware for a task where the hardware is where your real work is happening.

      --
      "Old man yells at systemd"
  5. Blender? by TheOuterLinux · · Score: 1

    Lots of Linux and crossplatform applications have been using GPU regardless of the OS for a while now. Blender is a good example. Sometimes all it takes is the right drivers. Please tell me you're not trying to run Maya or something like that when you got Blender? :(

    1. Re: Blender? by Anonymous Coward · · Score: 1

      I don't know Maya, but I know enough about Blender to know that's not a skill I'll ever have.

      Type the word "obtuse" on a Dvorak keyboard with all the key caps ripped off, and you'll have a word that begins to describe that interface.

    2. Re:Blender? by spitzak · · Score: 1

      You can get Maya for Linux

    3. Re:Blender? by scdeimos · · Score: 1

      There are reasons to run Blender in a Windows guest instead of Blender in the Linux/MacOS host, not the least of which is add-ons. A number of Blender add-ons only run on Windows, e.g.: Bos FBX Importer/Exporter requires 64-bit Windows due to the Autodesk FBX library dependency.

    4. Re: Blender? by Anonymous Coward · · Score: 1

      Rxygo.

    5. Re:Blender? by tigersha · · Score: 1

      Please tell me you're not trying to run Blender when you got Maya? :(

      Blender vs Maya = Etch-a-Sketch vs Picasso

      --
      The dangers of excessive individualism are nothing compared to the oppressiveness of excessive collectivism
    6. Re:Blender? by TheOuterLinux · · Score: 1

      I don't really know what bos FBX is, but Mac and Linux have had FBX import/export for years now.

    7. Re:Blender? by TheOuterLinux · · Score: 1

      But why would you? Blender has been available for Linux since day one (1998) and runs on Python, so anything you do on Linux can be picked back up on someone else's computer regardless of what OS they're running. I doubt the Linux version of Maya (ten years younger) has the same features or fewer bugs than Blender. They haven't made a 32-bit version since 2008. Meanwhile, Blender for Linux still has 32-bit builds. It's also free and open source. Cycles rendering is amazing too and whatever the 64-bit version gets, the 32-bit version does as well, within reason; gpu works better in real time on 64-bit systems, but that's really it. An older system could do the same renders, but it would just take longer. There is just no reason to pay for something that you can get for free and you get to see what makes it tick. Blender > Autodesk Maya; GIMP > Photoshop; Inkscape > Adobe Illustrator (same shortcuts too); Krita > Autodesk SketchBook; DigiKam > Adobe Lightroom; so on and so forth, all still with 32-bit builds still available and regularly updated. The point is that there are options available in the open source world you won't find anywhere else.

    8. Re:Blender? by spitzak · · Score: 1

      I was just trying to say that if you want to run Maya you don't need Windows emulation.

    9. Re:Blender? by TheOuterLinux · · Score: 1

      I didn't mean to make it sound like I was arguing, but I just wanted to cover my bases just in case someone else tried to start something. Also, I need to add for anyone reading this that Blender also has a built-in game engine.

  6. Who cares by Billly+Gates · · Score: 3, Insightful

    Run Windows. I never have used wine. Linus himself said if you need to run win32 then run host OS. Linus used XP for PowerPoint.

    How would you feel if I asked you if I could run Ubuntu on Windows 10? I could but why? It's a geek toy. At work your job is to put ideology aside and to make your bosses happy by keeping it up.

    Will running Windows Server really be that horrible for 1 server?

    But if I did have to run Linux I could try KMS with GPU pass thru but you risk downsides on now 2 platforms and bugs for now KMs, Linux, and windows and a performance hit. That won't guarantee higher uptime.

    1. Re:Who cares by g01d4 · · Score: 1

      if I could run Ubuntu on Windows 10

      Maybe it's more like porting Linux apps to Windows using Cygwin. I have both Linux and Cygwin. Cygwin is for applications that are both portable and have need to access files also regularly accessed on the Windows side. Bothering with two operating systems (virtual or real) or cross OS file shares might be more effort than necessary. I rarely boot Linux and don't need to bother setting up file sharing. YMMV.

    2. Re:Who cares by spikenerd · · Score: 1

      At work your job is to put ideology aside and to make your bosses happy

      Bosses often don't know tech. Programmers often don't know business. Programmers who just wait for their bosses to tell them how and what to do are crappy employees who make the company lopsided toward the business side. The best employees push for their ideals, but also know when to back down.

    3. Re:Who cares by Anonymous Coward · · Score: 1

      I do.

      If I could run the CAD software I use for work on linux I would literally jump for joy.

    4. Re:Who cares by tobiasly · · Score: 1

      How would you feel if I asked you if I could run Ubuntu on Windows 10? I could but why?

      Uuuh, you do realize that Microsoft enables Ubuntu to be run in-process in Windows 10? It's called "Windows Subsystem for Linux."

      https://msdn.microsoft.com/en-...

      As to "why", it's because lots of open-source tools are designed to only run on Linux, and Microsoft wanted to make those tools available to Windows users too.

    5. Re:Who cares by h33t+l4x0r · · Score: 1

      I think he's talking about the new bash subsystem for windows 10. Is it nice for developers to be able to run Apache and Mysql properly? Sure. Is it better than Wamp and those horrible windows Mysql installers? Probably.

    6. Re:Who cares by Gravis+Zero · · Score: 1, Funny

      Will running Windows Server really be that horrible for 1 server?

      Yeah, this is clearly coming from someone that has never used it. ;)

      --
      Anons need not reply. Questions end with a question mark.
    7. Re:Who cares by dbIII · · Score: 1

      There is professional software (CAD applications) released with WINE compatibility.

      There's also professional scientific software written in dotnet that is tested against mono so that it can be run on linux. That turns a single licence from a hotseat in front of a MS Windows workstation to something you can run on a noisy and fast server then let the user get to it from their desktop machine via X Windows. No need for a dusty computer in the corner used for an hour a week but a different person each time.

    8. Re:Who cares by tigersha · · Score: 1

      "we can convince more companies to provide"

      "We" in this case happens to be 1% of the PC market. Good luck with that convincing part.

      --
      The dangers of excessive individualism are nothing compared to the oppressiveness of excessive collectivism
    9. Re:Who cares by JustNiz · · Score: 1

      > We" in this case happens to be 1% of the PC market.

      Servers are PCs too. The vast majority of the internet is hosted on Linux. Compared to linux, Windows is hardly used at all in the server world.

    10. Re:Who cares by Billly+Gates · · Score: 1

      Will running Windows Server really be that horrible for 1 server?

      Yes.

      Christ, why does this need to be explained to a person on Slashdot? By avoiding Windows, you're avoiding licensing costs, reducing your attack surface, and removing an element that might otherwise disrupt homogeny in the infrastructure.

      Finding solutions that help avoid Windows is something of a badge of pride amongst the Slashdot crowd. Back in the day - like, 10 years ago, people would tinker and do that kind of thing just for the sake of doing it!

      Or, at least, they used to. What's changed? Did you look at Windows 10 and say "oh, everything about this is good, let's just stop resisting Microsoft now"? Did you wake up one morning and say "oh, I'm old now, time to stop tinkering and just be a goddamn curmudgeon to anyone who attempts something extraordinary"?

      I saw this discussion and I looked forward to reading ideas and solutions about what's out there and what's possible, instead of being a hardass son of a bitch and saying "you're wasting your time".

      What changed for me was Gnome 3 and WIndows 7. Next System D. It seems MS is going the way Linux should have been and Linux is getting worse each release. Back in 2009 was the highlight of Linux with Gnome 2 and Init. It just is not as good while aero came out for Windows and now Ubuntu.

      I am not a MS fanboy. More like I gave up on FOSS ever competing outside of a few geeks. At the end of the day it makes no sense to run a win32 program on something not designed for Windows because back in 1998 oh boy Linux sure was bettter??! Times change I am dissapointed.

  7. Depends if it is CPU or GPU bound... by Anonymous Coward · · Score: 1

    If it is GPU bound, then wine is perfectly fast enough for acting as a 'windows i/o emulation layer' to pump the data to the cards (barring any serious regressions, wine is at worse usually 2-3x as slow as windows, due to the extra API overhead. But in some cases is faster due to filesystem, memory or i/o subsystem, etc.) In that case, so long as the wine API can pass through all the GPU programs needed and pull the results back to the windows apps, it should work exactly the same as on Windows, but with the benefit of a few hundred to few thousand dollars worth of licensing that can be put towards GPUs instead (assuming of course the apps in question are not proprietary or have DRM which restricts them to running on authentic windows systems only. In that case, you might instead consider a VM+IOMMU platform using either xen or qemu/kvm with PCIe passthrough to run a real copy of windows and your GPU app, subject to licensing restrictions.)

    1. Re: Depends if it is CPU or GPU bound... by PRMan · · Score: 1

      Wine Is Not an Emulator.

      --
      Peter predicted that you would "deliberately forget" creation 2000 years ago...
    2. Re: Depends if it is CPU or GPU bound... by Highdude702 · · Score: 1

      W-I-N-E

    3. Re:Depends if it is CPU or GPU bound... by electrofelix · · Score: 1

      There's really only a few places where there is real extra API overhead, because mostly, on Windows the API you are calling will eventually result in a series of system calls being made to various parts of the Windows kernel to get stuff done, and on Linux the WINE API will result in just a different series of system calls being made to various parts of the Linux kernel. In most cases the amount of work to be done is the same, it's just that one takes place on Windows and the other Linux.

      The performance problems usually come down to places were there is no underlying Linux equivalent of something that is done in the Windows kernel via a single (or few) system calls, resulting in many more operations needing to be performed on Linux to produce the desired result.

      DirectX usage would be a good example of where there would be some API overhead in translating the original DirectX calls into corresponding OpenGL calls, however unless a data transformation has to be done, the overhead is relatively small. That's not saying it can't happen, but usually it's around specific sets of calls that need some data transformation before being passed on that performance is going to be terrible rather than any of them.

      For GPU based computing, WINE can use nVidia's cuda libraries for Linux to handle all the require processing, it even works with Nvidia Physx engine. Note however I'm using WINE with the staging patches applied and locally compiled to pick up the necessary cuda libraries to turn on support (even runs the FluidMark benchmark with decent numbers on my old GTX 570). For those using a distro provided WINE you will be dependent on whether your distro has build WINE (might require the staging patches applied as well) in a way that allows it to use the cuda libraries when installed.

  8. I wouldn't by Sycraft-fu · · Score: 2

    Just like I wouldn't go the other way and do a Linux computation program on Windows. Thing is if you are talking about something that needs the GPU for acceleration, you are talking about something doing some heavy hitting math. The reason you bother with a GPU is because whatever you are doing is too slow just running on a CPU. Otherwise why bother? It is more work and restricts systems that can run it.

    Well any emulation/virtualization/whatever will slow things down. How much varies, but even in the best case scenario, there's a performance penalty. Why pay that? Just run it in the OS it wants to run in on the iron. That'll get you the best performance.

    Not only that but generally speaking technical and engineering software is not the best written, most stable stuff in the world. You are likely to find it quirky even when you run it in the environment it wants. Introducing more variables is just going to make problems more likely and your life more difficult.

  9. Depends by dimko · · Score: 2

    Best thing is to simply try it. Doom 3 works with Vulkan. You may also see into commercial products based on Wine. Such exist. I heard a few apps work with OpenCL. Best thing would be to try. I assume it's not server cluster we are talking about.

  10. can you? yes. by turkeydance · · Score: 1

    should you?

  11. Windows on a chip by AHuxley · · Score: 1

    Just build a new Z-80 SoftCard https://en.wikipedia.org/wiki/...

    --
    Domestic spying is now "Benign Information Gathering"
    1. Re:Windows on a chip by omnichad · · Score: 1

      I can see why they might have renamed that.

  12. Can you jump a sinking ship if you had to? by Neuronwelder · · Score: 1

    Is Windows better than Linux. I personally don't care and don't harbour a grudge if you use either. Windows offers easy installs and has a wider ( ? ) choice. Windows users just want their application or program to work on their computer instantly.. Linux (outside of Web searches, LibreOffice, and Emails, requires work and sometimes sweat if you are trying to make something work that doesn't. Why am I saying all this? (No! I don't want you to change your Operating System!) But.. If Windows decides to do something that makes you want to look elsewhere. Are you prepared to jump to a different ship if need be? Plus maybe to them, the threat of you jumping ship might keep them in line!

  13. If GPU-bound, CPU virtualization doesn't matter by raymorris · · Score: 1, Troll

    > Just run it in the OS it wants to run in on the iron.

    Sometimes that certainly makes sense. Sometimes that would be really inconvenient and provide no benefit at all.

    > Well any emulation/virtualization/whatever will slow things down. How much varies, but even in the best case scenario, there's a performance penalty.

    That's not true. There is no measurable performance penalty for any application that's waiting on hardware such as the GPU or waiting on an external resource, typically over the network. As a stupid simple example, consider curl. Downloading a 100MB file over a 10Mbps connection will take 100 seconds, whether you're running on bare metal or three levels of virtualization deep.

    If the CPU is sitting around waiting for the GPU to process the data, it doesn't matter if the CPU waits 10% "slower". A GPU-bound application will run just as fast whether the CPU is virtualized with PCI passthrough or not - it's not waiting on the CPU anyway.

    Performance is all about the bottleneck. If the application is slowed because it's waiting on the CPU, it doesn't matter how fast the disk is. If the application spends it's time waiting on the network, it doesn't matter how fast the CPU is, etc. The only component that matters for performance is the component that's at ~100% utilization. (Ignoring for a moment trading disk and RAM via caching and paging).

  14. Re: no by saloomy · · Score: 4, Insightful

    You can absolutely run it if a VM is an accepted solution. The things you have to do:
    1. Use a processor that supports virtualization
    2. Have a second GPU for the host (in a server, usually the Melanox GPU).
    3. Use a hypervisor that can pass through PCI ports and pass in the nVidia Cuda enabled GPU (like an nVidia Tesla M60 card)
    4. Run your application in the VM

    The real question is: why does the underlying system have to be Linux? Do you want to Hypervise it for HA? Without knowing the why's behind your request, it's hard to say whether you can or not. Is it absolutely possible? Yes. Is it the best approach? Maybe. Is it the most efficient approach for your high-spec'd application? Probably not.

  15. Depends on which library you use by chromaexcursion · · Score: 1

    There are cross platform libraries that work equally well on Linux and Windows.
    You need to plan for it in advance.

    1. Re:Depends on which library you use by scdeimos · · Score: 1

      There are cross platform libraries that work equally well on Linux and Windows.

      OpenCV isn't one of them and it's not even OpenCV's fault. Try opening a USB-based stereo camera with OpenCV under Linux and you get an error best summarised as "the USB bus doesn't have enough bandwidth to open the device." This is wrong because the same stereo camera devices work just fine with OpenCV under Windows and MacOS.

  16. and lets not forget by s.petry · · Score: 1

    Will running Windows Server really be that horrible for 1 server?

    It may, it really depends. If you are running a system that must be compliant (PCI, NISPOM/JFAN, FedRAMP, etc..) it absolutely may be horrible. You not only need that 1 Windows server, but all of the supporting infrastructure to make it compliant. That 1 server is now 2 or 3, and you need manpower and time to go with it.

    So if you can run Windows, I agree with GP. Where I work, the vendor would either port or we wouldn't run it.

    --

    -The wise argue that there are few absolutes, the fool argues that there are no probabilities.

    1. Re:and lets not forget by Billly+Gates · · Score: 1

      We have to used WIndows at my last job because of compliance. Only Windows has auditing and logging to support what you described. Group Policy can do desktop lockdowns and make things much easy to administer.

      Also the vendor wont support you and the app to the vendor is out of compliance if it does not run on Windows. It is irresponsible to use an OS that is unsupported or do a VM with bugs on 3 platforms (VM, Linux, and Windows) because on Slashdot someone says its sux.

      You must be lucky. Most companies if we tell them we wont use IE 6 they do not do business with us STILL. We had 3 IE 6 apps still being updated that require us to use Citrix VM's. If we didn't do this the clients would leave and cost us millions and VP his job.

      The VP would fire the IT guy in a heartbeat if he got in the way where I worked at as you are a cost center who does not add value. The app on the other hand makes money.

    2. Re:and lets not forget by s.petry · · Score: 1

      Linux has had auditing and compliance since RH3.0. Today it's called auditd, but started as LAUS. Your ignorance != honesty. I built the first networks outside of a military base certified for classified processing under NISPOM and JFAN/3 standards. At the time I built those networks, Windows could run stand alone only.

      WIndows required more infrastructure and hands on management than Linux even years later when Windows could finally be certified for Network operations in those environments.

      --

      -The wise argue that there are few absolutes, the fool argues that there are no probabilities.

  17. graphics card not accessible in Virtual Box by tohasu · · Score: 2

    My recent appempt to run the Windows software for High Fidelity in a Virtual Box on a linux machine with a good Nvidia card met with frustration when I chould not get the program to see the card from within the box.

    1. Re:graphics card not accessible in Virtual Box by scdeimos · · Score: 2

      Don't use VirtualBox.

      For starters it doesn't support GPU pass-through. If you try to use the VirtualBox Guest Additions video driver then you'll be limited to DirectX 9 and OpenGL 2.1 (but only if you enable OpenGL through registry settings).

      If you pay money for VMware Workstation for Linux/MacOS/Windows then you'll be upgraded to DirectX 10 and OpenGL 3.3 but, as far as I know, still no GPU pass-through support.

  18. seeing the video card from a virtual box by tohasu · · Score: 1

    My attempts to run the windows software for High Fidelity in a virtual box on a linux machine with a good Nvidia card were frustrated because the program could not use the video card.

  19. Re: no by ArchieBunker · · Score: 1

    I've been toying with the idea of moving my windows desktop to a VM inside a hypervisor. People have done passthrough on their gaming rigs but still take a 10-20% performance hit on the GPU.

    --
    Only the State obtains its revenue by coercion. - Murray Rothbard
  20. Re: no by saloomy · · Score: 2

    I don't think a good hypervisor gives you the same drawback. You should get near-real performance on pass through devices now.

  21. If you don't need double precision... by Roger+W+Moore · · Score: 4, Informative

    You are absolutely right that you can do this but you may need to patch the hypervisor if you use a standard, retail nVidia card. Nvidia's drivers for "gamer" GPUs check to see whether they are running in a virtual environment and then shutdown if they think they are. There is a patch for KVM which hides the virtual environment from the nVidia driver so that it will run.

    Alternatively if you need double precision or don't mind spending 5-10 times the cost of a gamer card you can purchase a Tesla GPU since the nVidia driver for these works fine in a VM without patching.

  22. Re: no by LostMyBeaver · · Score: 2

    The answer is yes and there's no need for a second GPU

    Install Windows in VirtualBox or VMware, Configure the virtual machine for 3D and let it rip.

    As for Wine, Wine is always win-some-lose-some. If the application will run under Wine, then it should have access to most of the Windows APIs of interest.

    Finally, for CUDA, you would either need a second card or you would need an NVidia Grid solution which installs NVidia on the hypervisor and then again on the VM. It's insanely expensive.

  23. Re: no by Anonymous Coward · · Score: 1

    If a VM is the accepted solution, the answer is still "No Linux cannot run a gpu computing application written for Windows."

    A VM running Windows running the gpu application is still Windows running the gpu application.

  24. Re: no by saloomy · · Score: 1

    That's what I meant, using the CUDA GPU for Open-CL or GPGPU type applications. In this case you need the second GPU so the system doesn't hold the GPU, freeing it up for the hypervisor.

  25. What about docker? by tatman · · Score: 1

    Could you build a docker container based on Windows and run it in linux?

    --
    I've always said English was my second language. Had Romeo and Juliet been written in C, I might have understood it.
    1. Re:What about docker? by Kryptonut · · Score: 1

      While it'd be cool if you could do that, I don't believe that it's possible in Docker.

      The docker host needs to run the same OS as what the container was created on.....e.g. only Linux containers run on Linux hosts (although I think MS may be working on changing that) and only Windows containers run on Windows hosts.

  26. Possibilities by visionbeyond · · Score: 1

    I'm not 100% sure, but I believe that it would run using docker. Docker I believe uses the same base engine that VirtualBox uses, although from my limited use of this great tool, it runs significantly faster with less drain on resources. I don't believe that it would have any problems with accessing the GPU - at least no more than any other virtualization system, so would be a viable option to consider.

  27. Re:If my past experiences are any indication. by JustNiz · · Score: 2

    Given nearly all the worlds fastest computers are Linux-based CUDA machines, you're full of it.

  28. Re:If my past experiences are any indication. by JustNiz · · Score: 1

    Grow some balls and post as yourself and I'll bother to answer why you're so wrong.