Skip to content

Poor scaling on random scheduler #374

@Drup

Description

@Drup

I run a benchmark recently for parallel map on trees. It makes for an interesting embarrassingly parallel (recursive) task. The core function is the map_par_full function below:

open Picos

type 'a tree = N of 'a * 'a tree * 'a tree | L

let async e =
  let p = Computation.create () in
  let fiber = Fiber.create ~forbid:false p in
  Fiber.spawn fiber (fun _ -> Computation.return p @@ e ());
  p

let rec map_par_full f t = async @@ fun () -> match t with
  | L -> L
  | N (v , tl , tr ) ->
    let task_tl = map_par_full f tl in
    let task_tr = map_par_full f tr in
    N (f v,
       Computation.await task_tl,
       Computation.await task_tr)

I run this with Picos' and Moonpool's schedulers. Here are the results for a tree of size 10000 with medium-sized tasks on a Intel Xeon E5-2630 (so, 12 cores * 2 hyperthreading). Time is normalized to a non-async baseline.

Image

The two immediate conclusions are that

  1. Multithreading is crap on this workload (welp)
  2. The scaling for Picos' multififo is surprisingly good!
  3. The scaling for Picos' random scheduler seems ... buggy ? There's definitely some sort of issue there.

In general, given the embarrassingly parallel nature of the workload, I expected random to be much better than multififo, and this is not the case at all.

cc c-cube/moonpool#38 on the moonpool's bug tracker.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions