[mlpack-git] [mlpack/mlpack] parallel sgd (#603)
ranjan
notifications at github.com
Thu Apr 7 07:59:30 EDT 2016
> + #pragma omp parallel shared(sumIterate,halt) private(it)
> + {
> + it=0;
> + 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;
> +
> +
> + #pragma omp barrier //wait untill all the threads reach here
Not needed!
---
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/mlpack/mlpack/pull/603/files/1bb4efe93db25ae1d1f36c765b4b16b46cdc0c7c..39c317571e2014f017d648ae72f586c8b0148069#r58859113
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.cc.gatech.edu/pipermail/mlpack-git/attachments/20160407/a3894ed1/attachment.html>
More information about the mlpack-git
mailing list