pomegranate has GPU accelerated matrix multiplications to speed up all operations involving multivariate Gaussian distriutions and all models that use them. This has led to an approximately 4x speedup for multivariate Gaussian mixture models and HMMs compared to using BLAS only. This speedup seems to scale better with dimensionality, with higher dimensional models seeing a larger speedup than smaller dimensional ones.
By default, pomegranate will activate GPU acceleration if it can import cupy, otherwise it will default to BLAS. You can check whether pomegranate is using GPU acceleration with this built-in function:
import pomegranate print(pomegranate.utils._is_gpu_enabled())
If you’d like to deactivate GPU acceleration you can use the following command:
Likewise, if you’d like to activate GPU acceleration you can use the following command:
- Why cupy and not Theano?
- pomegranate only needs to do matrix multiplications using a GPU. While Theano supports an impressive range of more complex operations, it did not have a simple interface to support a matrix-matrix multiplication in the same manner that cupy does.
- Why am I not seeing a large speedup with my GPU?
- There is a cost to transferring data to and from a GPU. It is possible that the GPU isn’t fast enough, or that there isn’t enough data to utilize the massively parallel aspect of a GPU for your dataset.
- Does pomegranate work using my type of GPU?
- The supported GPUs will be better documented on the cupy package.
- Is multi-GPU supported?
- Currently, no. In theory it should be possible, though.