Using CUDA with CPU?


I am currently planning to develop an application using CUDA. But I may have to start the project on ordinary CPU for a period before I get GPU.

My question is: could I develop my program using CUDA on CPU first and then migrate to GPU when I get the hardware?
Is there any difference or any limitation if I program using CUDA only on CPU? And is it convinient to migrate to GPU later?

Thank you!

You could use the device emulation mode (just compile with -deviceemu option of NVCC) and get going.

But device emulation will NOT expose “race conditions”, “bad pointers” and a whole lot of bugs. And, you WONT get the right results because it does NOT model the base hardware correctly.

But still, its good to get things compiled and get ready for GPU.

Though usually, except for some floating point precision differences, the output should be the same.

As long as threads (espescially intra-warp) do NOT share data with each other – i.e. each thread works on a data-item separately – results would differ only by a matter of precision.

Thank you for your reply and advice!

I will first develop my program on CPU device emulation mode, if I could temporarily ignore possible problem of precision.

Also keep in mind that if you are parallelizing a big problem it could take hours to run / test on the CPU.

But good luck with it.