How to launch an app via terminal using the discrete AMD GPU

Hello, there this article will talk about running an app via terminal using your discrete AMD or ATI GPU. You can launch any application by using your GPU given you can launch that app via terminal. I guess you can do something similar with NVIDIA GPUs if this doesn’t work with NVIDIA GPU. But I don’t know for sure. I don’t own an NVIDIA GPU.

Some real-life applications of this method are:

  • Some tasks are better suited for the GPU than CPU.
  • To test if GPU drivers are properly installed and working.
  • To compare performance differences between the integrated GPU and discrete GPU.

I personally used this method to test if my AMD R5 M430 GPU drivers are installed at all and then after that to compare the performance difference between integrated and discrete GPU. This method can come handy at times.

How to launch an app via terminal command using dedicated GPU

Step 1: First of all make sure driver for your dedicated GPU is installed.

If you are using any of the popular Linux distros then most probably open source drivers or proprietary drivers as per your choice are already installed during installation of the distro itself.

Step 2: After the drivers are properly installed go ahead and use the following syntax to launch an app using your GPU.

$ DRI_PRIME=1 <app-name-you-want-to-run>

or

$ sudo DRI_PRIME=1 <app-name-you-want-to-run>

Eg:

# Launch steam using your dedicated graphics card

$ DRI_PRIME=1 steam

Step 3: Now make sure that the program is launched using your dedicated graphics card.

# Install and launch radeontop to see the performance and usage of your Radeon or AMD/ATI GPU.

$ sudo apt-get install radoentop && sudo radeontop

If you see things moving around then you can be sure that driver for your GPU is installed and the app is making use of your GPU. But if you see the screen is stale and nothing is moving around then it is most likely because drivers are not installed properly. You should try launching a heavier app for the final test before moving on to install or reinstall drivers.

Sometimes even if drivers are installed it might not be working properly then you should try to reinstall the drivers.

or

Run the ‘glmark2‘ benchmark to make sure your GPU is working fine.

Conclusion

This method can be used in many ways, just use your imagination. For example, hashcat is said to work faster with GPU than CPU(not sure never tested). And I don’t have anything else in my head right now. Anyways nobody reads till the end so I’ll stop here for now.

Hope it was helpful. Have a good day.

Leave a Comment