How to run JME project with high performance GPU on Windows

Hi,

Does anybody know how I can run JME Gradle project on the dedicated GPU (Nvidia GPU in my case) on Windows 11 laptop from command line. I tried with __NV_PRIME_RENDER_OFFLOAD=1 env variable, but it still runs on integrated Intel UHD Graphics.

On Linux, I was able to do this by setting DRI_PRIME=1 env variable, but it does not work on Windows.

Thanks in advance

1 Like

I think that’s more of a Windows question than a JME one. You might have some luck with the nvidia control panel. You may even need to lock the whole system to using the dedicated GPU when you are testing. (The nvidea control panel should allow you to set your preference per application, which is fine for an installed game but probably won’t work with Gradle)

2 Likes

Currently, I am using this approach and specified java.exe to run on high performance GPU, but it runs all Java apps on Nvidia GPU.
I am looking for a way to specify it from command line, like I was doing on Linux.

1 Like

I did a little more digging, and it seems like Windows really doesn’t want to support this workflow. Recent-ish updates even seem to have removed the ability to select the GPU preference via context menu.


I do have a (probable) workaround. Apparently, stuff launched from the command prompt inherits the Nvidia GPU preferences from the command prompt window. You probably don’t want every command prompt ever to run on the dedicated GPU, so:

  1. Create a shortcut to cmd.exe somewhere. (Desktop is pretty easy)
  2. Give it a distinctive name
  3. Tell the Nvidia Control panel that it should use the dGPU for that particular shortcut
  4. Use that shortcut for running your Gradle operations.
  5. Profit???
2 Likes

Thanks, will give it a try.