Matlab running slower on Linux than Windows 7

조회 수: 16 (최근 30일)
Katherine
Katherine 2018년 3월 2일
댓글: Walter Roberson 2018년 3월 6일
I am having a problem running a piece of code with Matlab 2014a with a Ubuntu 16.04 installation. The computer running Ubuntu performs worse than my laptop running Windows 7, in that the same piece of code takes over twice as long to run on the computer with Ubuntu (~ 50 minutes for computer with Ubuntu, 23 minutes for laptop with Windows) for reasons that I don't understand. There are no differences in the code between comparisons.
The hardware for the computer with Ubuntu is an intel core i7-4770 cpu @ 3.4 GHz (8 cores) with 32 Gb of ram. The hardware for the laptop running Windows 7 is an intel core i5-3427U cpu @ 1.8 GHz (4 cores) with 4 Gb of ram.
The benchmark results for the laptop with Windows 7 is not great:
While the benchmark results for the computer with Ubuntu are much better:
I did try increasing the Java heap memory to see if this would speed things up on the ubuntu computer. I also tried increasing the process priority with the command "renice" but that didn't change anything. My complaint is that the computer running Ubuntu takes much longer to run the same code, but I don't have any errors or anything else to go off of besides comparing run times. I'm quite confused as to why I see worse performance with a more powerful machine, and I would appreciate any insight or help with the problem, thanks!
  댓글 수: 5
Katherine
Katherine 2018년 3월 4일
That is good to know, thank you for the information! But I agree that I don't think this explains the differences in run-time...
Benjamin Kraus
Benjamin Kraus 2018년 3월 5일
What version of MATLAB are you running on both machines? There are been a lot of performance optimizations, so if Windows 7 is running the newer version of MATLAB, that could explain the difference.

댓글을 달려면 로그인하십시오.

채택된 답변

Philip Borghesani
Philip Borghesani 2018년 3월 5일
You appear to be running different versions of MATLAB on the two machines (the list of reference computers is different in you bench output). That could easily explain the difference, especially if the Windows machine is running R2015b or later because of better optimizations.
  댓글 수: 2
Katherine
Katherine 2018년 3월 6일
Yes this comment and the last comment on the previous answer are are correct; the computer with Ubuntu was running Matlab 2014a while the windows machine was running Matlab 2016a. Installing a trial version of 2017b on the machine with Ubuntu solves this problem and runs in half the time as the windows machine, which is about what I expected...
Out of curiosity, the profiler found that 50% more time was spent on a if conditional called each iteration for the Ubuntu machine running 2014a. I know that if statements can be slow but how do the "better optimizations" change this? (I know that's a broad question, but it would help to know for writing future code what optimizations would cause a if conditional to run faster with Matlab...)
Walter Roberson
Walter Roberson 2018년 3월 6일
Generally speaking, vectorized test and application of operation along a mask is typically faster than looping with conditional.
However this is not always the case: processing the memory needed to vectorize tests can end up costing more than you save.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Startup and Shutdown에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by