title: Calculating the sum of a large vector in parallel
body: <h2>Problem background</h2>
  
  <p>I have a program that currently takes way too long to sum up large <code>std::vector</code>s of ~100 million elements using <code>std::accumulate</code>, and this is a bottleneck.</p>
  
  <p>I want it to be faster and I want it to be an asynchronous calculation so the GUI/Server doesn't block. The calculation should also be using <em>multithreading</em> so I can reduce the time it takes to sum up a vector.</p>
  
  <p>I want to split up the summation so that each thread sums a part of the vector and then when all partial sums are calculated, each thread's partial sum should be added together to get the total summation.</p>
  
  <h2>Boost.Asio?</h2>
  
  <p>I was wondering how I could go about this in <strong>Boost.Asio</strong>? My program ideally needs to reuse the threads (like a <em>thread group</em>), not sure how store and retrieve the partials sums and finally retrieve the sum of the partial sums.</p>
  
  <p>I was thinking of creating a thread group which call <code>boost::asio::io_service::run</code>, passing a handler to compute the partial sums, but I'm not sure how to pass the partials sums to another handler and add all the partial sums together.</p>
  
  <p>It would be great if someone showed some skeleton code of how I can go about this.</p>