@@ -177,17 +177,17 @@ this on `utop`.
177177``` ocaml
178178# open Domainslib
179179
180- # let pool = Task.setup_pool ~num_domains :3
180+ # let pool = Task.setup_pool ~num_additional_domains :3
181181val pool : Task.pool = <abstr>
182182```
183183We have created a new task pool with three new domains. The parent domain is
184- also part of this pool, thus making it a pool of four domains. After the pool
185- is setup, we can use this pool to execute all tasks we want to run in parallel.
186- The ` setup_pool ` function requires us to specify the number of new domains to
187- be spawned in the task pool. The ideal number of domains to initiate a task
188- pool with is equal to the number of cores available. Since the parent domain
189- also takes part in the pool, the ` num_domains ` parameter should be one less
190- than the number of available cores.
184+ also part of this pool, thus making it a pool of four domains. After the pool is
185+ setup, we can use this pool to execute all tasks we want to run in parallel. The
186+ ` setup_pool ` function requires us to specify the number of new domains to be
187+ spawned in the task pool. The ideal number of domains to initiate a task pool
188+ with is equal to the number of cores available. Since the parent domain also
189+ takes part in the pool, the ` num_additional_domains ` parameter should be one
190+ less than the number of available cores.
191191
192192Closing the task pool after execution of all tasks, though not strictly
193193necessary, is highly recommended. This can be done as
@@ -704,7 +704,7 @@ let n = try int_of_string Sys.argv.(2) with _ -> 100000
704704let a = Array.create_float n
705705
706706let _ =
707- let pool = Task.setup_pool ~num_domains :(num_domains - 1) in
707+ let pool = Task.setup_pool ~num_additional_domains :(num_domains - 1) in
708708 Task.parallel_for pool ~start:0
709709 ~finish:(n - 1) ~body:(fun i -> Array.set a i (Random.float 1000.));
710710 Task.teardown_pool pool
@@ -751,7 +751,7 @@ let num_domains = try int_of_string Sys.argv.(1) with _ -> 4
751751let arr = Array.create_float n
752752
753753let _ =
754- let domains = T.setup_pool ~num_domains :(num_domains - 1) in
754+ let domains = T.setup_pool ~num_additional_domains :(num_domains - 1) in
755755 let states = Array.init num_domains (fun _ -> Random.State.make_self_init()) in
756756 T.parallel_for domains ~start:0 ~finish:(n-1)
757757 ~body:(fun i ->
@@ -813,7 +813,7 @@ let init_part s e arr =
813813 done
814814
815815let _ =
816- let domains = T.setup_pool ~num_domains :(num_domains - 1) in
816+ let domains = T.setup_pool ~num_additional_domains :(num_domains - 1) in
817817 T.parallel_for domains ~chunk_size:1 ~start:0 ~finish:(num_domains - 1)
818818 ~body:(fun i -> init_part (i * n / num_domains) ((i+1) * n / num_domains - 1) arr);
819819 T.teardown_pool domains
0 commit comments