Can I run multiple instances (say, 2) of matlab independently on the same computer, all using parfor and (ideally) different cores?
160 views (last 30 days)
Show older comments
I have many cores (say 20), but some scripts only require a fraction (say 6). Does it make sense to run multiple scripts in different matlab instances? What do I need to look out for so they do not bog each other down?
0 Comments
Accepted Answer
Walter Roberson
on 15 Jun 2021
Yes, this is something that can be reasonable to do.
What you would want to watch out for is not using more total cores than physical cores you have (with hyperthreading turned off), minus one for your OS to do all its background tasks like checking email. (And if you are using Windows, minus another one to pay the Microsoft Tax.)
Splitting a system with a number of cores to do different independent tasks is the basis of running "supercomputer" servers with Distributed Computing; https://www.mathworks.com/products/matlab-parallel-server.html . But since it is all local to you, you might at most want to create multiple parallel profiles.
2 Comments
Florian
on 14 Jun 2023
Thank you Walter!
If I might tag onto this question: I have a local computer with 28 cores that I want to use simultaneously with a colleague. We both have individual academic licences.
If we both run parallel pools in separate windows user accounts (and separate Matlab instances) I run into problems where workers cannot locate files to write into using fprintf.
However, if I run two parallel pools in separate Matlab instances in the same windows user account, this problem does not occur.
Do you have any insights into why this might be happening? To put it amateurishly, does Matlab "not see" parallel pools created by other user accounts?
More Answers (1)
Matt J
on 15 Jun 2021
Edited: Matt J
on 15 Jun 2021
Does it make sense to run multiple scripts in different matlab instances?
No, that would be a reinvention of what the Parallel Computing Toolbox already does for you, but requiring more manual work on your part. Just run all the scripts in the same Matlab instance, but in parallel, e.g., using parFeval. Let the toolbox worry about scheduling the cores.
See Also
Categories
Find more on Parallel Computing Fundamentals in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!