Effacer les filtres
Effacer les filtres

Questions about the parfor function

1 vue (au cours des 30 derniers jours)
ma Jack
ma Jack le 4 Juil 2022
Commenté : Walter Roberson le 5 Juil 2022
Hi all,
Is there a way to make the parfor function faster here? My cpu has six physical cores, but it is 12 threads, every parallel calculation matlab shows is connected to 6 works, is there any way to make it connected to 12 works?I want the program to become faster.

Réponse acceptée

Rik
Rik le 4 Juil 2022
You can change your settings as described on this doc page. You can also explicitly call the parpool function.
Note that it might not actually speed up your code, as each worker increases overhead and hyperthreaded cores are not always 'complete' cores (so the actual circuitry required for the calculation might be shared by two threads).
It is also not a guarantee that your code will actually be faster with a parfor loop. For more about this point, see this doc page.
  2 commentaires
ma Jack
ma Jack le 5 Juil 2022
Thank you sir, I will verify it after a while
Walter Roberson
Walter Roberson le 5 Juil 2022
hyperthreads work well when a process needs to do I/O: when a process volunteers to give up the CPU then another process is immediately ready to take over.
However, except in very limited circumstances, only one of the two hyperthreads per core can compute anything at a time, and the process executing has to volunteer to give up the core for the other hyperthread to proceed. In compute-heavy cases such as MATLAB computation, hyperthreads can end up slowing down computation.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Parallel Computing Fundamentals dans Help Center et File Exchange

Tags

Produits


Version

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by