$\newcommand{\W}[1]{ \; #1 \; } \newcommand{\R}[1]{ {\rm #1} } \newcommand{\B}[1]{ {\bf #1} } \newcommand{\D}[2]{ \frac{\partial #1}{\partial #2} } \newcommand{\DD}[3]{ \frac{\partial^2 #1}{\partial #2 \partial #3} } \newcommand{\Dpow}[2]{ \frac{\partial^{#1}}{\partial {#2}^{#1}} } \newcommand{\dpow}[2]{ \frac{ {\rm d}^{#1}}{{\rm d}\, {#2}^{#1}} }$
Set Up Multi-threading Sum of 1/i

Syntax
ok = harmonic_setup(num_sum) 
Purpose
This routine does the setup for splitting the summation that defines the harmonic series $$1 + 1/2 + 1/3 + ... + 1/n$$ into separate parts for each thread.

It is assumed that this function is called by thread zero, and all the other threads are blocked (waiting).

num_sum
The argument num_sum has prototype       size_t num_sum  It specifies the value of $n$ in the summation.

Source

namespace {
bool harmonic_setup(size_t num_sum)
{     // sum = 1/num_sum + 1/(num_sum-1) + ... + 1
//
{     // allocate separate memory for this thread to avoid false sharing
size_t min_bytes(sizeof(work_one_t)), cap_bytes;
//
// in case this thread's worker does not get called
// parameters that define the work for this and previous thread
}