use all cores in parfor loop

3 vues (au cours des 30 derniers jours)
arnaud ensberg
arnaud ensberg le 31 Jan 2016
please;
how can I do to use all cores in parfor loop
feature('numCores')
MATLAB detected: 2 physical cores.
MATLAB detected: 4 logical cores.
MATLAB was assigned: 4 logical cores by the OS.
MATLAB is using: 2 logical cores.
MATLAB is not using all logical cores because hyper-threading is enabled.
ans =
2
should i disable a hyper-threading to do this ?

Réponses (1)

Walter Roberson
Walter Roberson le 1 Fév 2016
If you were to disable hyperthreading then your system would have 2 cores available, the two physical cores. That is the same number as MATLAB is giving you with hyperthreading turned on. There would be no advantage to turning hyperthreading off.
Your system only has two physical cores. Hyperthreading is a mechanism that allows one physical core to be used by two processes at the same time, with one of the processes automatically be allowed to run when the other process has to momentarily wait for something such as reading from disk. It is a task switching mechanism that is like normal time sharing mechanisms, except that it happens to have some hardware support so it has less overhead. But using it effectively depends on the main process not using the whole computing capacity of the core due to outside interactions. When you are running a heavy MATLAB calculation that fits entirely in memory, there is no spare computing capacity for the core, so the second process on the core would only get time by stealing it from the main process. That is not any more efficient.

Catégories

En savoir plus sur Loops and Conditional Statements dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by