Wednesday 15 May 2013

scheme - How to map a function over a list in parallel in racket? -


The title of the question is called to everyone, in fact: what is the best way of a function in the parallel list in the racket? Thank you.

If you mean more than multiple processor cores, then the most common approach is to use.

The location enables the development of parallel programs that take advantage of machines with many processor, core or hardware threads.

A place is a parallel task that is effectively a different example. Racket virtual machine is the communication between place-and-place channels, which are end-points for two-way buffered communication.

You probably may be able to use other parallel technologies, but the conditions


edit : In response to comment

P> Is there any implementation of parallel map using places?

First of all, I should back up myself. You may not need a place You can get concurrency by using racket threads. For example, here is a map / thread :

  #lang racket (define (map / thread f xs);; one channel for each element of xs Create a thread for every elemnet of each thread call (Fx) and its results to the channel (for the ([(x [x]) (for the ([x xs] Xx] [c cs]) (thank (channel-put c (fx)) ;; get results from each channel ;;; NOTE: This will be block on each channel if ready yet No. / List ([C-CS]) (Channel-Mill C)) ;; Use: (define xs' (1 2 3 4 5)) (map add1 xs) (map / thread add1 xs)   

If work is being done then blocked Includes doing, e.g. I / O requests, this will give you context of "Equality" in relation to not being connected to I / O. Although racket threads are "green" threads, so only one CPU will be used at a time.

If you really need parallel access to several CPU cores, you will need futures or space.

In the manner of implementation of the place - effectively as many examples of the racket --- I do not see immediately to write a normal map / location "Bespoke" For examples of using places on the go, see:



No comments:

Post a Comment