Use dedicated gpu only on laptop running Ubuntu 20.04

10,769

After installing the graphics drivers from Nvidia, there will be an app installed called NVIDIA X server Settings. There is a section called as Prime-Profiles. Under that you can select performance mode (NVIDIA Graphics card only), On-Demand mode (like Windows, for basic task only integrated gpu, heavy task dedicated gpu), or powersaving mode(integrated gpu only).

Alternately you can run sudo prime-select nvidia which will select the dedicated NVIDIA card only.

Note: You will need a reboot to apply the changes.

Share:
10,769
Kevin
Author by

Kevin

Updated on September 18, 2022

Comments

  • Kevin
    Kevin over 1 year

    I'm working on an Acer Nitro 5 515-43 with a dedicated Nvidia gtx 1650 and an integrated AMD gpu. I want to use the dedicated gpu all the time. However the system uses the integrated one instead. What can i do to change this? Since the integrated gpu is and amd one, the optimus/prime solution shouldn't work.
    Here is some additional information about the gpus:

    lspci -nn | grep -E 'VGA|Display'
    

    05:00.0 VGA compatible controller [0300]: Advanced Micro Devices, Inc. [AMD/ATI] Picasso [1002:15d8] (rev c2)

    glxinfo -B
    

    name of display: :1
    display: :1 screen: 0
    direct rendering: Yes
    Extended renderer info (GLX_MESA_query_renderer):
    Vendor: X.Org (0x1002)
    Device: AMD RAVEN (DRM 3.35.0, 5.4.0-39-generic, LLVM 9.0.1) (0x15d8)
    Version: 20.0.4
    Accelerated: yes
    Video memory: 2048MB
    Unified memory: no
    Preferred profile: core (0x1)
    Max core profile version: 4.6
    Max compat profile version: 4.6
    Max GLES1 profile version: 1.1
    Max GLES[23] profile version: 3.2
    Memory info (GL_ATI_meminfo):
    VBO free memory - total: 1756 MB, largest block: 1756 MB
    VBO free aux. memory - total: 3016 MB, largest block: 3016 MB
    Texture free memory - total: 1756 MB, largest block: 1756 MB
    Texture free aux. memory - total: 3016 MB, largest block: 3016 MB
    Renderbuffer free memory - total: 1756 MB, largest block: 1756 MB
    Renderbuffer free aux. memory - total: 3016 MB, largest block: 3016 MB
    Memory info (GL_NVX_gpu_memory_info):
    Dedicated video memory: 2048 MB
    Total available memory: 5120 MB
    Currently available dedicated video memory: 1756 MB
    OpenGL vendor string: X.Org
    OpenGL renderer string: AMD RAVEN (DRM 3.35.0, 5.4.0-39-generic, LLVM 9.0.1)
    OpenGL core profile version string: 4.6 (Core Profile) Mesa 20.0.4
    OpenGL core profile shading language version string: 4.60
    OpenGL core profile context flags: (none)
    OpenGL core profile profile mask: core profile

    OpenGL version string: 4.6 (Compatibility Profile) Mesa 20.0.4
    OpenGL shading language version string: 4.60
    OpenGL context flags: (none)
    OpenGL profile mask: compatibility profile

    OpenGL ES profile version string: OpenGL ES 3.2 Mesa 20.0.4
    OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.20

    lshw -short | grep -i  display
    

    /0/100/1.1/0 display TU117M [GeForce GTX 1650 Mobile / Max-Q]
    /0/100/8.1/0 display Picasso
    The driver of the nvidia gpu is:

    nvidia-detector
    

    nvidia-driver-440

    The OS:

    lsb_release -a
    

    No LSB modules are available.
    Distributor ID: Ubuntu
    Description: Ubuntu 20.04 LTS
    Release: 20.04
    Codename: focal

    The kernel:

    uname -rm 
    

    5.4.0-39-generic x86_64

    When i run nvidia-xconfig with root privileges and reboot afterwards i cant get past the initial logo. Only rebooting in recovery mode and deleting /etc/X11/xorg.conf with a subsequent reboot allows to use the pc again.

  • Kevin
    Kevin almost 4 years
    Thank you for your answer. However the Nvidia X server Settings app opens just as an empty window save for the two buttons labelled "Help" and "Quit" at the bottom. Running sudo prime-select nvidia and rebooting also doesn't seem to change anything. I meassure the activity of the gpu with nvidia-smi -l 1
  • Abhay Patil
    Abhay Patil almost 4 years
    @Kevin try reinstalling the drivers. First purge and autoremove the old drivers and then install again. Btw what is the output for nvidia-smi -l 1
  • Kevin
    Kevin almost 4 years
    Sorry for the delay, i will try a complete reinstall of the drivers during the weekend.
  • Kevin
    Kevin almost 4 years
    So what i did: sudo apt-get purge nvidia* sudo apt-get autoremove sudo apt-get install nvidia-drivers-440 reboot the graphicscard gets detected in the settings. But when i try to open the NVIDIA XServer setttings i still get a blank window.
  • Abhay Patil
    Abhay Patil almost 4 years
    @Kevin If you are using pop-shell on GNOME, then the xserver settings willl be blank. You will get an option to select the GPU in the top right setion of the screen, under power (maybe). Else try sudo apt autoremove --purge nvidia* and install the drivers from the nvidia website nvidia.com/Download/index.aspx?lang=en-us. here select the linux 64 bit under the operating system.
  • Kevin
    Kevin almost 4 years
    Even this fails. From /var/log/nvidia-installer.log i get this error:/tmp/selfgz3389/NVIDIA-Linux-x86_64-430.09/kernel/comm‌​on/inc/nv-linux.h:15‌​93:6: error: "NV_BUILD_MODULE_INSTANCES" is not defined, evaluates to 0 [-Werror=undef]