What is CUDA¶
CUDA is a computing platform taking advantage of Nvidia hardware. It effectively allows for array computations on Graphical Processing Units (GPU).
npstreams relies on the (optional) PyCUDA library
to access CUDA functionality.
Advantages of CUDA¶
CUDA in npstreams¶
PyCUDA is an optional dependency. Therefore, the CUDA-enabled functions are located in a separate
Importing anything from the
npstreams.cuda submodule will raise an
ImportError in the following cases:
PyCUDA is not installed;
No GPUs are available;
CUDA compilation backend is not available, possibly due to incomplete installation.
With this in mind, it is wise to wrap import statements from
npstreams.cuda in a
A limited set of functions implemented in npstreams also have CUDA-enabled equivalents. For performance reasons, all CUDA-enabled routines operate along the ‘stream’ axis, i.e. as if the arrays had been stacked along a new dimension.