You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@systemml.apache.org by Deron Eriksson <de...@gmail.com> on 2016/02/12 21:09:43 UTC

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

Re: Turn off parallelism in parfor?

Posted by Matthias Boehm <mb...@us.ibm.com>.
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 <de...@gmail.com>
To:	dev@systemml.incubator.apache.org
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