PyCUDA
is a Python library that exposes the power of NVIDIA's CUDA parallel computation API to us as Python developers.
Note
The official documentation for PyCUDA can be found athttps://mathema.tician.de/software/pycuda/. This includes the official source code and a mailing list for those interested.
In this section, we'll cover some basic examples as to how you can utilize PyCUDA for your computationally heavy programs that require the full power of your NVIDIA GPU.
PyCUDA
has a number of interesting features, which I feel should be mentioned at this point:
Object cleanup is tied to the lifetime of objects, and as such, it's easier to write code that isn't plagued by leaks and won't crash on you after extended periods of execution.
As previously mentioned, the main benefit of
PyCUDA
is that it abstracts away the complexities with things such aspycude.compiler.SourceModule
andpycuda.gpuarray.GPUArray
.Automatic error checking--
PyCUDA
automatically converts any of the errors that...