Intel® oneAPI Math Kernel Library
Ask questions and share information with other developers who use Intel® Math Kernel Library.
6956 Discussions

Performance comparison for Convolution - Direct vs FFT vs Auto

rahul_modi
Beginner
575 Views
Hi,
This is regarding the comparison of Direct Mode vs FFT mode for Multi-dimensional convolutions in terms of performance. My expectation was that the FFT mode should be faster than direct mode, but it turned out to be the other way for my test cases.
I tested all modes for 2-dimensional convolution of a 256 x 256 matrix with a 5 x 5 kernel
Approximate runtime (averaged over 1000 runs) was
DIRECT mode: 2.4 ms
FFT mode: 9.5 ms
AUTO mode: 9.5 ms
I was surprised by the slower run time of FFT mode.Any insight regarding performance of Intel MKL convolution routines will be helpful.

Thanks,

Rahul Modi.
0 Kudos
1 Solution
Victor_Gladkikh
New Contributor I
575 Views

Teoretically direct mode is faster then FFT mode for kernels less then 7*7but actuallycut-off pointdepends to performance of FFT mode and direct mode which depend to MKL version andhardaware.

Victor

View solution in original post

0 Kudos
4 Replies
Victor_Gladkikh
New Contributor I
575 Views
Hi Rahul,

Which MKL release and Intel processordo you use?

FFT mode vs. DIRECT mode:
FFT mode hasoverhead, soexecution time of FFT modecan be bigger then execution time of direct mode for "small" problem. This overhead depends to hardware, MKL version and sizes of problem.

Victor.
0 Kudos
rahul_modi
Beginner
575 Views
Hey Victor,
Thanks again for your prompt reply.
I am using MKL ver 10.3 Update 8 release and I am using an Intel core i7-2600K CPU @ 3.4 GHz
Currently I have MKL configured to run in the sequential mode.
So do you suggest using direct mode for smaller problems?
As for more on the test problem, I had a simple 256*256 input array
0 1 2 . . . . 255
256 257 ... ... ... ... 511
...
...
65280 ... ... ... ... 65535
Ans this array is convolved with a 5*5 kernel
-1, -0.5, 0, 0.5, 1,
-1.5, -0.75, 0, 0.75, 1.5,
-2, -1, 0, 1, 2,
-1.5, -0.75, 0, 0.75, 1.5,
-1, -0.5, 0, 0.5, 1,
-1, -0.5, 0, 0.5, 1
Thanks for all your help.
Best,
Rahul Modi.
0 Kudos
Victor_Gladkikh
New Contributor I
576 Views

Teoretically direct mode is faster then FFT mode for kernels less then 7*7but actuallycut-off pointdepends to performance of FFT mode and direct mode which depend to MKL version andhardaware.

Victor

0 Kudos
rahul_modi
Beginner
575 Views
Thanks, that helps
-Rahul
0 Kudos
Reply