Very slow execution on Matlab code in linux

10 views (last 30 days)
Hello, I have a matlab executable file that is running under Matlab Compiler Runtime (2013a) on a linux machine (Ubuntu 12.04 LTS) and another executable with the same function but compiled for Windows machine. The execution time on Windows platform is about 60 seconds, but in Linux is taking much longer time (i.e. about 400 seconds). The Matlab runtime environment on linux is 2013a and in windows is 2013b.
Do you think that the difference in execution time is related on the different versions of the runtime environments? What can I do in order to improve the speed on the linux environment?

Accepted Answer

Dima Lisin
Dima Lisin on 8 Feb 2015
Edited: Dima Lisin on 8 Feb 2015
Hi Dimitris,
Based on what you are saying I would guess that the bottleneck may be in reading the video. Matlab uses the codecs provided by the OS, which could explain some the performance difference between Windows and Linux. Also, the fact that you have an older version of Matlab on Linux could be a contributing factor.
One thing you could try is to run your code on an uncompressed video, assuming that you have enough disk space. At the very least that will tell you whether decoding the video is indeed the bottleneck.
Also, what are you using for reading the video? You can try the VideoReader object or the vision.VideoFileReader object in the Computer Vision System Toolbox.
  2 Comments
Dimitris Manousos
Dimitris Manousos on 9 Feb 2015
Thank you for your answer. Indeed the problem was on reading the encoded video. Reading an uncompressed video in both platforms Linux was the winner. The running speed on Linux was about 2 times faster than in Windows. This leads to the conclusion that the video codec plays significant role in video processing time.
Dima Lisin
Dima Lisin on 9 Feb 2015
You may also want to try different compression formats. Some may be faster to decode than others. For Linux, Motion Jpeg is usually the best bet.

Sign in to comment.

More Answers (1)

Jan
Jan on 4 Feb 2015
Without knowing any detail of the program it is impossible to give an advice. Perhaps it depends on a data file, which is read through a slow network connection. Or the problem doe not match into the RAM and slow swapping slows the computing down.
  1 Comment
Dimitris Manousos
Dimitris Manousos on 4 Feb 2015
The program reads a video file that exists in the same directory (not on a network) and performs some computer vision staff (i.e. face detection and tracking of features). The program is running on the same machine (i.e. hardware). Unfortunately I cannot find what causes this and my only solution maybe would be to make some benchs with the same code implemented on Matlab and OpenCV. If the OpenCV is running faster then I will switch into OpenCV and C++.
That's a pitty because the code is already implemented in Matlab.

Sign in to comment.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!