[mlpack-git] [mlpack/mlpack] LSHSearch Parallelization (#700)

Ryan Curtin notifications at github.com
Thu Jul 7 16:15:41 EDT 2016


> @@ -811,9 +841,18 @@ void LSHSearch<SortPolicy>::Search(const arma::mat& querySet,
>  
>    Timer::Start("computing_neighbors");
>  
> -  // Go through every query point sequentially.
> -  for (size_t i = 0; i < querySet.n_cols; i++)
> +  // Parallelization to process more than one query at a time.
> +  // use as many threads possible but not more than allowed number
> +  size_t numThreadsUsed = maxThreads;
> +  #pragma omp parallel for \
> +    num_threads ( numThreadsUsed )\
> +    shared(avgIndicesReturned, resultingNeighbors, distances) \
> +    schedule(dynamic)

Two questions---
 - Is the dynamic schedule the right one to use here?  My understanding was that the dynamic schedule had more overhead.  In this case it seems like the default static schedule would be just fine.
 - I think the `num_threads()` call here will effectively set the number of threads used to the value of the environment variable `OMP_NUM_THREADS`, but that would be the same as the default anyway if you hadn't set `num_threads()`.  So it makes me think that the `maxThreads` member is unnecessary (and the other supporting functionality).

---
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/700/files/c4c8ff950be8a06e06084764f188095c650b7a60#r69978282
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.cc.gatech.edu/pipermail/mlpack-git/attachments/20160707/4362414b/attachment-0001.html>


More information about the mlpack-git mailing list