TransWikia.com

slow Matlab on Ubuntu LTS and ZERO Swap

Unix & Linux Asked by waleed shawki on November 18, 2021

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?

2 Answers

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.

Answered by user373503 on November 18, 2021

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.

Answered by Kamal on November 18, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP