Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

To resolve issues starting MATLAB on Mac OS X 10.10 (Yosemite) visit: http://www.mathworks.com/matlabcentral/answers/159016

Performance Issue of 'imrotate' in double precision mode

Asked by Dehuan Xin on 26 Mar 2013

Hi

Recently I use 'imrotate' a lot, and I see a 25 times speed boost with single-precision data compared with double-precision.

I am quite astonished because I thought single-precision were usually 'only' twice as fast as double-precision.

I ran this code on Intel Core Duo E8400 @ 3Ghz, with Matlab 2012A 64 bit. Double precision takes 10.461 seconds, while single precision takes 0.456s.

s=randn(400,400);
for i=1:1:180
imrotate(s,i);
end

In profiler, I saw that "imrotatemex(MEX-file)" was called if input is single-precision but was not used if input is double-precision, which makes a huge difference in speed.

Is it possible that Mathworks update 'imrotate' so that "imrotatemex(MEX-file)" works with both single and double-precision data?

Thanks

Best

Dehuan Xin

0 Comments

Dehuan Xin

3 Answers

Answer by Teja Muppirala on 26 Mar 2013

Hi Dehuan,

If you are able to upgrade to a newer version, performance improvements for IMROTATE were implemented in R2012b. Moreover, R2013a adds GPU support for IMROTATE. See the release notes for more information.

http://www.mathworks.com/help/images/release-notes.html

2 Comments

Dehuan Xin on 26 Mar 2013

Hi, Teja

Does the data-type optimization (UINT8, UINT16, SINGLE) also apply to GPU-computing?

Teja Muppirala on 26 Mar 2013

As of R2013a, IMROTATE on the GPU supports UINT8, UINT16, LOGICAL, and SINGLE inputs. It does not support DOUBLE inputs.

Teja Muppirala
Answer by Alex Taylor on 26 Mar 2013

Hi Dehuan,

As Teja pointed out, IMROTATE was hardware optimized for double-precision inputs in R2012b. If you are able to update to a newer version, you will see a dramatic increase in performance for double inputs in IMROTATE.

0 Comments

Alex Taylor
Answer by Yair Altman on 30 Mar 2013
Edited by Yair Altman on 30 Mar 2013

This is a limitation imposed by MathWorks in imrotate.m (subfunction useIPP), purportedly because Intel's Performance Primitives Library (IPPL) does not support double precision (although it does). Modifying useIPP() to accept doubles will not help since imrotatemex itself rejects this data type...

The big performance boost in R2012b appears to result from simply removing this limitation in both useIPP and imrotatemex.

0 Comments

Yair Altman

Contact us