[SciPy-Dev] convolution using numpy/scipy using MKL libraries

Sturla Molden sturla.molden at gmail.com
Sun Jul 27 12:36:48 EDT 2014


Sai Rajeshwar <rajsai24 at gmail.com> wrote:

>    Im trying to implement 3d convolutional networks.. for which I wanted to
> use convolve function from scipy.signal.convolve or fftconvolve..  but
> looks like both of them doesnot use MKL libraries.. 

That is correct. MKL is used for matrix multiplication and linear algebra.

> is there any
> implementation of convolutoin which uses MKL libraries or MKL-threaded  so
> that code runs faster.

In Enthought canopy, numpy.fft.* uses MKL if you install the fastnumpy
package.

Otherwise you will have to make it yourself, which shouldn't be difficult.
The main thing is to find out if you want FFT convolution or time-domain
convolution. The latter boils down to a simple loop and a call to BLAS
function *DOT. You can use Python threads or a Cython prange loop to run it
in parallel. Anyway, a convolution is just a tiny loop to write in Cython,
C or Fortran, so I don't really see what the problem is.

Sturla




More information about the SciPy-Dev mailing list