MATLAB Answers

Is it possible to have multiple MATLAB's on one computer?

197 views (last 30 days)
Ian Jessen
Ian Jessen on 14 Jan 2011
Commented: Walter Roberson on 10 Apr 2018
I do most of my work in MATLAB R2010a, but I was just given a MATLAB file that only works in R14sp3 or earlier. Can I install MATLAB R14sp3 on my computer without interfering with the R2010a version that I use all the time?

Accepted Answer

John
John on 14 Jan 2011
Yes. The installers for MATLAB are setup so that you can install multiple releases of MATLAB. On Windows & Mac, the installer does this automatically. For Linux this is done with R2010b and higher automatically. For older versions, you simply need to make sure the new installation is done into a new folder.
  2 Comments
Walter Roberson
Walter Roberson on 10 Apr 2018
The number of different versions you can install at the same time is limited by the number of different versions you can get installers for.
So that would probably be R13, R14SP1, and two versions per year from 2006 to 2017 (24 versions total) together with the current R2018a, for a total of 29 versions. Some of them might have to run in compatibility mode.
The number of versions you can install simultaneously is not related to the number of MATLAB sessions you can run simultaneously. You can add more MATLAB sessions until you run out of memory. For example on my Windows virtual machine with 100 Gb of swap, if my sessions were 2 Gb each, I could run 50 of them before swap got used up.
I highly recommend, however, that you do not run more sessions than will fit into RAM, as running from swap is typically very very very slow. Like 50 simultaneous sessions that would normally take 1 minute each but were running in swap might not finish within a month. So take RAM / (size of one session) as an upper bound on the number you start at the same time. Not that MATLAB cares, but MS Windows tries to make progress on all of the ones that are running and they will be competing for the one disk.
When you have hyperthreading enabled, the system does not run two processes simultaneously on the same core. Instead, it runs one process but keeps the other nearly ready, and as soon as the first one has anything to do other than compute (e.g., wait for memory to be available, or wait for I/O or an interruption) then it switches over to the second process in a somewhat efficient way. But there is internal cost to doing that that heats the core notably, so it is common for the operating system to reduce the cpu frequency when hyperthreading is active, to prevent overheating. Now, if you are doing heavy computation that does not need I/O, then there might not be many occasions when the process is ready for a break from actively using the CPU, so with the automatic reduction in frequency, you might end running everything slower than if you had just run the two processes one after another.
An active session needs a minimum of one active core at a time, and your system cannot have more cores simultaneously active than actually exist (the other 6 threads are on hot standby, ready to step in as soon as its companions pauses). So with your 6 physical cores, you cannot make progress on more than 6 sessions simultaneously.
If you are doing a lot of simple computation with large arrays, then on an idle system MATLAB would typically run a bunch of the computations through a high performance multiple threaded library that would use all of the cores simultaneously. For example to add a large vector of numbers it would divide the array up into 6 pieces, have one core add each of the 6 parts, and then add the 6 subtotals at the end. As you get into more complicated mathematics such as SVD, the work to be done on each core increases and the size of the array needed to trigger this behavior gets smaller.
Because of this behaviour of automatically using all available cores for more extensive computations, when you start up multiple sessions that are each wanting to do high performance mathematics, then the sessions generally compete with each other, so you do not necessarily gain anything in overall performance.
The kind of situation that can benefit from simultaneous computation is that you are doing simultaneous I/O to different busses or external hardware in each of the sessions -- or that you are running computations that take relatively little memory to describe (low memory transfer) and which use a lot of iterative code that cannot be vectorized and which does not happen to invoke any of the routines in the high performance libraries. In other situations you have a definite risk that the competition for resources ends up making everything slower.
It is quite common that when people use the Parallel Computing Toolbox facilities such as parfor, that they find that computation becomes slower rather than faster. There are some algorithms that do well in parallel and some which you are better off running in serial.

Sign in to comment.

More Answers (0)

Products

Community Treasure Hunt

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

Start Hunting!