yes, this is because the parfor optimizer overwrites this specification.
You could use either one of the following
1) "parfor(opt=NONE, par=1)" (disables optimization, uses defaults, and
overwrites the specified parameters)
2) "parfor(opt=CONSTRAINED, par=1)" (optimizes as usual under the
constraint of the specified parameters)
3) for() (since parfor is derived from for, you can always use for wherever
you can use parfor, useful for debugging)

Regards,
Matthias



From:   Deron Eriksson <[email protected]>
To:     [email protected]
Date:   02/12/2016 12:10 PM
Subject:        Turn off parallelism in parfor?



Hi,

Is it possible to turn off parallelism in a parfor loop using a function
parameter? I tried setting 'par' to 1.

If I print i in a for loop, the results come back in order:
     for (i in 1:5) { print(i) }
gives
    1
    2
    3
    4
    5

If I print i in a parfor loop (with par=1), the results don't come back in
order:
    parfor (i in 1:5, par=1) { print(i) }
gives (something similar to)
    4
    2
    5
    1
    3

Is par=1 (I tried par=0 too) turning off parallelism but the print output
isn't reflecting that?

Deron

Reply via email to