Boost logo

Boost Users :

Subject: Re: [Boost-users] [mapreduce] Prim Calculator
From: Craig Henderson (cdm.henderson_at_[hidden])
Date: 2009-08-19 18:18:43


> I'm not sure if boost user list should be used for boost-sandbox
libraries. Anyone?
Yes, very appropriate IMHO

> Now, I would like create a new example for the mapreduce lib.
Thanks, I appreciate contributions from users.

> How can
> I, for instance, setup a system that computes the prim numbers for 0
> to 1,000,000,000.
I'm assuming here that you don't need help with the algorithm, just how to
use the library...

> For this, I need to create the input for the map
> function on the fly, rather than reading some files from the hard
> drive. How is that possible?
You'll need to write a "datasource" policy and supply it as the 4th template
parameter of your mapreduce::job<> type.

The datasource only needs to implement two public member functions:
    bool const setup_key(typename MapTask::key_type &key) const;
    bool const get_data(typename MapTask::key_type &key, typename
MapTask::value_type &value) const;

setup_key() is called by the library to return a key for the next map task
to be run, and returns false when there is no more data to map.
get_data() is called by the library to get retrieve the "value" data for a
given key (previously returned from setup_key). The return value here is a
traditional success/fail code and false will terminate the map task.

> The documentation is a bit spare so far.
Yes, definitely work in progress. The Reference is not yet written

Thanks for your interest in my library.
-- Craig


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