Coder Social home page Coder Social logo

threadexio / custom-optimus Goto Github PK

View Code? Open in Web Editor NEW
4.0 1.0 1.0 71 KB

A script to help you manage NVIDIA Optimus in Linux laptops

License: GNU General Public License v2.0

Shell 100.00%
nvidia-prime bbswitch igpu dgpu optimus optimus-laptops laptops hardware custom-optimus

custom-optimus's Introduction

Custom Optimus

What is this?

This is a shell script I made to switch between the iGPU and the dGPU on optimus-enabled laptops. It resembles optimus-manager, but it has some key diffirences.

Why would I use it?

I made it because I needed maximum battery life on my laptop while having maximum performance while gaming, maybe you are one of those people, if you have the time to install it and get it working properly on your hardware it might be worth your time.

Then why didn't you use optimus-manager instead?

Well, at first I though optimus-manager was THE way for Arch laptops, but I didn't want to reboot everytime I wanted to use the other GPU and I didn't want the whole X server to run on only one GPU.

What are the advantages and disadvantages?

Advantages:

  • Better power savings when using the dGPU (NVreg_DynamicPowerManagement)

  • You get an unnoticeably small boost in performance when using the dGPU (X still uses the iGPU)

  • You don't have to reboot after switching (only restarting X is required)

Disadvantages:

  • Starting an app, while having switched to the dGPU, will default to the iGPU (run with: run-gpu app_name to use the dGPU)

  • Modification to some configs may be required before it can work properly

  • It's not as tested, it has more bugs (these will get fixed)

Finally the installation...

  1. Install the required dependencies: sudo pacman -S bbswitch nvidia nvidia-prime

    • Nvidia drivers (nvidia package)

    • Nvidia PRIME (nvidia-prime package)

    • bbswitch (bbswitch package)

  2. Clone this repository somewhere on your system, doesn't really matter where... just make sure you remember the location (not in /tmp)

git clone https://github.com/threadexio/custom-optimus custom-optimus && cd custom-optimus
  1. Run the install.sh script and it will guide you

  2. After completing all that, do a quick reboot to ensure everything is loaded and ready to go.

  3. If you have done all, without errors, it should all work just run optimus from your terminal and choose which GPU you want to use

  4. To run any app with or without the dGPU use the included wrapper (/usr/bin/run-gpu) it will automatically detect if the GPU is active and use it.

    You can test it by running run-gpu glxinfo | grep "OpenGL vendor" with the dGPU active and then without it, when running it with the GPU active it should report:

    OpenGL vendor string: NVIDIA Corporation

    For example, this is how launch options in steam would look:

    run-gpu %command%

    Or if you don't like VSYNC:

    NO_VSYNC=1 run-gpu %command%

NOTE: Before switching the GPU, save all of your work because although you don't have to reboot, restarting X also kills the current session along with the open apps

Some more notes

Tested on:

  • Linux archlunix 5.15.6-zen2-1-zen #1 ZEN SMP PREEMPT Thu, 02 Dec 2021 15:47:07 +0000 x86_64 GNU/Linux
  • Nvidia Driver version: 495.44
  • WM: i3
  • Display Manager: LightDM

To end this super long README, I want to clarify that I have not tested this on other hardware, your experiences and configs may and probably will vary from mine.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.