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 support for parallel array initialisation #6

Open
kayceesrk opened this issue Apr 23, 2020 · 3 comments
Open

Add support for parallel array initialisation #6

kayceesrk opened this issue Apr 23, 2020 · 3 comments

Comments

@kayceesrk
Copy link
Contributor

Array initialisation is likely to be the source of bottlenecks in parallel workloads. Array initialisation for arbitrary typed elements needs to be sequential since the elements need to be initialised to a sensible value before GC gets to see it. However, for primitive types, int and float, one can allow parallel initialisation. OCaml supports Array.create_float, which returns uninitialised array, which can then be initialised in parallel. One can also safely return an uninitialized integer array by

let create_int : int -> int array = Obj.magic (Array.create_float)

Once the array is created, it can then be initialised in parallel.

@kayceesrk
Copy link
Contributor Author

@Sudha247 you might be interested implementing this.

@kayceesrk
Copy link
Contributor Author

Some work in progress to support this upstream: ocaml/ocaml#9513

@kayceesrk kayceesrk moved this from To do to To do: Performance in Domains-only Multicore OCaml May 1, 2020
@kayceesrk
Copy link
Contributor Author

Better way to implement this thanks to @stedolan https://gist.github.com/stedolan/f0cb0f5ab24f283d398e48763db1ae62

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Domains-only Multicore OCaml
  
To do: Performance
Development

No branches or pull requests

1 participant