Optimus, CUDA and linux on a notebook

I am thinking of buying a notebook computer (Lenovo Y570) with a GT 555m graphics card and optimus. I don’t actually care that much to use optimus - it would be fine by me if the computer ran linux using the onboard Intel graphics and just used the GT 555m as a CUDA co-processor. Can anyone comment if this plan will work? If I was using Ubuntu, say, could I configure the X server to use the Intel graphics, and then use CUDA on the GT555M? Would the CUDA driver sort out this situation?

While I am here, I’ve puzzled over whether the GTX460M would be THAT much faster than the newer GT555M; a little less than a factor of 2, I suppose. Any comments on the relative merits of these two notebook GPU’s? (Its the GTX vs. the GT that most worries me, I suppose.) It seems most of the notebooks using GTX460M’s do not implement optimus, which could be a good thing at the moment, if one were using linux. (More speculatively…should I wait for the gtx560M which is just now appearing on the scene?)

I proceeded to get the Lenovo Y570 with its Sandybridge intel graphics + GT555M. My thinking was that it cost quite a bit less than those notebooks with the GTX460M and those notebooks do not generally have the optimus, that is the intel graphics and the nvidia graphics. In my experience, trying to use a display that is also used for cuda calculations severely crimps the GPU calculation speed, while making the desktop use uncomfortable. So having separate components seemed a good thing, even if the GT555M is not as speedy as the 460M.

However, for linux, the situation is just rather tortured at the moment, I’ve found. I do know my way around a linux machine fairly well, but I’ve not been able to get the nvidia 555M to do anything so far. I’ve been trying to use the bumblebee package that is fairly new. The Lenovo Y570 is not yet “supported” (speaking loosely) by bumblebee. I’ve thrashed around for a couple of days now, without success. I think I can turn the card on and off, however, maybe. Sometimes I can install the nvidia driver module, sometimes not…its a mystery… The Lenovo Y570 has no bios settings to affect graphics, alas.

I suspect that part of the problem is that the 555M is new enough to be marginally supported by nvidia for linux - setting aside the optimus issue. (And the Intel Sandybridge graphics, while working, is also marginally supported - direct rendering is kaput for me, but that’s an issue separate from this forum).

I also suspect that I will be able get it working after a while - likely with some developments on the bumblebee side. With linux, patience is a virtue.

After a bit more trial and error, at least one issue has become clear. The present versions of the Nvidia drivers do support the 555M, but this support seems to be for chipset PCI Id 10de:0dcd, whereas the Lenovo notebook I have has PCI Id 10de:0deb. In short, this 555M is not (yet?) supported by the linux driver. If I may be so bold, may I ask that this card be supported by the next release of the Nvidia graphics (or CUDA) driver? Thx…

c.f.,
http://us.download.nvidia.com/XFree86/Linux-x86_64/275.09.07/README/supportedchips.html

Just to note a possible solution to the problem of the Y570’s 555M graphics card having a different PCI ID,

hence not supported by standard nvidia drivers…

I found the following paragraph recently by google search:

In Ubuntu, we have a file called "additional_card_ids", which we include with the debian

packaging scripts. You can see it if you download the scripts with "apt-get source

nvidia-graphics-drivers". This file contains ids that are not yet included in the Nvidia driver.

You can get your card's id (with lspci -vn |grep VGA) and put it in that file. Then, rebuild

nvidia-graphics-drivers (with dpkg-buildpackage -rfakeroot -b -tc) and install nvidia-current.

I followed these instructions, adding “0DEB” to the promising “additional_card_ids” and rebuilt the

driver. This rebuilt fine. Alas, my Ubuntu computer is not my Y570, but a netbook-like thing. Now

I need to see how to port this over to my Suse linux machine…with its different kernel versions and so on.

The rebuild also built a “dev” package - perhaps that one can be unpacked on my Suse machine and

compiled manually…

Anybody fluent at Ubuntu-Suse package conversions??? :)

Added later: The above seems to be used in conjunction with Ubuntu’s “jockey” which is used to install proprietary drivers. I know nothing of jockey, but it seems to be Ubuntu specific…

It looks like I have the same problem with my Asus n5sf (sandybridge + Optimus + gt555m) using Ubuntu (10.10).
I cannot disable Optimus through the BIOS and the nvidia linux drivers don’t seem to work.
That is a shame as like you I wanted to used the GPU computing abilities of this chip. Maybe it is time to switch to OpenCL… (As I found very
straightforward to setup linux + GPU + OpenCL on an ATI equiped laptop)
I will try the solution you mentioned, although it looks complex.

I hope you will update us on whether you are able to succeed with Linux + gt-555m. I just shipped a Lenovo y570 back because it had a hard drive failure which got me off the hook with respect to the GPU (gt-555m). I really liked the laptop, especially because it had an SSD plus HD, but when they gave me the choice of a replacement or refund, I took the refund simply because I couldn’t get the gpu to be recognized by CUDA. If you get it working, you would be doing us all a favor to let us know how. Btw, I tried, under Windows, CUDA 3.2 with-out-of-the-box drivers and 4.0 with 285.x drivers I downloaded, no luck with either combo. I never got so far as trying the driver hack on Linux because it discovered my bad drive and wouldn’t mount it (Windows didn’t even notice). The whole thing became a lost cause at that point.

I just bough a Dell XPS15Z with GT525m + optimus as a portable cuda development laptop. I installed ubuntu 11.10 and successfully installed the last driver (from the 4.1 toolkit). Everything is working fine with optimus.
I don’t know whats a “optimus compatible laptop” is …
When you look at optirun, it does the following:

  1. power on your card (if power managment is on)
  2. load the nvidia driver
  3. run a X server with your application
  4. unload the driver
  5. power off the card (if power managment is on)
    If you don’t need any graphics interop, loading the driver will be sufficient to run cuda apps.
    You can manually do each step of optirun and see where is the problem.
    If you succeed in compiling the nvidia kernel module it must load. The only problem i had at the first try, was that my gtx card was not powered and consequently the driver package did not detect any nvidia card and so refuse to do anything.

Perhaps the latest nvidia cuda drivers support the 555M of the Lenovo Y570. The issue is just that it has a different PCI ID (“DEB”) than the standard 555M (“DCD”), so none of the standard nvidia drivers work on it (either Linux or Windows). I keep waiting and checking the various sites and (beta) drivers for success…

One of the Lenovo linux forums has a prescription for changing to a modded bios that allows one to disable the intel graphics at boot up. That may or may not help, since it seems to me the nvidia drivers would still not work. It might help with nouveau, however. I am reluctant to go that route since my laptop is presently “mission critical”.

Luckily it is not THAT important to run cuda on this laptop right now. But its disappointing…and just a little bit strange; like regressing to such things as the infamous “winmodem” (showing my age there, I think…).

LATER: Just to note that the 4.1 kernel module seems to at least install. Now I am stymied by the lack of support in bumblebee for Suse. Otherwise, attempting to run cuda devicequery produces the bottom few lines of:

[   68.252281] nvidia 0000:01:00.0: PCI INT A disabled

[   71.841115] nvidia 0000:01:00.0: enabling device (0002 -> 0003)

[   71.841122] nvidia 0000:01:00.0: PCI INT A -> GSI 16 (level, low) -> IRQ 16

[   71.841130] nvidia 0000:01:00.0: setting latency timer to 64

[   71.841134] vgaarb: device changed decodes: PCI:0000:01:00.0,olddecodes=none,decodes=none:owns=none

[   71.841359] NVRM: loading NVIDIA UNIX x86_64 Kernel Module  285.05.15  Mon Oct 17 18:19:24 PDT 2011

[   81.633242] NVRM: failed to copy vbios to system memory.

[   81.636459] NVRM: RmInitAdapter failed! (0x30:0xffffffff:864)

[   81.636466] NVRM: rm_init_adapter(0) failed

I’ll try bumblebee again when I have more time.

Even more later:

Apparently the card was just not turned on. I am back to:

[ 1504.250862] NVRM: The NVIDIA GPU 0000:01:00.0 (PCI ID: 10de:0deb) installed

[ 1504.250862] NVRM: in this system is not supported by the 285.05.15 NVIDIA Linux

[ 1504.250863] NVRM: graphics driver release.  Please see 'Appendix A -

[ 1504.250864] NVRM: Supported NVIDIA GPU Products' in this release's README,

[ 1504.250864] NVRM: available on the Linux graphics driver download page at

[ 1504.250865] NVRM: www.nvidia.com.

[ 1504.250873] nvidia 0000:01:00.0: PCI INT A disabled

[ 1504.250881] nvidia: probe of 0000:01:00.0 failed with error -1

[ 1504.250919] NVRM: The NVIDIA probe routine failed for 1 device(s).

[ 1504.250921] NVRM: None of the NVIDIA graphics adapters were initialized!

Requesting support for PCI ID 10de:0deb from NVIDIA… (Or at least some trick to work around this particular probe and get the driver installed…)

Some manufacturers change the PCI id of the video card to force you to use their supplied driver instead of the stock driver for whatever reasons. Under windows you can play with the ini file to get the driver to install. Under linux, you can probably download the bin file for the driver instead of the package and then it should have an option to unpack instead of install, from where you can try and change the files.

I have a thinkpad w520 with optimus (Quadro 2000m). In regular optimus mode it starts up with the intel chip for the graphics. Couldn’t get it to run X via the nvidia, however, the NVIDIA will run CUDA (useful under windows, as this machine will run nsight, also means that I can use GDB under linux). To run X with the nvidia driver I need to change the option in the bios to disable optimus.

For me I have no issue with CUDA, but on a different machine that isn’t connected to a display (it’s actually a tesla S1070) the NVIDIA driver doesn’t start up as X isn’t started. What I need to do there is load the nvidia driver manually and run any CUDA app (even device query) as root once and it forces CUDA to start (the devices are created under /dev). After that any user can use CUDA, it may work for you.

If it does, there is a script for setting up tesla that you can run on startup that would do the setup for you (uses nvidia smi). I can send it to you if you can’t find it.

I’ve unpacked the nvidia device driver file, but cannot find the file one would have to modify to support a new PCI ID. The kernel module directory has:

NVIDIA-Linux-x86_64-285.05.15/kernel$ ls

conftest.sh          makefile         nv.c         nv_gvi.c     nv-linux.h   nv-p2p.c     nvtypes.h     os-agp.c        os-registry.c    rmil.h

cpuopsys.h           Makefile.kbuild  nv-chrdev.c  nv.h         nv-memdbg.h  nv-p2p.h     nv-usermap.c  os-agp.h        os-smp.c         rmretval.h

gcc-version-check.c  Makefile.nvidia  nv-cray.c    nv-i2c.c     nv-misc.h    nv-procfs.c  nv-vm.c       os-interface.c  os-usermap.c     xapi-sdk.h

g_nvreadme.h         nvacpi.c         nverror.h    nv-kernel.o  nv-mlock.c   nv-reg.h     nv-vm.h       os-interface.h  README.template

Anyone have any hints as to what to tweek? The business end is clearly the pre-compiled nv-kernel.o object file.

Wasting yet more time poking around with this ubuntu clue, I suspect it is a red herring… I have an ubuntu system (not with the 555m) and a suse system (with the 555m). I compiled the ubuntu package according to prescription, tweeking the “additional cards” file to add the DEB PCI ID. It compiled and installed o.k., but the /lib/modules/3.0.0-13-generic/modules.alias file is just:

# modinfo nvidia_current

filename:       /lib/modules/3.0.0-13-generic/updates/dkms/nvidia_current.ko

alias:          char-major-195-*

supported:      external

license:        NVIDIA

alias:          pci:v000010DEd00000E00sv*sd*bc04sc80i00*

alias:          pci:v000010DEd00000AA3sv*sd*bc0Bsc40i00*

alias:          pci:v000010DEd*sv*sd*bc03sc02i00*

alias:          pci:v000010DEd*sv*sd*bc03sc00i00*

depends:

The aliases are identical to the aliases on my Suse machine with the lastest development cuda driver installed:

# modinfo nvidia.ko

filename:       nvidia.ko

alias:          char-major-195-*

supported:      external

license:        NVIDIA

alias:          pci:v000010DEd00000E00sv*sd*bc04sc80i00*

alias:          pci:v000010DEd00000AA3sv*sd*bc0Bsc40i00*

alias:          pci:v000010DEd*sv*sd*bc03sc02i00*

alias:          pci:v000010DEd*sv*sd*bc03sc00i00*

depends:

Hence I conclude that the Ubuntu system is not adding support in the nvidia.ko module for the PCI ID “DEB”. The kernel error also shows that the nvidia driver is checking the hardware PCI ID’s against some master list, etc. I don’t think the Ubuntu system is modifying the essential binary object file provided by nvidia to add the DEB PCI ID to the various parts within the object file.

(And one would think the Ubuntu people would be reporting happy computing with their Lenovo 555m’s by now!)

I recognize the the main issue here is likely that Lenovo/Nvidia do not want to be suggesting or providing support for Optimus on linux laptops for these cards, as might be implied if a driver for the DEB is provided. But could not a driver or procedure be provided somewhere that would allow us hackers to proceed and make use of our 555M’s with e.g., bumblebee?

We need to calculate. I’m just saying.

Just to report victory at last with using my Y570 555m graphics card. See:

https://github.com/Bumblebee-Project/bbswitch/issues/2

Using the latest NVIDIA-Linux-x86_64-295.17.run driver and a special hack for acpi for the Y570. Apparently the Y570 has some BIOS issues (i.e. errors) and really requires a BIOS patch to properly fix the problem.

optirun deviceQuery

[deviceQuery] starting...

deviceQuery Starting...

CUDA Device Query (Runtime API) version (CUDART static linking)

Found 1 CUDA Capable device(s)

Device 0: "GeForce GT 555M"

CUDA Driver Version / Runtime Version 4.2 / 4.1

CUDA Capability Major/Minor version number: 2.1

Total amount of global memory: 1024 MBytes (1073414144 bytes)

( 2) Multiprocessors x (48) CUDA Cores/MP: 96 CUDA Cores

GPU Clock Speed: 1.50 GHz

Memory Clock rate: 1570.00 Mhz

Memory Bus Width: 128-bit

L2 Cache Size: 131072 bytes

Max Texture Dimension Size (x,y,z) 1D=(65536), 2D=(65536,65535), 3D=(2048,2048,2048)

Max Layered Texture Size (dim) x layers 1D=(16384) x 2048, 2D=(16384,16384) x 2048

Total amount of constant memory: 65536 bytes

Total amount of shared memory per block: 49152 bytes

Total number of registers available per block: 32768

Warp size: 32

Maximum number of threads per block: 1024

Maximum sizes of each dimension of a block: 1024 x 1024 x 64

Maximum sizes of each dimension of a grid: 65535 x 65535 x 65535

Maximum memory pitch: 2147483647 bytes

Texture alignment: 512 bytes

Concurrent copy and execution: Yes with 1 copy engine(s)

Run time limit on kernels: Yes

Integrated GPU sharing Host Memory: No

Support host page-locked memory mapping: Yes

Concurrent kernel execution: Yes

Alignment requirement for Surfaces: Yes

Device has ECC support enabled: No

Device is using TCC driver mode: No

Device supports Unified Addressing (UVA): Yes

Device PCI Bus ID / PCI location ID: 1 / 0

Compute Mode:

< Default (multiple host threads can use ::cudaSetDevice() with device simultaneously) >

deviceQuery, CUDA Driver = CUDART, CUDA Driver Version = 4.2, CUDA Runtime Version = 4.1, NumDevs = 1, Device = GeForce GT 555M

[deviceQuery] test results...

PASSED

> exiting in 3 seconds: 3...2...1...done!

and even “optirum matlab” works as well - letting matlab use the 555M graphics card for the first time since I bought this (lovely, other than the nvidia card issue) 7 months ago.

Just to note that using CUDA with the 555M on the Y570, gives one a 5X speed up on simple Sgemm calculations and 2048X2048 sized matrices. This compared to the single processor, the Intel(R) Core™ i7-2630QM CPU @ 2.00GHz. Using all 4 cores (or 8 with hyperthreading, makes no difference), the 555M still gives a factor of 2 speed up. Other routines are similar (Sgesv/CULA). Seems to me a rule of thumb is that the 555M gives a factor of 4-5 speedup compared to a single processor, and a factor of 2 compared to all four cores. Not bad for 96 CUDA cores@1.5 GHz…a nice coprocessor!

Hello,

I have recently bought Lenovo Ideapad Y570 with gt555m and I have problems installing bumblbee on linux (Debian Sid). Could you please give me more specific instructions how to install bumblebee with these (295.x) drivers?

What I have so far:

Installed acpi-handle-hack module:

$ lsmod | grep hack

acpi_handle_hack        1284  0

Installed bbswitch module:

$ lsmod | grep bb

bbswitch                5299  0

Installed Virtual GL.

I have downloaded Nvidia 295.x Linux driver. When I install them (going to tty1, shutting down gdm3, running installer). I loose 3D acceleration - as expected here:

The following command is very important, if you skip it you will loose 3D acceleration. Restore Mesa as the default GL library since the primary display is running on the Intel graphics card:

sudo update-alternatives --set glx /usr/lib/mesa-diverted

To run command above successfuly I need to install package glx-alternative-mesa, but that package has nvidia-installer-cleanup as dependency, which conflicts with already installed nvidia-installer (from driver 295.x). So… what now?

I would be happy even if I could run my desktop only on gt555m and have integrated card disabled, but when I try that (installing nvidia drivers, running nvidi-xconfig to generate xorg.conf) X server starts multiple times (cca 150 times - some bug?) and I have to kill them and delete xorg.conf to even get back to desktop.

Any help would be appreciated.

EDIT:

Installatino from repository by this guide fails. Bumblebee deamon fails to start for no apparent reason (no err msg, nothing relevant in logs).

I don’t know that I can be that much help with bumblebee - I installed a version from last summer, last summer, by some thrashing around - since it is working for me now, I am loath to try to fix it… what I have appear to be just some simple wrappers around vglrun, etc.

I don’t think it is possible to disable the on-board intel video card; we will need a bios setting for that, and such a setting does not exist. So using just the nvidia card is not an option at this point, as far as I know. I also have lost 3-D capabilities when I installed the nvidia driver. This has to do with the libGL libraries getting over written - one could swap out the intel and nvidia libGL libraries with a small script if needed, I suppose. I gather there are systems for allowing these libraries to co-exist. Personally, the lack of 3D is not so important to me with the intel card; most everything works fine without it, and the 3D things work as well, if perhaps a mite slower. (3D support is not required of the intel card, for 3D support to work o.k. with the nvidia card, it seems)

You do not need bumblebee to run CUDA compute-only calculations - just load the nvidia module (after acpi-handle-hack and bbswitch) and the compute-only CUDA applications should run fine. The big advance here was just being able to load the nvidia module without it being rejected!

For the record, my “bumblebee-enable” and “bumblebee-disable” scripts just load the nvidia module or unload it - that’s all they do. I’ve given no thought to power management…

Also seems to be required is /etc/X11/xorg.conf.nvidia:

cat /etc/X11/xorg.conf.nvidia

Section "DRI"

        Mode 0666

EndSection

Section "ServerLayout"

    Identifier     "Layout0"

    Screen         "Screen1"

    Option         "AutoAddDevices" "false"

EndSection

Section "Module"

        Load  "dbe"

        Load  "extmod"

        Load  "glx"

        Load  "record"

        Load  "freetype"

        Load  "type1"

EndSection

Section "Files"

EndSection

Section "Device"

    Identifier     "Device1"

    Driver         "nvidia"

    VendorName     "NVIDIA Corporation"

    BusID          "PCI:01:00:0"

    Option         "IgnoreEDID"

#    Option        "ConnectedMonitor" "CRT-0"

    Option         "ConnectedMonitor" "LVDS1"

EndSection

Section "Screen"

    Identifier     "Screen1"

    Device         "Device1"

    Monitor        "Monitor0"

    DefaultDepth    24

    SubSection     "Display"

        Depth       24

        Modes      "1366x768" "1360x768" "1280x800" "1024x768" "800x600" "640x480"

    EndSubSection

EndSection

Section "Extensions"

Option "Composite" "Enable"

EndSection

Section "Monitor"

    Identifier "Monitor0"

    VendorName     "Unknown"

    ModelName      "Unknown"

    HorizSync       28.0 - 73.0

    VertRefresh     43.0 - 72.0

    Option         "DPMS"

    Modeline "1920x1200"  193.25  1920 2056 2256 2592  1200 1203 1209 1245 -hsync +vsync

    Modeline "1920x1080"  173.00  1920 2048 2248 2576  1080 1083 1088 1120 -hsync +vsync

    Modeline "1680x1050"  146.25  1680 1784 1960 2240  1050 1053 1059 1089 -hsync +vsync

    Modeline "1600x1200"  161.00  1600 1712 1880 2160  1200 1203 1207 1245 -hsync +vsync

    Modeline "1440x900"  106.50  1440 1528 1672 1904  900 903 909 934 -hsync +vsync

    Modeline "1366x768"   85.25  1368 1440 1576 1784  768 771 781 798 -hsync +vsync

    Modeline "1280x800"   83.50  1280 1352 1480 1680  800 803 809 831 -hsync +vsync

    Modeline "1280x1024"  109.00  1280 1368 1496 1712  1024 1027 1034 1063 -hsync +vsync

EndSection

I think that at this point I’ll just wait utill it works from repository install (hopefuly with new version of kernel or nvidia drivers). I realy don’t want to loose 3D acceleration on desktop, because I’m using Gnome 3 and it realy sucks in fallback mode. I already wasted too much time with this…

Thanks anyway.

If you are still playing with this old laptop, here is a quick solution.

http://forums.lenovo.com/t5/IdeaPad-Y-and-U-series-Laptops/Y570-How-to-enable-Nvidia-Optimus-Technology/ta-p/479197

Do

Do you understand the problem here? Were you able to intall Ubuntu 12.04 or 12.10 and make the bumblebee and CUDA work?