CUDA: Initialization Error


Your CUDA program is failing without giving any clue. You check the error value returned by CUDA runtime calls. You discover that one of the first few CUDA runtime calls, probably a cudaMalloc, is failing with an Initialization error. There is no initialization required to start calling CUDA APIs or kernels, so you now wonder what is this error and how to fix it.


NVIDIA could have been more informative with their error messages. The initialization error usually indicates that something went bad when the CUDA runtime communicated with the CUDA driver. One of the popular causes of this error is if the driver is older than the CUDA toolkit. Each release of CUDA toolkit ships with a driver. Note the version of this driver. Only drivers of the same or later version numbers will work well with that CUDA toolkit. Install the latest driver and this error should go away.

Tried with: CUDA 4.0


4 thoughts on “CUDA: Initialization Error

  1. Thanks. We got a nVIDIA geforce 460X card on a windows7 64 bit machine and the cudaGetDeviceCount() API returned 0 always.
    After seeing your post, we have installed the “Developer Drivers for WinVista and Win7 (270.81)” for 64 bit from the NVIDIA website
    Now it is working fine. The cudaGetDeviceCount() API returns 1 Device now.


  2. I had this error when launching CUDA from Matlab, however my driver and toolkit were up to date. The reason for the error was that Matlab had loaded dynamic CUDA lib files prior to an update of the toolkit/driver. So there was a mismatch, but only in Matlab. Restarting Matlab solved the problem.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.