8

I enabled the new "NVIDIA On-Demand" option in the NVIDIA X Server Settings. Now everything uses the iGPU by default, which should be better for battery life (at least, that's what I'm hoping for).

I'd like some applications (like Blender, for example) to use the dGPU by default.

According to the documentation:

To configure a graphics application to be offloaded to the NVIDIA GPU screen, set the environment variable __NV_PRIME_RENDER_OFFLOAD to 1. If the graphics application uses Vulkan or EGL, that should be all that is needed. If the graphics application uses GLX, then also set the environment variable __GLX_VENDOR_LIBRARY_NAME to nvidia, so that GLVND loads the NVIDIA GLX driver.

So I just created a shell script to act as a proxy to the Blender executable:

~/.local/bin/blender

#!/usr/bin/env bash
export __NV_PRIME_RENDER_OFFLOAD=1
export __GLX_VENDOR_LIBRARY_NAME=nvidia
blender="$HOME/opt/blender-2.82a-linux64/blender"
exec -a "$0" "$blender" "$@"

This works fine, but it isn't a particularly clean solution.

The NVIDIA settings have an "Application Profiles" section where you can add application-specific profiles.
(Application profiles documentation)
There are all kinds of OpenGL-related options, but I couldn't find any setting to select which GPU is used. Is this not possible using the application profiles? Is there a cleaner alternative to the environment variables?

2
  • This worked for you? trying something similar gave me a blender that can't detect CUDA.
    – nbubis
    Nov 4 '20 at 21:18
  • @nbubis yes this works for me. The script I posted only selects the GPU used for rendering the UI and the 3D scene editor etc. The actual Cycles rendering doesn't use the standard graphics API but custom CUDA code, it is independent of the __NV_PRIME_RENDER_OFFLOAD and __GLX_VENDOR_LIBRARY_NAME variables. If Blender doesn't detect your GPU as a CUDA device, that probably means you haven't installed your NVIDIA graphics drivers correctly.
    – tttapa
    Jan 5 at 20:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.