Boost logo

Boost :

Subject: Re: [boost] [parallel_sort] Proposal
From: Edouard A. (edouard_at_[hidden])
Date: 2009-02-02 14:02:34


> > Howdy,
> >
> >
> > If you don't care to customize, no problem! Just write:
> >
> >
> >
> > parallel_sort<2>(v.begin(), v.end()); // sort with 2 threads
>
> Does templating on the number of threads produce a large gain, as
> opposed to making it a run-time option? Having to compile separate
> executables for different numbers of cores seems a bit limiting.

You can write a runtime wrapper if needed:

parallel_runtime(Iterator first, Iterator last, int threads)
{
        switch(threads)
        {
        case 2:
                parallel_sort<2>(first, last);
                break;
        // etc.
        }
}

I haven't benchmarked against a runtime option, I did a template parameter
as it felt more natural to me to make this a compile time parameter rather
than a runtime parameter.

-- 
EA

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk