Code Yarns ‍👨‍💻
Tech BlogPersonal Blog

CUDA: Initialization Error

📅 2011-Jun-17 ⬩ ✍️ Ashwin Nanjappa ⬩ 📚 Archive


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