/Nvidia-GPU-Manager

Service that allows to manage dedicated Nvidia GPU.

Primary LanguageShell

Table of contents

  1. Description
  2. Installation
  3. Example usage
  4. Prerequisites

image

Description

  • This service makes it easy to manage your dedicated NVIDIA GPU.
  • The way it works is based on binding/unbiding the Nvidia GPU device from its drivers.

Installation

curl -LJO https://github.com/DamirDenis-Tudor/Nvidia-GPU-Manager/raw/main/NvidiaGpuManager/ngpum.sh
shc -f ngpum.sh -o ngpum; rm ngpum.sh.x.c ngpum.sh;
chmod +x ngpum; sudo mv ngpum /usr/bin/

Example usage

Disabling the GPU

Screencast.from.2023-11-05.13-11-31.webm

Enabling the GPU

Screencast.from.2023-11-05.13-12-27.webm

Disabling the GPU again

Screencast.from.2023-11-05.13-13-20.webm

Prerequisites

  1. Download the NVIDIA Driver: Start by downloading the NVIDIA driver from NVIDIA's website.

  2. Prepare for Installation:

    • X server should be off.
      Using: nvidia-installer ncurses v6 user interface
           -> Detected 16 CPUs online; setting concurrency level to 16.
           -> The file '/tmp/.X0-lock' exists and appears to contain the process ID '11631' of a running X server.
       ERROR: You appear to be running an X server; please exit X before installing. For further details, please see the section INSTALLING THE NVIDIA DRIVER in the README available on the Linux driver download page at [www.nvidia.com](https://www.nvidia.com).
       ERROR: Installation has failed. Please see the file '/var/log/nvidia-installer.log' for details. You may find suggestions on fixing installation problems in the README available on the Linux driver download page at [www.nvidia.com](https://www.nvidia.com).
    • To proceed over this issue, you must enter in multi-user mode without GUI with the command:
      sudo telinit 3
    • Stop your display manager service (for examplelightdm or gdm) with the following command:
      sudo service gdm stop
    • Install any necessary libraries if prompted. An example error message may look like this:
      ERROR: Unable to find the development tool 'cc' in your path; please make sure that you have the 'gcc' package installed. If 'gcc' is installed, check that 'cc' is in your PATH.
  3. Post-Installation Reboot: After installation, if you reboot your system, you may encounter issues.

    Error Image

    This problem arises because the installation process may create the /etc/X11/xorg.config file, which may not list your integrated AMD GPU (my case).

  4. Recovery Mode and Config Update: To resolve this issue, follow these steps:

    • Reboot your system in recovery mode, allowing you to log in as the root user.
    • Check for your AMD GPU (my case) PCI ID, e.g., 04:00.0, using this command:
      lspci | grep VGA
      01:00.0 VGA compatible controller: NVIDIA Corporation TU117M [GeForce GTX 1650 Mobile / Max-Q] (rev a1)
      04:00.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] Cezanne [Radeon Vega Series / Radeon Vega Mobile Series] (rev c5)
    • Open the /etc/X11/xorg.conf file. You may only see the Nvidia device listed.

    Nvidia Device Image

    • Add a new device entry with the corresponding BusID.

    New Device Image

    • If you cannot find /etc/X11/xorg.conf, refer to this link for further guidance.
  5. Now you're all set! 😄