OK, following up:

I have a function that calculates Dijkstra shortest paths for a vector of 
source vertices and will return a DijkstraState object for each vertex. 
This function runs in 15 seconds over 500 vertices on one thread.

I wrote a function to split the source vertices into N different 
equal-sized* vectors and use pmap() to run each "chunk" in a separate 
thread. This new function takes 4x as long as the single thread on my 
4-core machine. Activity monitor shows each core running at about 50% for a 
little while, then cores 3 and 4 drop to zero.

Code is here: https://gist.github.com/sbromberger/93e503ab3ea87a5a1630

I can't figure out why parallelizing this code results in a time increase. 
The graph is large (about 8 gigs) but it's read-only for this function. Any 
advice would be greatly appreciated as I'd love to be able to scale this to 
100+ cores at some point.


On Saturday, August 29, 2015 at 7:33:45 PM UTC-7, Seth wrote:
>
> Thanks.  Dijkstra is defined, but the shared array is probably an issue. 
> Is there a way to parallelize this?

Reply via email to