Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add parallel scan #5

Merged
merged 4 commits into from
Apr 27, 2020
Merged

Conversation

Sudha247
Copy link
Contributor

No description provided.

lib/task.ml Outdated
~body:(fun i ->
let s = (i * n) / (p ) in
let e = (i + 1) * n / (p ) - 1 in
(* Printf.printf "s = %d e = %d\n" s e; *)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove comments.

lib/task.mli Outdated

val parallel_scan : pool -> ('a -> 'a -> 'a) -> 'a array -> 'a array
(** [parallel_scan p op a] computes the scan of the array a
* in parallel with binary operator op and returns the result array.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* in parallel with binary operator op and returns the result array.
* in parallel with binary operator [op] and returns the result array.

lib/task.mli Outdated
@@ -39,3 +39,9 @@ val parallel_for_reduce : pool -> ('a -> 'a -> 'a) -> 'a -> chunk_size:int ->
(** [parallel_for_reduce p r i c s f b] is similar to [parallel_for] except
* that the result returned by each iteration is reduced with [r] with initial
* value [i]. *)

val parallel_scan : pool -> ('a -> 'a -> 'a) -> 'a array -> 'a array
(** [parallel_scan p op a] computes the scan of the array a
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
(** [parallel_scan p op a] computes the scan of the array a
(** [parallel_scan p op a] computes the scan of the array [a]

lib/task.mli Outdated
val parallel_scan : pool -> ('a -> 'a -> 'a) -> 'a array -> 'a array
(** [parallel_scan p op a] computes the scan of the array a
* in parallel with binary operator op and returns the result array.
* Scan is similar to Array.fold_left but returns an array of reduced
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* Scan is similar to Array.fold_left but returns an array of reduced
* Scan is similar to [Array.fold_left] but returns an array of reduced

@kayceesrk
Copy link
Contributor

Can you comment on how this scales @Sudha247?

@Sudha247
Copy link
Contributor Author

Sudha247 commented Apr 27, 2020

These are some numbers for the prefix_sum test with input 100_000_000:

#Cores time time (prefix_sum function) Speedup
1 3.07 2.15 1.00
2 2.98 2.05 1.04
4 2.42 1.5 1.43
8 2.24 1.22 1.76
12 2.05 1.13 1.90
16 2.02 1.09 1.97
20 2.05 1.12 1.91
24 2.06 1.13 1.90

@kayceesrk
Copy link
Contributor

Thanks. I'll merge this one. We should revisit the performance. I would be curious to know where the overheads lie.

@kayceesrk kayceesrk merged commit 0363964 into ocaml-multicore:master Apr 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants