Borrar filtros
Borrar filtros

does parfor support global variables?

7 visualizaciones (últimos 30 días)
Sampath reddy
Sampath reddy el 24 de Mzo. de 2012
I want to use global variables in the functions run in parallel using parfor. Is it possible?

Respuestas (1)

Edric Ellis
Edric Ellis el 26 de Mzo. de 2012
There are two restrictions.
  1. You cannot place a GLOBAL declaration directly inside a PARFOR loop
  2. The MATLAB workers executing the body of your PARFOR loop are separate MATLAB processes, and the values of global variables are not synchronised
So, while you can use GLOBAL variables within functions called from the body of your PARFOR loop, they probably do not behave as you wish.

Categorías

Más información sobre Parallel for-Loops (parfor) en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by