rparallel :   Racket in parallel
1 Introduction
2 Interface
parallel-values
parallel-for-each
parallel-let
parallel-map
7.8

rparallel : Racket in parallel

Francesco Montanari

License: LGPL-3.0-or-later

 (require rparallel) package: rparallel

1 Introduction

This package provides high-level parallel forms.

The implementation relies on Racket futures. Due to coordination overhead the library is only useful to parallelize computationally instensive code. For instance, consider the following:

(parallel-map sqrt (range 1000000))

Here the parallel form creates several futures whose overhead vastly prevails over the relatively cheap sqrt operation. This leads to a much slower computation than the respective serial map call. To take advantage from multiple processor, larger chunks of computation needs to be distributed over fewer futures, for instance:

(parallel-let ((x (map sqrt (range 1000)))
               (y (map sqrt (range 1000) (range 1000000))))
              (append x y))

See Parallelism with Futures for further subtleties related to the use of futures with the regular Racket BC (before Chez Scheme) variant.

2 Interface

syntax

(parallel-values v ...)

Like values, but evaluates each v in parallel.

procedure

(parallel-for-each proc lst ...+)  void?

  proc : procedure?
  lst : list?
Like for-each, but proc calls are in parallel.

syntax

(parallel-let ([id val-expr] ...) body ...+)

Like let, but all the expressions for the bindings are evaluated in parallel.

procedure

(parallel-map proc lst ...+)  list?

  proc : procedure?
  lst : list?
Like map, but proc calls are in parallel.

See pmap : Parallel map for alternative parallel map procedures that leverage both Racket futures and places forms of parallelism.