www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Problem with parallel map

reply Russel Winder <russel russel.org.uk> writes:
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

David,

I am not sure how properly to report this in this review period . . .=20

If I use:

	taskPool.reduce ! ( "a + b" ) ( 0.0 , outputData )=20

then it works.  If however I try:

        taskPool.reduce ! ( ( a , b ) { return a + b ; } ) ( 0.0 , outputDa=
ta )=20

I get:

        pi_d2_parallelMap.d(58): Error: template instance cannot use local =
'__dgliteral1(__T2,__T3)' as parameter to non-global template reduce(functi=
ons...)

which doesn't really work for me :-((

If I try

	taskPool.reduce ! ( function double ( double a , double b ) { return a + b=
 ; } ) ( 0.0 , outputData )=20

then I get:

        pi_d2_parallelMap.d(59): Error: function std.parallelism.__funclite=
ral1 cannot access frame of function pi_d2_parallelMap.execute.__funclitera=
l1
        pi_d2_parallelMap.d(59): Error: function std.parallelism.__funclite=
ral1 cannot access frame of function pi_d2_parallelMap.execute.__funclitera=
l1

which is just the error I get with the sequential map and so a compiler
problem, I just added it for completeness.

Thanks.

--=20
Russel.
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D
Dr Russel Winder      t: +44 20 7585 2200   voip: sip:russel.winder ekiga.n=
et
41 Buckmaster Road    m: +44 7770 465 077   xmpp: russel russel.org.uk
London SW11 1EN, UK   w: www.russel.org.uk  skype: russel_winder
Mar 06 2011
next sibling parent dsimcha <dsimcha yahoo.com> writes:
http://d.puremagic.com/issues/show_bug.cgi?id=5710

It's a DMD issue.  I've been meaning to report it for a while. 
Unfortunately making a workaround for it would be a huge PITA at best 
and impossible in the toughest use cases.

On 3/6/2011 9:12 AM, Russel Winder wrote:
 David,

 I am not sure how properly to report this in this review period . . .

 If I use:

 	taskPool.reduce ! ( "a + b" ) ( 0.0 , outputData )

 then it works.  If however I try:

          taskPool.reduce ! ( ( a , b ) { return a + b ; } ) ( 0.0 , outputData
)

 I get:

          pi_d2_parallelMap.d(58): Error: template instance cannot use local
'__dgliteral1(__T2,__T3)' as parameter to non-global template
reduce(functions...)

 which doesn't really work for me :-((

 If I try

 	taskPool.reduce ! ( function double ( double a , double b ) { return a + b ;
} ) ( 0.0 , outputData )

 then I get:

          pi_d2_parallelMap.d(59): Error: function
std.parallelism.__funcliteral1 cannot access frame of function
pi_d2_parallelMap.execute.__funcliteral1
          pi_d2_parallelMap.d(59): Error: function
std.parallelism.__funcliteral1 cannot access frame of function
pi_d2_parallelMap.execute.__funcliteral1

 which is just the error I get with the sequential map and so a compiler
 problem, I just added it for completeness.

 Thanks.

Mar 06 2011
prev sibling next sibling parent Russel Winder <russel russel.org.uk> writes:
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

On Sun, 2011-03-06 at 09:33 -0500, dsimcha wrote:
 http://d.puremagic.com/issues/show_bug.cgi?id=3D5710
=20
 It's a DMD issue.  I've been meaning to report it for a while.=20
 Unfortunately making a workaround for it would be a huge PITA at best=20
 and impossible in the toughest use cases.

OK, I signed up to the issue, but there seems no way of voting for it to try and raise its chance of being fixed. Despite my personal dislike of this use of string to write functions, I can live with it in this case, so I am not worried about a workaround in std.parallelism -- though a DMD fix would be good. Thanks.
 On 3/6/2011 9:12 AM, Russel Winder wrote:
 David,

 I am not sure how properly to report this in this review period . . .

 If I use:

 	taskPool.reduce ! ( "a + b" ) ( 0.0 , outputData )

 then it works.  If however I try:

          taskPool.reduce ! ( ( a , b ) { return a + b ; } ) ( 0.0 , out=


 I get:

          pi_d2_parallelMap.d(58): Error: template instance cannot use l=


unctions...)
 which doesn't really work for me :-((

 If I try

 	taskPool.reduce ! ( function double ( double a , double b ) { return a=


 then I get:

          pi_d2_parallelMap.d(59): Error: function std.parallelism.__fun=


iteral1
          pi_d2_parallelMap.d(59): Error: function std.parallelism.__fun=


iteral1
 which is just the error I get with the sequential map and so a compiler
 problem, I just added it for completeness.

 Thanks.


--=20 Russel. =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D Dr Russel Winder t: +44 20 7585 2200 voip: sip:russel.winder ekiga.n= et 41 Buckmaster Road m: +44 7770 465 077 xmpp: russel russel.org.uk London SW11 1EN, UK w: www.russel.org.uk skype: russel_winder
Mar 06 2011
prev sibling parent "Robert Jacques" <sandford jhu.edu> writes:
On Sun, 06 Mar 2011 09:33:05 -0500, dsimcha <dsimcha yahoo.com> wrote:

 http://d.puremagic.com/issues/show_bug.cgi?id=5710

 It's a DMD issue.  I've been meaning to report it for a while.  
 Unfortunately making a workaround for it would be a huge PITA at best  
 and impossible in the toughest use cases.

I've run into this problem with regular map as well. I did submit a work-around patch for phobos which copied the delgate instead of sending it through via an alias, which seemed to work.
Mar 06 2011