Two graphic cards. One for Desktop. One for Cuda computing

Hi All. I hope someone can help.

I’m the author of the Seergdb front-end to gdb. The wonderful people at NVidia have created a version of gdb with additional cuda commands. I’d like to add these to my Seergdb debugger.

So far, I’ve found it’s difficult to debug a cuda program when the Desktop is sharing the same Nvidia card. So I’ve found a cheap/old laptop that has an Intel integrated gpu and a NVidia card. I’d like the Desktop to use the Intel gpu and have the NVidia gpu solely for cuda development (No Desktop stuff).

My machine sees both.

$ lspci | grep VGA
00:02.0 VGA compatible controller: Intel Corporation HD Graphics 530 (rev 06)
01:00.0 VGA compatible controller: NVIDIA Corporation GM107GLM [Quadro M1000M] (rev a2)

And it boots to using the Intel card for the desktop, which is good.

My question is, what magic to I need to do to get the NVidia card “loaded” with drivers so that I can do Cuda development. I suspect there are some X11 config changes?

I’ve already have the nvidia drivers installed that meet the requirements of my older card.

$ zypper se -s x11-video-nvidiaG0* nvidia-video-G06* nvidia-gl*G0* | grep G05 | egrep '^i'
i  | nvidia-glG05              | package | 470.256.02-lp156.62.1 | x86_64 | repo-non-free (15.6)
i  | nvidia-glG05-32bit        | package | 470.256.02-lp156.62.1 | x86_64 | repo-non-free (15.6)
i+ | x11-video-nvidiaG05       | package | 470.256.02-lp156.62.1 | x86_64 | repo-non-free (15.6)
i  | x11-video-nvidiaG05-32bit | package | 470.256.02-lp156.62.1 | x86_64 | repo-non-free (15.6)

And I’m using Leap15.6.

Many thanks in advance.

@ernie.pasveer Hi and welcome to the Forum :smile:

In my desktop I got a cheap Intel GPU to use and Nvidia for Prime Render Offload (I do have another in there for VM’s as well…) :wink:

Can you show the output from inxi GSaz to see if driver has loaded for the GPU as well as grub options.

Sure.

# inxi -GSaz
System:
  Kernel: 6.4.0-150600.23.17-default arch: x86_64 bits: 64 compiler: gcc
    v: 7.5.0 parameters: BOOT_IMAGE=/boot/vmlinuz-6.4.0-150600.23.17-default
    root=UUID=40dc44ff-7141-4274-afa0-59508c344bc4 splash=silent preempt=full
    mitigations=auto quiet security=apparmor nosimplefb=1
  Console: pty pts/2 wm: kwin_x11 DM: SDDM Distro: openSUSE Leap 15.6
Graphics:
  Device-1: Intel HD Graphics 530 vendor: Lenovo driver: i915 v: kernel
    arch: Gen-9 process: Intel 14n built: 2015-16 ports: active: eDP-1
    empty: none bus-ID: 00:02.0 chip-ID: 8086:191b class-ID: 0300
  Device-2: NVIDIA GM107GLM [Quadro M1000M] vendor: Lenovo driver: N/A
    alternate: nouveau, nvidia_drm, nvidia non-free: 530.xx+
    status: current (as of 2023-05) arch: Maxwell code: GMxxx
    process: TSMC 28nm built: 2014-19 pcie: gen: 3 speed: 8 GT/s lanes: 16
    bus-ID: 01:00.0 chip-ID: 10de:13b1 class-ID: 0300
  Device-3: Chicony Integrated Camera driver: uvcvideo type: USB rev: 2.0
    speed: 480 Mb/s lanes: 1 mode: 2.0 bus-ID: 1-8:3 chip-ID: 04f2:b52c
    class-ID: 0e02 serial: <filter>
  Display: server: X.Org v: 1.21.1.11 with: Xwayland v: 24.1.1
    compositor: kwin_x11 driver: X: loaded: modesetting unloaded: fbdev,vesa
    alternate: intel dri: iris gpu: i915 display-ID: localhost:10.0 screens: 1
  Screen-1: 0 s-res: 2560x1440 s-dpi: 96 s-size: 677x381mm (26.65x15.00")
    s-diag: 777mm (30.58")
  Monitor-1: eDP-1 mapped: HDMI-1 model: LG Display 0x054f built: 2016
    res: 2560x1440 hz: 75 dpi: 93 gamma: 1.2 size: 698x393mm (27.48x15.47")
    diag: 395mm (15.5") ratio: 16:9 modes: 1920x1080
  API: OpenGL v: 4.5 Mesa 23.3.4 renderer: llvmpipe (LLVM 17.0.6 256 bits)
    direct-render: Yes

Do you mean the contents of /boot/grub2/grub.cfg ?

@ernie.pasveer No, it shows in the inxi output and I see nosimplefb=1 which is correct, you might want to add fbdev=1 in the grub options as well…

So your likely issue is suse-prime, bumblebee and bbswitch packages installed blocking the Nvidia driver as it shows N/A.

What I suggest is using switcherooctl to launch an application with Nvidia gpu, it does seem to work better than suse-prime.

So, you need to check what is installed with zypper se -i suse-prime bumble bbswitch The -i switch shows what is installed, they all need to be deleted.

Then after removal if you don’t see the initrd rebuild, need to check what is lurking in the initrd as root user with lsinitrd | grep -E "nvidia|nouveau

Hopefully at this point any suse-prime xorg.conf is removed so check in /etc/X11 and /etc/X11/xorg.conf.d directories for any conf files with ls -laR /etc/X11

lets see how that goes first, also no reboot yet :wink:

This is what I have.

# zypper se -i suse-prime bumble bbswitch
Loading repository data...
Reading installed packages...

S  | Name                      | Summary                                                                       | Type
---+---------------------------+-------------------------------------------------------------------------------+--------
i  | plasma5-applet-suse-prime | Plasma 5 applet for controlling SUSE Prime                                    | package
i  | suse-prime                | GPU (nvidia/intel) selection for NVIDIA optimus laptops with bbswitch support | package
tigger:~ # 

So I’ll remove them as you said.

@ernie.pasveer yes, since nothing else is installed should be good, plus add locks so they don’t get installed again zypper al suse-prime plasma5-applet-suse-prime

Now install switherooctl for that have a read here https://en.opensuse.org/SDB:NVIDIA_Switcheroo_Control

Reboot and test with switcherooctl list

1 Like

Done the changes and rebooted. Here’s the output from switcherooctl list

tigger:~ # switcherooctl list
Device: 0
  Name:        Intel® HD Graphics 530
  Default:     yes
  Environment: DRI_PRIME=pci-0000_00_02_0

Device: 1
  Name:        NVIDIA Corporation GM107GLM [Quadro M1000M]
  Default:     no
  Environment: __GLX_VENDOR_LIBRARY_NAME=nvidia __NV_PRIME_RENDER_OFFLOAD=1 __VK_LAYER_NV_optimus=NVIDIA_only
tigger:~ # 

And “lsmod” now shows the nvidia card!

tigger:~ # lsmod | grep nv
nvidia_drm             77824  2
nvidia_modeset       1212416  3 nvidia_drm
nvidia_uvm           2740224  0
nvidia              35667968  81 nvidia_uvm,nvidia_modeset
nvme_fabrics           45056  0
nvme                   65536  3
nvme_core             225280  5 nvme,nvme_fabrics
nvme_auth              24576  1 nvme_core
t10_pi                 16384  2 sd_mod,nvme_core
video                  77824  3 thinkpad_acpi,i915,nvidia_modeset
tigger:~ # 

@ernie.pasveer
I have a check script in ~/bin called nvidia_check;

cat bin/nvidia_check 
#!/usr/bin/bash

function lib_installed() { /sbin/ldconfig -N -v $(sed 's/:/ /' <<< $LD_LIBRARY_PATH) 2>/dev/null | grep $1; }
function check() { lib_installed $1 && echo "$1 is installed" || echo "ERROR: $1 is NOT installed"; }

check libcuda

check libnccl

check libcudnn 

nvcc -V

Not sure if you use nccl and cudnn…

So to launch an application with nvidia use switcherooctl launch <some_app>

For example switcherooctl launch glxinfo | grep "OpenGL renderer"

You can also install nvtop and check what is using the nvidia device or use nvidia-smi

You don’t need to be root user either :wink:

Cool. This script helps! I’ll play around with “switcheroo”.

Thanks so much for your help!!! I’ll play around now. I’m much further than I was before.

If you’re ever in Houston, I owe you a beer. :grinning:

1 Like

Why G05 driver? Quadro M1000M card is supported, G06 (550) is available.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.