필터 지우기
필터 지우기

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

조회 수: 2 (최근 30일)
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))

답변 (2개)

Walter Roberson
Walter Roberson 2013년 1월 24일
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
Matt J
Matt J 2013년 1월 24일
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.

댓글을 달려면 로그인하십시오.


Jason Ross
Jason Ross 2013년 1월 24일
편집: Jason Ross 2013년 1월 24일
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

카테고리

Help CenterFile Exchange에서 MATLAB Parallel Server에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by