Question: i wrote a cuda program and i am testing it on ubuntu as a virtual machine. the reason for this is i have windows 7, i don't want to install ubuntu as a secondary operating system, and i need to use a linux operating system for testing.
my question is: will the virtual machine limit the gpu resources? So will my cuda code be faster if i run it under my primary operating system than running it on a virtual machine?

Answer: 
I faced a similar task once. What I ended up doing was installing Ubuntu on a 8GB thumb drive with persistent mode enabled. 

That gave me 4GB to install CUDA and everything else I needed.

Having a bootable USB stick around can be very useful. I recommend reading [this](https://wiki.ubuntu.com/LiveUsbPendrivePersistent).

Also, [this link](http://www.infosecramblings.com/backtrack/backtrack-4-usbpersistent-changesnessus/) has some very interesting material if you're looking for other distros.
As of CUDA 3.1 it's virtualization capabilities are not vivid, so the only usable approach is to run CUDA programs directly on the target HW+SW