std.parallelism changes done

dsimcha dsimcha at yahoo.com
Thu Mar 24 06:28:12 PDT 2011


On 3/24/2011 3:23 AM, bearophile wrote:
> dsimcha:
>
>> and apologize for getting defensive at times.
>
> It happens to mammals, don't worry.
>
>
>> The new docs are at
>> http://cis.jhu.edu/~dsimcha/d/phobos/std_parallelism.html .
>
>>     real getTerm(int i) {
>>         immutable x = ( i - 0.5 ) * delta;
>>         return delta / ( 1.0 + x * x ) ;
>>     }
>>     immutable pi = 4.0 * taskPool.reduce!"a + b"(
>>         std.algorithm.map!getTerm(iota(n))
>>     );
>
> For the examples I suggest to use q{a + b} instead of "a + b".

I tried to keep it as consistent as possible with std.algorithm.
>
> When D will gain a good implementation of conditional purity, I think taskPool.reduce and taskPool.map may accept only pure functions to map on and pure iterables to work on.

Eventually, maybe.  Definitely not now, though, because in practice it 
would severely affect usability.

> In the module documentation I'd like to see a graph that shows how the parallel map/reduce/foreach scale as the number of cores goes to 1 to 2 to 4 to 8 (or more) :-)

Unfortunately I don't have access to this kind of hardware except at work.


More information about the Digitalmars-d mailing list