[mlpack-git] [mlpack/mlpack] parallel sgd (#603)
ranjan
notifications at github.com
Thu Apr 7 16:04:07 EDT 2016
> + sumIterate.zeros();
> +
> +
> +
> + #pragma omp parallel shared(sumIterate,halt) private(it)
> + {
> + 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;
I think std::rand() is std::rand() is thread safe.
I have written a sample prog to test it.
https://github.com/ranjan1990/random_dumb/blob/master/output.
I have 4 cores and each row of this matrix is for each thread.
I got distribution is uniform in each row. So I think std::rand() is threadsafe.
---
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/a981f8322e84ec06a349b80d261639a282f4f7c5#r58935491
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.cc.gatech.edu/pipermail/mlpack-git/attachments/20160407/df5f67e5/attachment.html>
More information about the mlpack-git
mailing list