I spent enough time over the past couple of days trying to get CUDA working on my new Asus U31SD laptop, that I thought I’d share what ended up working. The thing that made the endeavor a challenge (at least for a knuckle-dragging mechanical engineer like me) was the hybrid (a.k.a Optimus) Intel/Nvidia graphics setup.
Since the system came with Windows 7, the first thing I did was install Ubuntu 11.04 in a dual-boot configuration (32-bit is what I selected, so I can’t make any statement about 64 bit). I then downloaded the latest CUDA developer drivers. I did the normal “sudo service gdm stop” followed by Ctrl-Alt-F1 to get a prompt. I ran the install script and it said some of the pre-install scripts failed, and asked if I wanted to continue. I figured “what the heck?” and said yes. The rest of the install seemed to go just fine, up till it asked if I wanted to modify my X server settings. Feeling lucky, I said yes, and was subsequently unable to restart the xserver.
I rebooted in recovery mode, and went back to the default graphics. I installed the rest of the toolkit and SDK (and gcc 4.4, with appropriate symlinks and modifications to nvcc.profile) and, not feeling too optimistic, tried to compile and run a simple test. It compiled just fine, but crashed when I tried to run it. Feeling defeated, I dinked around trying to get Visual C++ Express 2010 to work under my Windows 7 boot, and while I had limited success, I really didn’t want to do development under Windows (I was able to get the SDK examples to compile and run, but I never could figure out how to start a project from scratch - all the posts I could find seemed to be for a different combination of compiler/CUDA versions),
I did some more Googling and found the bumblebee project (https://github.com/MrMEEE/bumblebee) which aims to allow some degree of hybrid graphics support under linux. I followed the directions for Ubuntu in the README that’s on the main project page, and everything installed just fine. Using the “optirun” command before my CUDA executable (e.g. “optirun hellocuda”), I was then able to run my CUDA programs. I can even run cuda-gdb (unlike on my desktop that has only a single Nvidia card), which made me feel that my tinkering had been worth it.
Hope this is of some help to others trying to get CUDA, Optimus and Linux to work.