Intel + nVida simultaneously. Is it possible for Linux desktop?

Hi aplattner.
I want to use the intel iGPU connected to my monitor and nVidia GPU only to work with CUDA.
Currently (thanks to recent versions of Xorg, kernel and nvidia driver) I do not need to configure xorg.conf for nvidia or intel driver be correctly loaded (I have a blank xorg.conf). I just choose iGPU or PCIe as primary display from the BIOS and the corresponding driver is correctly loaded. With either drivers, lspci shows the two hardware available (I guess it’s because I have multi-GPU enabled from the BIOS)
If I select PCIe, the nvidia driver is loaded and I can use CUDA in Blender as GPU compute. The issue is that the render consumes all graphics resources while working and system becomes slow and is difficult to do anything on the computer while rendering is working. I clarify that I use a Blender version with precompiled CUDA Kernel (I have not installed CUDA on the system).
If I select iGPU, the intel driver is loaded correctly, but CUDA is not available in Blender when the intel driver is loaded. So this last I say is what I want. With the intel driver loaded and the monitor connected to the iGPU, be able to use nVidia CUDA in Blender.

Edit:
Actually, I do not care where the monitor should be connected. I want the intel iGPU handle the graphics part, while I can use the nvidia GPU with CUDA in Blender.

Set the display to the Intel IGP.

  1. Verify that X is running on the Intel GPU (e.g., look in /var/log/Xorg.0.log).
  2. Verify that the nvidia kernel module is loaded: lsmod | grep nv
  3. Verify that the nvidia device control files are created w/ 666 permissions: ls /dev/nv*

Hello jwcalla.
iGPU as primary display from the BIOS. Blank xorg.conf.

[    61.834] (II) intel(0): Creating default Display subsection in Screen section
	"Default Screen Section" for depth/fbbpp 24/32
[    61.834] (==) intel(0): Depth 24, (--) framebuffer bpp 32
[    61.834] (==) intel(0): RGB weight 888
[    61.834] (==) intel(0): Default visual is TrueColor
[    61.834] (--) intel(0): Integrated Graphics Chipset: Intel(R) HD Graphics 4000
[    61.834] (--) intel(0): CPU: x86-64, sse2, sse3, ssse3, sse4.1, sse4.2, avx
[    61.834] (**) intel(0): Framebuffer tiled
[    61.834] (**) intel(0): Pixmaps tiled
[    61.834] (**) intel(0): "Tear free" disabled
[    61.834] (**) intel(0): Forcing per-crtc-pixmaps? no
[    61.834] (II) intel(0): Output VGA1 has no monitor section
[    61.834] (II) intel(0): Output HDMI1 has no monitor section
[    61.834] (II) intel(0): Output HDMI2 has no monitor section
[    61.834] (II) intel(0): Output DP1 has no monitor section
[    61.834] (II) intel(0): Output DP2 has no monitor section
[    61.835] (--) intel(0): Output VGA1 using initial mode 1920x1080 on pipe 0
[    61.835] (==) intel(0): DPI set to (96, 96)
[    61.835] (II) Loading sub module "dri2"
[    61.835] (II) LoadModule: "dri2"
[    61.835] (II) Loading /usr/lib/xorg/modules/extensions/libdri2.so
[    61.835] (II) Module dri2: vendor="X.Org Foundation"
[    61.835] 	compiled for 1.12.3, module version = 1.2.0
[    61.835] 	ABI class: X.Org Server Extension, version 6.0
[    61.835] (II) UnloadModule: "vesa"
[    61.835] (II) Unloading vesa
[    61.835] (II) UnloadModule: "fbdev"
[    61.835] (II) Unloading fbdev
[    61.835] (II) UnloadSubModule: "fbdevhw"
[    61.835] (II) Unloading fbdevhw
$ lsmod | grep nv
nvidia               9366287  0 
drm                   298236  5 nvidia,i915,drm_kms_helper
$ ls /dev/nv*
ls: cannot access /dev/nv*: No such file or directory

Thanks.

That last part about CUDA being unavailable is the surprising part. CUDA doesn’t require X to work, but it does require the device nodes to be created first. Newer drivers have a utility called nvidia-modprobe that is used to load the kernel module and create the device nodes; do you have that installed? It might be missing from the xorg-edgers package since it’s a pretty new utility.

Do CUDA applications work if you run them as root while the iGPU is running the display?

With the iGPU as the primary display, if I run “kdesudo blender” CUDA is still not available in Blender. I remind you that I use Blener with precompiled CUDA kernel and I have no installed CUDA.
“nvidia-modprobe” binary not seem to be in any of the Xorg edgers packages. Only one new package called “nvidia-persistenced” which I have installed. Anyway I have downloaded “nvidia-modprobe” and I have compiled and installed, and after reboot I still with CUDA not available. Did I had to do something else? Should there be a script that call to run nvidia-modprobe?
“ls /dev/nv*” still returns the same output as before.
I clarify that “nvidia-modprobe” was installed in “/usr/local/bin/”. I did not know how to choose the Prefix for “/usr/bin”.

I’m doing parallel testing also in Kubuntu 13.04 64bit, and is happening the same as with Kubuntu 12.04.

Yeah it doesn’t look like the nvidia-modprobe utility is being included in the PPAs just yet.

After you compiled and installed the nvidia-modprobe utility, does it have the setuid root permissions (rwsr-xr-x), owner root, group root? (I think you’d want to move this to /usr/sbin. Aaron please correct me.)

In the meantime here’s some light reading:

http://us.download.nvidia.com/XFree86/Linux-x86_64/325.15/README/optimus.html <-- see section “Loading the Kernel Module and Creating the Device Files without X”

http://us.download.nvidia.com/XFree86/Linux-x86_64/325.15/README/faq.html#devicenodes <-- “How and when are the the NVIDIA device files created?”

If you can’t get the nvidia-modprobe utility working just right, consider the script provided here in the meantime:

http://docs.nvidia.com/cuda/cuda-getting-started-guide-for-linux/index.html#runfile-installation

Section 2.5.2. Runfile Installation, step #6. You’ll need to run the script as root of course.

$ ls -l /usr/sbin/nvidia-modprobe
-rwxr-xr-x 1 root root 22976 ago 30 07:59 nvidia-modprobe

I’ve tried copying “nvidia-modprobe” in “/usr/sbin/” and setting to boot in “/etc/rc.local”, and the devices are not created. I have also tried with the script and setting to boot in “/etc/rc.local” and the devices are not created.
But here I am a little confused, if I run as root the script I get:

FATAL: Module nvidia not found

which seems to be true:

$ modprobe -l | grep -i nvi
kernel/drivers/video/nvidia/nvidiafb.ko
kernel/drivers/net/ethernet/nvidia/forcedeth.ko
updates/dkms/nvidia_325.ko

but a module “nvidia” seems to be loaded anyway:

$ lsmod | grep nv
nvidia               9366287  0 
drm                   298236  5 nvidia,i915,drm_kms_helper

Edit: nvidia-modprobe also does not work with (rwsr-xr-x) permissions

I’ve replaced in the script “/sbin/modprobe nvidia” by “/sbin/modprobe nvidia_325”, and the devices are created!

$ ls /dev/nv*
/dev/nvidia0  /dev/nvidiactl

But still no CUDA available in Blender. How I can know if it is a Blender problem (not detecting nvidia CUDA capabilities when iGPU is as primary display)? because I have no CUDA toolkit installed and I do not know with which another application I could try.

Edit: I wonder if the script has worked because modprobe actually load the module. Or because without the error output the script can continue running.

Yeah that script doesn’t attempt to create the device files if the module isn’t successfully loaded (if [ “$?” -eq 0 ]; then…). I know the Ubuntu packagers are using all kinds of names for the nvidia driver versions these days. It’s a real mess.

I didn’t look into the nvidia-modprobe code too closely but that could be the same reason why that wasn’t working also.

Either way, I’m not sure why Blender isn’t detecting CUDA availability. Unfortunately I don’t have any Blender experience, and all my CUDA experience is with the toolkit.

Well, I’ve installed CUDA toolkit 5.5 with examples in Kubuntu 13.04. When I start the system with PCIe as primary display (nVidia), CUDA is available in Blender installed from repositories (without precompiled CUDA Kernel). I compiled two examples of CUDA, smokeParticles and Mandelbrot. They works with PCIe as primary display.
When I start the system with iGPU as the primary display (I have verified that the devices have been created) CUDA is not available in Blender. CUDA examples do not work, and I get the next messages when run from the terminal:

./smokeParticles
CUDA Smoke Particles Starting...

The following required OpenGL extensions missing:
        GL_ARB_multitexture
        GL_ARB_vertex_buffer_object
        GL_EXT_geometry_shader4.

===

./Mandelbrot
[CUDA Mandelbrot/Julia Set] - Starting...
CUDA error at ../../common/inc/helper_cuda.h:898 code=35(cudaErrorInsufficientDriver) "cudaGetDeviceCount(&device_count)"

Is there any useful test that I can do with the CUDA examples?

I wonder if any of the nVidia developers has confirmed in some Linux distribution that in a desktop computer with Intel iGPU and nVidia card had been able to do what I suggest in this thread. If so, would you please be kind enough to tell me what is the distribution in which this works?.
Thank you.

YAFU, Thanks for reporting this issue.

  • Please provide nvidia bug report? what gpu you are using ?
  • how you are using blender application with cuda? any settings in blender? what version of blender?
  • any more information that will help to duplicate this issue?

YAFU, Please provide requested information so we can reproduce this issue in-house…

@sandipt, sorry for the delay in responding. I’ve already sent the bug report.

I would appreciate if you do the tests. If you can make this works in any Linux distribution, I would appreciate that you indicate me how and on which distribution you have made it work. That way I will be able to test and know if it is a problem related to Linux, or my computer.
Thank you.

YAFU, Filed Bug 1384430 to track this issue.

Because I only use cuda to program, I only need to load dev without module nvidia.

I simply comment the line # /sbin/modprobe nvidia, and it works.

http://askubuntu.com/questions/253161/how-to-use-intel-integrated-graphic-card-for-display-and-nvidia-card-for-cuda-on/387553#387553

I tried it on ubuntu 13.10, xps 8700 dekstop with nvidia 635, driver 331, cuda 5.5.

To install cuda 5.5 on ubuntu 13.10, I followed this:

http://pastebin.com/fDpqvSi5

A quick update on the situation after two years…
I tried again and I was able to achieve this without having to do difficult configurations. So easy for common users as it should be.
What I’ve done: I’am using 346.59 nvidia drivers on Kubuntu 15.04. You make sure you have installed “nvidia-prime” and “nvidia-modprobe” packages. Reboot the system and from BIOS configuration select iGPU as Primary Display and Multi Monitor (or Multi GPU) enabled. On Kubuntu (or Ubuntu) in nvidia-settings in PRIME Profile choosing “Intel - Power Saving mode”. Use Blender with precompiled CUDA Kernel downloaded from official Blender site, or Blender buildbot (tar.bz2 file, unpack to a folder and run “blender” file).
So, Display with the Intel iGPU in the system works fast, while Blender render with CUDA!

Some clarifications:

  • I have connected my monitor (one monitor) with DVI to nvidia GPU and VGA to intel at the same time. My monitor is set to Auto Detect the input signal source.
  • If you have had any problems setting this, for go back to the original state rename the hidden folder “/home/YOUR_USER/.nv” and delete files you find on “/etc/X11” with similar names to “xorg.conf.09102015” where the number is the date on which it was created.

Hi, is nvidia-prime included in official driver from nvidia?

My system:

Opensuse 13.2/64
Intel i5 3770K
GTX 760 4 GB
Driver 352.09

nvidia-prime is not in OpenSUse repositories, anyway I use driver downloaded from Nvidia.
Is it may possible to compile nvidia-prime on my system?

Thanks YAFU for the link from Blender Artists, try to get this to work for years.

Cheers, mib

Hello mib2berlin !

These are the files that install the “nvidia-prime” package in Ubuntu:
http://packages.ubuntu.com/vivid/amd64/nvidia-prime/filelist

Perhaps you can search if you have those files in the system.

Thanks YAFU, no, it is nothing with “*prime” on my system.
May I have to look for it in SDK, in Toolkits it is not included.

Cheers, Mib

I was able to get my NVIDIA card working for compute loads only, with prime set to use the Intel GPU. For the details see

https://devtalk.nvidia.com/default/topic/734737/linux/ubuntu-14-04-optimus-cuda/2/post/4831145/#4831145

Many of the solutions I’ve seen say to just change a BIOS setting, and boom, it works. But my BIOS has no such setting (DELL), and nobody really tries to explain why this works. They just tried it, and it did. But for me, it didn’t, so I dug deeper to try and figure out what exactly Prime was doing (see link).