<p>In <a href="https://github.com/mlpack/mlpack/pull/603#discussion_r58895238">src/mlpack/core/optimizers/parallel_sgd/sgdp_impl.hpp</a>:</p>
<pre style='color:#555'>> + {
> + it=1;
> + while(it!=maxIterations && halt != true)
> + {
> + it++;
> +
> + int th_num=omp_get_thread_num(); //thread number is stored in which the thread is running.
> + arma::mat gradient(iterate.n_rows, iterate.n_cols); //To make gradient private to each thread it is declared here.
> + int selectedFunction;
> +
> + selectedFunction=std::rand()%numFunctions;
> + function.Gradient(tIterate[th_num],selectedFunction, gradient);
> + tIterate[th_num] -= stepSize * gradient;
> +
> +
> + //checking whether or not it will go for tollerence checking
</pre>
<p>T is added to run each thread independently T iteration to increase speedup.<br>
Here I have Taken T as constant(1000).<br>
T can be a function of maxiteration, number of thread, current value of iteration. </p>
<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />You are receiving this because you are subscribed to this thread.<br />Reply to this email directly or <a href="https://github.com/mlpack/mlpack/pull/603/files/a981f8322e84ec06a349b80d261639a282f4f7c5#r58895238">view it on GitHub</a><img alt="" height="1" src="https://github.com/notifications/beacon/AJ4bFE1b0OHgPbeCd_2BLgBuFBuUgiwhks5p1ScSgaJpZM4H_54U.gif" width="1" /></p>
<div itemscope itemtype="http://schema.org/EmailMessage">
<div itemprop="action" itemscope itemtype="http://schema.org/ViewAction">
<link itemprop="url" href="https://github.com/mlpack/mlpack/pull/603/files/a981f8322e84ec06a349b80d261639a282f4f7c5#r58895238"></link>
<meta itemprop="name" content="View Pull Request"></meta>
</div>
<meta itemprop="description" content="View this Pull Request on GitHub"></meta>
</div>