Template error and parallel foreach bug?

2011-06-04 Thread simendsjo
I just found Project Euler, and tried to solve the first problem. https://gist.github.com/1007840 I did four implementations: template, ctfe, parallel foreach and parallel map. The template implementation works on low numbers, but not on 1000 (haven't checked when it fails). It gives me the f

Re: Template error and parallel foreach bug?

2011-06-04 Thread simendsjo
On 04.06.2011 14:02, simendsjo wrote: The template implementation works on low numbers, but not on 1000 (haven't checked when it fails). It gives me the following error: euler1.d(23): Error: template instance euler1.SumMultiple3Or5(499LU,Below,57918LU) recursive expansion Ehem.. Guess it fails

Re: Template error and parallel foreach bug?

2011-06-04 Thread Timon Gehr
I just found Project Euler, and tried to solve the first problem. https://gist.github.com/1007840 simendsjo wrote: > I did four implementations: template, ctfe, parallel foreach and > parallel map. > > The template implementation works on low numbers, but not on 1000 > (haven't checked when it fail

Re: Template error and parallel foreach bug?

2011-06-04 Thread simendsjo
On 04.06.2011 20:04, Timon Gehr wrote: ulong SumMultiple3Or5_parallel(uint below) { ulong sum; foreach(i; parallel(iota(below))) { if(i % 3 == 0 || i % 5 == 0) sum += i; // low level data race here. } return sum; } Loop iterations in a parallel foreach l

Re: Template error and parallel foreach bug?

2011-06-04 Thread Ben Grabham
On 04/06/11 20:16, simendsjo wrote: On 04.06.2011 20:04, Timon Gehr wrote: ulong SumMultiple3Or5_parallel(uint below) { ulong sum; foreach(i; parallel(iota(below))) { if(i % 3 == 0 || i % 5 == 0) sum += i; // low level data race here. } return sum; } Loop iterations in a parallel foreach loop m

Re: Template error and parallel foreach bug?

2011-06-04 Thread Ben Grabham
On 05/06/11 03:55, Ben Grabham wrote: On 04/06/11 20:16, simendsjo wrote: On 04.06.2011 20:04, Timon Gehr wrote: ulong SumMultiple3Or5_parallel(uint below) { ulong sum; foreach(i; parallel(iota(below))) { if(i % 3 == 0 || i % 5 == 0) sum += i; // low level data race here. } return sum; } Loop

Re: Template error and parallel foreach bug?

2011-06-06 Thread Steven Schveighoffer
On Sat, 04 Jun 2011 08:11:01 -0400, simendsjo wrote: On 04.06.2011 14:02, simendsjo wrote: The template implementation works on low numbers, but not on 1000 (haven't checked when it fails). It gives me the following error: euler1.d(23): Error: template instance euler1.SumMultiple3Or5(499LU,B