Borrar filtros
Borrar filtros

Questions about the parfor function

1 visualización (últimos 30 días)
ma Jack
ma Jack el 4 de Jul. de 2022
Comentada: Walter Roberson el 5 de Jul. de 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.

Respuesta aceptada

Rik
Rik el 4 de Jul. de 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 comentarios
ma Jack
ma Jack el 5 de Jul. de 2022
Thank you sir, I will verify it after a while
Walter Roberson
Walter Roberson el 5 de Jul. de 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.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Parallel Computing Fundamentals en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by