|
Boost Users : |
Subject: Re: [Boost-users] [mapreduce] Prim Calculator
From: Christian Henning (chhenning_at_[hidden])
Date: 2009-08-22 14:15:09
Craig,
>>
>> Well, it all compiles and runs but the results is empty. I have
>> intercepted the reduce function and the supplied list is correct.
>> Meaning all primes are in there. Weird. Dunno what's wrong here.
>
> Did you try defining the job to write the results to file? This will work
> until I fix the iterator issue.
Yes, I'm using reduce_file_output. But all files are empty. Can you
reproduce that? Please make sure to get the latest from my subversion.
>
> A small optimization in the is_prime is to check for %2 - this avoids
> expensive sqrt & loops for even numbers that are always not prime
>
> bool const is_prime(long const number)
> {
> if (number == 0 || number == 1)
> return false;
> else if (number == 2)
> return true;
> else if (number%2 == 0)
> return false;
> ...
> }
Thanks. ;-) Most important for me right now is to learn how to solve
problems with mapreduce. Ideas for some other problems?
Christian
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net