Azzera filtri
Azzera filtri

How to run MATLAB (or execute some algorithm) on specific number of cores on a computer?

2 visualizzazioni (ultimi 30 giorni)
Hello,
I am trying to study the performance (in terms of execution time) of my some algorithm by varying the number of cores to be used on my machine. Any pointers, how to do it?
Thanks in advance.
PS: (I have a 16 core machine in the dept (OS:Red Hat, MATLAB 2011 a))

Risposte (2)

Walter Roberson
Walter Roberson il 24 Gen 2013
Make sure that hardware hyperthreading is off. Then use matlabpool() with the number of cores you want.
Watch out for a core being used by the operating system for whatever (e.g., virus checking).
  1 Commento
Matt J
Matt J il 24 Gen 2013
matlabpool sets the number of workers. I'm not sure that guarantees that each worker will be assigned a single core. On a 16-core machine, I suspect that a pool of 4 workers would get 4 cores each, for example.

Accedi per commentare.


Jason Ross
Jason Ross il 24 Gen 2013
Modificato: Jason Ross il 24 Gen 2013
A matlabpool will give you a number of worker processes, with a single computational thread each. The actual placement of workers is left up to the operating system, so there's not a guarantee which core will recieve which process.
It would be much easier to vary the number of MATLAB workers in your matlabpool and chart execution time as the number changes if you are using an algorithm that can be parallelized. For an example, see Benchmarking A\b
If you aren't using something that can be parallelized, you might want to try varying the maxNumCompThreads setting.
As with any benchmarking or performance analysis, take care to minimize variables that can cause variation. In general, I find it most useful to have all of the resources local to the machine under test as possible. This eliminates networking latency, which depending on the speed of your network and storage infrastucture, can introduce enormous variations into your results. It's also worth taking the time to repeat runs, as well -- and have run times that are long enough to be meaningful.
In addition to CPU performance, you also likely want to keep an eye on memory utilization, network utilization, and disk performance to fully understand why your algorithm may perform differently under different circumstances.
There is also an interesting paper on the File Exchange on this topic: http://www.mathworks.com/matlabcentral/fileexchange/18510-matlab-performance-measurement

Categorie

Scopri di più su MATLAB Parallel Server in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by