On Saturday, March 19, 2016 at 11:45:46 AM UTC-4, Brian Adkins wrote:
> I've put together a very simple (31 lines) example of parallel task execution 
> here:
> 
> https://gist.github.com/lojic/6cee4fcd4220e2788ece
> 
> The example contains a lot of boilerplate (only a few lines are specific to 
> the problem), so before I go about eliminating the boilerplate myself, I 
> thought I'd ask if this has already been done in a general and reusable way - 
> has it?
> 
> I'm fairly new to parallel programming in Racket, but thus far I seem to 
> encounter the same pattern repeatedly:
> 
> 1) Create a pair of place channels to allow sending units of work to parallel 
> workers and retrieving results
> 
> 2) Create one place per core which repeatedly grabs a unit of work from the 
> queue, calls a function with the unit of work, and places the result on the 
> queue
> 
> 3) Write all the units of work to the queue
> 
> 4) Retrieve all the results from the queue
> 
> It think this can all be boiled down to specifying:
> 1) The name of the function to do the work (line 4)
> 2) The list of units of work (line 23)
> 
> The rest of the example is generic.
> 
> Thanks,
> Brian

This example is probably clearer:

https://gist.github.com/lojic/d92bd1f537410f6dc4e9

It's shorter, and by using place/context, I eliminated a lot of cruft. All of 
main is now generic.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to