diff --git a/docs/01-intro-to-parallelism-part-1.md b/docs/01-intro-to-parallelism-part-1.md index b147553..559db52 100644 --- a/docs/01-intro-to-parallelism-part-1.md +++ b/docs/01-intro-to-parallelism-part-1.md @@ -267,7 +267,7 @@ of parallelism. It is also passed to the tasks so that they can spawn sub-tasks. To run `add4`, we need to get our hands on a *scheduler,* a component that takes in all the tasks that we want to run, decides how to dole them out into domains, and tracks who is waiting for what to be computed. Each scheduler is provided by -a library. For this tutorial, we'll use `parallel.scheduler.work_stealing`, +a library. For this tutorial, we'll use `parallel.scheduler`, which implements the popular [work-stealing] strategy. [work-stealing]: https://en.wikipedia.org/wiki/Work_stealing @@ -281,7 +281,7 @@ for details). let test_add4 par = add4 par 1 10 100 1000 let run_one_test ~(f : Parallel.t @ local -> 'a) : 'a = - let module Scheduler = Parallel_scheduler_work_stealing in + let module Scheduler = Parallel_scheduler in let scheduler = Scheduler.create () in let monitor = Parallel.Monitor.create_root () in let result = Scheduler.schedule scheduler ~monitor ~f in @@ -302,7 +302,7 @@ This uses a work-stealing scheduler, but you can also use the `parallel` library's own `Parallel.Scheduler.Sequential`, which simply runs everything on the primary domain. This is handy for testing or debugging when you want to eliminate nondeterminism. To do so, simply replace -`Parallel_scheduler_work_stealing` with `Parallel.Scheduler.Sequential` in +`Parallel_scheduler` with `Parallel.Scheduler.Sequential` in `run_one_test`. ## Averaging over binary trees diff --git a/docs/02-intro-to-parallelism-part-2.md b/docs/02-intro-to-parallelism-part-2.md index f5ec3ec..d280cbb 100644 --- a/docs/02-intro-to-parallelism-part-2.md +++ b/docs/02-intro-to-parallelism-part-2.md @@ -255,12 +255,12 @@ Since each task can only access a separate portion of the array—and the slices are `local`, so don't escape—this is safe. To run our parallel quicksort, we need to get an implementation of parallelism -from a scheduler. For example, using `Parallel_scheduler_work_stealing`: +from a scheduler. For example, using `Parallel_scheduler`: ```ocaml let quicksort ~scheduler ~mutex array = let monitor = Parallel.Monitor.create_root () in - Parallel_scheduler_work_stealing.schedule scheduler ~monitor ~f:(fun parallel -> + Parallel_scheduler.schedule scheduler ~monitor ~f:(fun parallel -> let array = Par_array.of_array array in (* ^^^^^ *) (* This value is contended but expected to be uncontended. *) @@ -275,7 +275,7 @@ assures that our caller is not mutating it in parallel. ```ocaml let quicksort ~scheduler ~mutex array = let monitor = Parallel.Monitor.create_root () in - Parallel_scheduler_work_stealing.schedule scheduler ~monitor ~f:(fun parallel -> + Parallel_scheduler.schedule scheduler ~monitor ~f:(fun parallel -> Capsule.Mutex.with_lock mutex ~f:(fun password -> Capsule.Data.iter array ~password ~f:(fun array -> let array = Par_array.of_array array in @@ -369,7 +369,7 @@ page](../../parallelism/02-capsules). ```ocaml let filter ~scheduler ~mutex image = let monitor = Parallel.Monitor.create_root () in - Parallel_scheduler_work_stealing.schedule scheduler ~monitor ~f:(fun parallel -> + Parallel_scheduler.schedule scheduler ~monitor ~f:(fun parallel -> (* Note [project] produces a contended image *) let width = Image.width (Capsule.Data.project image) in let height = Image.height (Capsule.Data.project image) in @@ -429,7 +429,7 @@ input, but that's perfectly fine here. ```ocaml let filter ~scheduler ~key image = let monitor = Parallel.Monitor.create_root () in - Parallel_scheduler_work_stealing.schedule scheduler ~monitor ~f:(fun parallel -> + Parallel_scheduler.schedule scheduler ~monitor ~f:(fun parallel -> let width = Image.width (Capsule.Data.project image) in let height = Image.height (Capsule.Data.project image) in let pixels = width * height in diff --git a/handson_activity/act02_gensym_atomics/dune b/handson_activity/act02_gensym_atomics/dune index 25d59ff..7483ef9 100644 --- a/handson_activity/act02_gensym_atomics/dune +++ b/handson_activity/act02_gensym_atomics/dune @@ -1,3 +1,3 @@ (executables (names gensym_atomics) - (libraries parallel parallel.scheduler.work_stealing)) + (libraries parallel parallel.scheduler)) diff --git a/handson_activity/act02_gensym_atomics/gensym_atomics.ml b/handson_activity/act02_gensym_atomics/gensym_atomics.ml index d81fe2d..92c2008 100644 --- a/handson_activity/act02_gensym_atomics/gensym_atomics.ml +++ b/handson_activity/act02_gensym_atomics/gensym_atomics.ml @@ -31,7 +31,7 @@ let gensym_pair par = (* Run parallel computation *) let run_parallel ~f = - let module Scheduler = Parallel_scheduler_work_stealing in + let module Scheduler = Parallel_scheduler in let scheduler = Scheduler.create () in let result = Scheduler.parallel scheduler ~f in Scheduler.stop scheduler; diff --git a/handson_activity/act03_gensym_capsules/dune b/handson_activity/act03_gensym_capsules/dune index 62ea089..e368c17 100644 --- a/handson_activity/act03_gensym_capsules/dune +++ b/handson_activity/act03_gensym_capsules/dune @@ -1,3 +1,3 @@ (executables (names gensym_capsules) - (libraries portable parallel parallel.scheduler.work_stealing)) + (libraries portable parallel parallel.scheduler)) diff --git a/handson_activity/act03_gensym_capsules/gensym_capsules.ml b/handson_activity/act03_gensym_capsules/gensym_capsules.ml index cb4c17a..a859827 100644 --- a/handson_activity/act03_gensym_capsules/gensym_capsules.ml +++ b/handson_activity/act03_gensym_capsules/gensym_capsules.ml @@ -53,7 +53,7 @@ let gensym_pair par = (* Run parallel computation *) let run_parallel ~f = - let module Scheduler = Parallel_scheduler_work_stealing in + let module Scheduler = Parallel_scheduler in let scheduler = Scheduler.create () in let result = Scheduler.parallel scheduler ~f in Scheduler.stop scheduler; diff --git a/handson_activity/act04_quicksort/dune b/handson_activity/act04_quicksort/dune index 878b335..82a67a4 100644 --- a/handson_activity/act04_quicksort/dune +++ b/handson_activity/act04_quicksort/dune @@ -1,3 +1,3 @@ (executables (names quicksort quicksort_reference) - (libraries base portable parallel parallel.scheduler.work_stealing)) + (libraries base portable parallel parallel.scheduler))