Return to Level1Techs.com

NVIDIA PRIME for "GPU switching"

Hey Level1Techs,

I’ve tried giving Linux a chance a few different times, and usually get frustrated and stop. I think of it as a ‘me problem’ and don’t really have anything against Linux, I just have my habits and it’s hard to change them.

For a while now, I’ve been trying to figure out a workable ‘dual boot’-like situation that didn’t require rebooting my computer. I know Virtualization is a good option and the overhead is generally quite low.

I know my laptop has Nvidia Optimus, it’s a MSI GS63VR with an i7-6700HQ and a GTX 1060 (6GB). I feel like, on paper, Optimus should be an excellent trick for avoiding the annoying Code 43 error Nvidia gives when it thinks you’re trying to virtualize a consumer-grade card.

It looks like, on both Arch and Debian, NVIDIA PRIME is able to assign the GPU of choice to any application you want it to as long as you choose the one you want at startup.

As a noob, I don’t have any preference towards Arch or Debian, but the description in Debian makes it sound like it might work a little better there?

Assuming Optimus works on my laptop (haven’t double-checked that, but I believe last time I investigated it had the green light), would I be able to virtualize Windows 10 and run apps or games I can’t get to work in Linux using my dGPU? (I use Premiere Pro for school and work, and that’s a major concern–not opposed to learning another suite but it’s just an issue of workflow and comfort that’s hard to get around.) I’m taking for granted this “should” have near-native performance.

If I’m (supposed to be) able to do all that, can you kind folks help me put together a list of guides/tutorials I should follow to get this kind of setup up and running?

How much of that should I be able to test/verify before needing to actually install Linux onto my system’s internal SSD?

Also, random question, but how easy is it to get something like Wallpaper Engine in Linux? To have a rendered and responsive/pseudo-interactive background on the desktop.

This is probably where you want to start:

2 Likes

Thanks for the link! Are you sure that’s what I should be working off of?

I don’t know much about any of this, but both the Arch and Debian wikis seem to suggest that bumblebee is a ‘second choice’ (or worse?) to Nvidia PRIME, if it works.

There are several methods available:

  • #Use Intel graphics only - saves power, because NVIDIA GPU will be completely powered off.
  • #Use NVIDIA graphics only - gives more performance than Intel graphics, but drains more battery (which is not welcome for mobile devices). This utilizes the same underlying process as the optimus-manager and nvidia-xrun options, it should be utilized for troubleshooting and verifying general functionality, before opting for one of the more automated approaches.
  • Using both (use NVIDIA GPU when needed and keep it powered off to save power):
  • #Using PRIME render offload - official method supported by NVIDIA.
  • #Using optimus-manager - switches graphics with a single command (logout and login required to take effect). It achieves maximum performance out of NVIDIA GPU and switches it off if not in use.
  • #Using nvidia-xrun - run separate X session on different TTY with NVIDIA graphics. It achieves maximum performance out of NVIDIA GPU and switches it off if not in use.
  • #Using Bumblebee - provides Windows-like functionality by allowing to run selected applications with NVIDIA graphics while using Intel graphics for everything else. Has significant performance issues.
  • #Using nouveau - offers poorer performance (compared to the proprietary NVIDIA driver) and may cause issues with sleep and hibernate. Does not work with latest NVIDIA GPUs.

Respectfully, you are trying to win a marathon, before you’ve even learned how to walk.

Find an old ThinkPad on ebay (I recently got a nice Ivy Bridge machine for $48) and throw Linux on it. Once you are comfortable using and managing Linux, then have a go at Dual booting and/or virtualization.

1 Like

If you want to run a windows VM that has the dGPU passed through to it.

This is about correct.

I would also second running Linux on a physically separate machine for a year or two before switching to it full time.

2 Likes

In the mean time, for an easier transition, start learning and using apps on your Windows machine which have Linux alternatives: Libre Office, GIMP, most browsers, etc.

1 Like

Code 43 and Optimus are 2 very different things.

Code 43 is an issue when you pass-through a GPU and the Windows-driver recognises it is running in a virtual machine.

Optimus is a technology that allows you to run 3D-accelerated (or technically any) processes on the dedicated GPU (instead of the integrated one) on the Linux side.

In other words: Optimus does not help you in any way with Code 43.

What you can (technically) do is use Optimus whereever it is possible and virtualise the GPU whenever it is needed. You will still have to deal with Code 43 (or whatever nvidia comes up with next) though because you are still virtualising.

Also since you are on a Laptop you might not even have the virtualisation extensions available. The CPU has them according to the Intel Ark, that does not mean it is available or useful though.

1 Like

I second that motion

don’t know what drives you towards linux, but I think changing OS won’t be as good as you may think

is there anything in linux you really want?

1 Like

In my experience, the less one knows about Windows, the easier the transition will be. Self described “Power Users” always seem to struggle, because they desperately want Linux to work just like Windows does … which it doesn’t … and it won’t … ever!

@dern0s > You are right, a seasoned Windows user will likely need a motivating feature, or two, in order to stick with Linux long enough to power through the learning curve.

With me, my first Linux project was to build a simple file and print server for my home network. Next, I built a router. I had so much fun tinkering and compiling kernels, that I decided to see if I could live with it on the desktop. I’ve never looked back!

1 Like

Okay, maybe I’ll need to look into this a little more. It sounds like my understanding was not correct.

I have run virtual machines in my laptop, for sure on Windows–don’t remember if I got that far in Linux. Can’t remember if I was able to pass USB devices through or if I tried that, but I definitely never fooled with passing something like a GPU or PCI device through.

@dern0s & @BarkingMad,
There’s no one particular thing driving me to Linux, but a lot of the “general” reasons people choose to switch do make sense to me.

  • Less Telemetry/“More Secure”
  • I like the idea of tinkering, on paper. I think frustration gets the better of me before I’m able to build a basic foundation of understanding and that leads me to give up.
  • For a while, I’ve been wanting to do some DIY projects like a router, file server, pi-hole, etc. I live by myself so most of what I need to do can be achieved on my main/only machine locally.
  • It also just feels like something I should be better at.

A part of me does “expect it to work like Windows,” and I know that’s wrong. What’s most annoying is when something that would be no-effort to do (or fix) in Windows ends up being difficult (for me) and getting in the way of doing things I’d like to get done.

I don’t even bother with trying to get application switching. I just use the prime-select thing when I want to switch GPU’s in my laptop and reboot the machine. With an SSD it’s not like it’s a long wait and saves me from the headaches and having to constantly worry about the battery draining way too quickly

Technically, if you use the on-demand mode, you can choose which GPU gets used by which program. The choosing involves prepending two environment variables to a command though ([env] blender for example). I usually just stick with the power saving mode because then I can use Wayland.

For every issue that is trivial to accomplish in Windows, but complicated in Linux, the reverse is true for some other issue; so in the long run it’s a wash. But, as a new adopter, it’s the former that, at the worse possible moment, will stop you in your tracks and frustrate you, if you are trying to be productive on your primary machine. This frequently leads to premature abandonment of Linux. This is why it’s always better to get your feet wet on a separate machine, especially when starting out. Because, if you’re not breaking things, you’re not learning anything and again, this is bad (breaking things) for your primary machine, if you need to be productive. In the first few months, you’ll likely be performing several re-installs of Linux, if for no other reason, than to experiment with different hard disk partitioning schemes.

BTW, and most importantly, Have Fun!