2

I was using Matlab2012 under Win7 and my algorithm was consuming a huge amount of memory though it was fast (80 seconds for one iteration).

Now I am using Matlab2013 under Ubuntu 12.04 LTS and though the usage of the RAM is very small, but the time is extremely higher than it was on windows (30 minutes for the iteration and not finished untill now).

As I said the RAM is showing a usage of 1G out of 8G ...while the swap is showing 0% of 8G. I checked the default value and it is 60, but not used by anyhow!!

What might be the problem, and how to speed up Matlab the way it was before?

slm
  • 363,520
  • 117
  • 767
  • 871
  • Is this on the same hardware, just running different OSes on it? Also what does `top` show while your program is running? Other tools you can use are `vmstat` and `iostat` to watch the behavior of a running app. `vmstat` watches memory usage, `iostat` watches for disk and io usage. – slm Aug 01 '13 at 18:31
  • Yes it is the same hardware...8G RAM Intel Core i7-CPU 2.2 GHz×8. What is weired about the output of these tools is that no swap in or out at all although the default value is set to 60 as it should. – waleed shawki Aug 01 '13 at 19:05

2 Answers2

0

I had a similar problem, my Matlab R2013a 64 bit runs slower on Ubuntu 14.04 than Windows 7. The difference was so big, but the hardware etc was the same. I finally could find the answer.

Windows 7 scales the CPU frequency to its highest possible threshold when Matlab is running, but on Ubuntu it doesn't.

In order to configure Ubuntu to use the highest frequency possible, install the application "indicator-cpufreq" using the following command:

sudo apt-get install indicator-cpufreq

Then run the command:

indicator-cpufreq

From its menu, choose the "performance" option. It will change the frequency to the highest possible magnitude. Now Matlab runs in the same way as on Widows 7, the same speed.

Raphael Ahrens
  • 9,701
  • 5
  • 37
  • 52
Kamal
  • 1
  • I am not using ubuntu now, I am using another distro. Do you know the repository that I need to add in order to obtain this app?? – waleed shawki Jan 14 '15 at 16:26
0

There is a causal connection between slowness and low RAM usage. 99% of sort algorithms need some or a lot of memory.

Check out free command (and its man page and all what follows from that -- hard core, a bit). In your case you can even do free -g to get a synopsis in single digit units (in giga).

findmnt can show a line for hugepages, kind of additional memory driver:

/dev/hugepages hugetlbfs ... pagesize=2M

In your case (massive math stuff, usage observations) this should be turned on. But no direct relation to your problem, more an optimizing thing.

This should all happen by itself -- mathematica wants memory, the kernel gives it, no problem, that is what it is here for. There are no other memory hungry programs around.

I don't bother checking the versions you give, LTS?. Somewhere must be the problem. Either one version of matlab or ubuntu, or your installation, has a problem. Hope that helps. Just make sure everything is "up to date".

As soon as that 8 GB of memory (say 80% of it freely "available") get used, it will also speed up.

As for swap that does not matter here - should not matter - unless you want to optimize some crazy stuff. In general, in matlab, you would not want it to make the kernel start swapping.