PyCUDA enables a Python program to pass data to and call CUDA kernels from a Python program. Getting it to install and work correctly on Ubuntu took a bit of work.
- I tried installing the
nvidia-343drivers for Ubuntu. But, it turns out that only 340.x or earlier drivers support the GTS 250 I use for display (not for compute). So, I reverted back and installed
nvidia-331drivers. Note that the
nvidia-331-updatesdriver will not work with CUDA either. Do not ask me why! 🙂
Installing the CUDA toolkit was easier, just install
PyCUDA is available in Ubuntu as a
python-pycudapackage. But, that is the very old 2013.1.1 version. Instead I installed it from the Python Package Index (PyPI):
$ sudo pip install pycuda
The install script kept complaining about the absence of a
configure.py script, but it seemed to end with success.
- Running a simple PyCUDA program showed that I had more errors to fix with module not being loaded into kernel, Python packages not being up to date and header files not being up to date with latest GCC. Once those were fixed, the PyCUDA program ran correctly! 🙂
Tried with: PyCUDA 2014.1, CUDA 5.5, NVIDIA 331 driver and Ubuntu 14.04