# Multicore OCaml: August 2020

**URL:** <https://discuss.ocaml.org/t/multicore-ocaml-august-2020/6418>\
**Category:** Community\
**Tags:** multicore, multicore-monthly\
**Created:** [September 14, 2020, 8:16am UTC](https://discuss.ocaml.org/t/multicore-ocaml-august-2020/6418 "2020-09-14T08:16:16Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![avsm](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/avsm/32/6_2.png) [@avsm](https://discuss.ocaml.org/u/avsm)\
**Post date:** [September 14, 2020, 8:16am UTC](https://discuss.ocaml.org/t/multicore-ocaml-august-2020/6418/1 "2020-09-14T08:16:16Z")

</div>

Welcome to the August 2020 Multicore OCaml report (a few weeks late due to August slowdown). This update along with the [previous updates](https://discuss.ocaml.org/tag/multicore-monthly) have been compiled by @shakthimaan, @kayceesrk and myself.

There are some talks related to multicore OCaml which are now freely available online:

- At the OCaml Workshop, @sadiq presented [“How to parallelise your code with Multicore OCaml”](https://www.youtube.com/watch?v=Z7YZR1q8wzI&list=PLKO_ZowsIOu5fHjRj0ua7_QWE_L789K_f&index=6&t=0s)
- At ICFP, @kayceesrk presented [“Retrofitting Parallelism onto OCaml”](https://www.youtube.com/watch?v=i9wgeX7e-nc&t=6180s), which was also awarded a Distinguished Paper award.
- At ICFP, Glenn Mével presented [“Cosmo: A Concurrent Separation Logic for Multicore OCaml”](https://www.youtube.com/watch?v=aNLOi-1ixwM&t=2610s).
- At the WebAssembly Community Group meeting, @kayceesrk gave a talk on [Effect Handlers in Multicore OCaml](https://kcsrk.info/slides/WASM_CG_4Aug20.pdf). This is related to our longer term efforts to ensure that OCaml has an efficient compilation strategy to WebAssembly.

The Multicore OCaml project has had a number of optimisations and performance improvements in the month of August 2020:

- The PR on the [implementation of systhreads with pthreads](https://github.com/ocaml-multicore/ocaml-multicore/pull/381) continues to undergo review and improvement. When merged, this opens up the possibility of installing dune and other packages with Multicore OCaml.
- Implementations of mutex and condition variables is also now [under review](https://github.com/ocaml-multicore/ocaml-multicore/pull/390) for the `Domain` module.
- Work has begun on implementing [GC safe points](https://github.com/ocaml-multicore/ocaml-multicore/pull/394) to ensure reliable, low-latency garbage collection can occur.

We would like to particularly thank these external contributors:

- Albin Coquereau and Guillaume Bury for their comments and recommendations on building Alt-Ergo.2.3.2 with dune.2.6.0 and Multicore OCaml 4.10.0 in a sandbox environment.
- @Leonidas for testing the code size metric implementation with `Core` and `Async`, and for code review changes.

Contributions such as the above towards adapting your projects with our benchmarking suites are always most welcome. As with previous updates, we begin with the Multicore OCaml updates, which are then followed by the enchancements and bug fixes to the Sandmark benchmarking project. The upstream OCaml ongoing and completed tasks are finally mentioned for your reference.

## Multicore OCaml

### Ongoing

- [ocaml-multicore/ocaml-multicore#381](https://github.com/ocaml-multicore/ocaml-multicore/pull/381)  
Reimplementating systhreads with pthreads

- [ocaml-multicore/ocaml-multicore#384](https://github.com/ocaml-multicore/ocaml-multicore/pull/384)  
Add a primitive to insert nop instruction

- [ocaml-multicore/ocaml-multicore#390](https://github.com/ocaml-multicore/ocaml-multicore/pull/390)  
Initial implementation of Mutexes and Condition Variables

### Completed

#### Optimisations

- [ocaml-multicore/domainslib#16](https://github.com/ocaml-multicore/domainslib/pull/16)  
Improvement of parallel\_for implementation

- [ocaml-multicore/multicore-opam](https://github.com/ocaml-multicore/multicore-opam/pull/28)  
Use `-j%{jobs}%` for multicore variant builds

- [ocaml-multicore/ocaml-multicore#374](https://github.com/ocaml-multicore/ocaml-multicore/pull/374)  
Force major slice on minor collection

- [ocaml-multicore/ocaml-multicore#378](https://github.com/ocaml-multicore/ocaml-multicore/pull/378)  
Hold onto empty pools if swept while allocating

- [ocaml-multicore/ocaml-multicore#379](https://github.com/ocaml-multicore/ocaml-multicore/pull/379)  
Interruptible mark and sweep

- [ocaml-multicore/ocaml-multicore#380](https://github.com/ocaml-multicore/ocaml-multicore/pull/380)  
Make DLS call to `caml_domain_dls_get` `@@noalloc`

- [ocaml-multicore/ocaml-multicore#382](https://github.com/ocaml-multicore/ocaml-multicore/pull/382)  
Optimise `caml_continuation_use_function`

- [ocaml-multicore/ocaml-multicore#389](https://github.com/ocaml-multicore/ocaml-multicore/pull/389)  
Avoid holding domain\_lock when using backup thread

#### Sundries

- [ocaml-multicore/ocaml-multicore#391](https://github.com/ocaml-multicore/ocaml-multicore/pull/391)  
Use `Word_val` for pointers with `Patomic_load`

- [ocaml-multicore/ocaml-multicore#392](https://github.com/ocaml-multicore/ocaml-multicore/pull/392)  
Include Ipoll in leaf function test

## Benchmarking

### Ongoing

- [ocaml-bench/sandmark#122](https://github.com/ocaml-bench/sandmark/issues/122)  
Measurements of code size

- [ocaml-bench/sandmark#169](https://github.com/ocaml-bench/sandmark/pull/169)  
Add check\_url for .json and pkg-config, m4 in Makefile

### Completed

#### Benchmarks

- [ocaml-bench/sandmark#107](https://github.com/ocaml-bench/sandmark/issues/107)  
Add Coq benchmarks

- [ocaml-bench/sandmark#151](https://github.com/ocaml-bench/sandmark/pull/151)  
Evolutionary algorithm parallel benchmark

- [ocaml-bench/sandmark#152](https://github.com/ocaml-bench/sandmark/pull/152)  
LU decomposition: random numbers initialisation in parallel

- [ocaml-bench/sandmark#153](https://github.com/ocaml-bench/sandmark/pull/153)  
Add computationally intensive Coq benchmarks

- [ocaml-bench/sandmark#155](https://github.com/ocaml-bench/sandmark/pull/155)  
Sequential version of Evolutionary Algorithm

- [ocaml-bench/sandmark#157](https://github.com/ocaml-bench/sandmark/pull/157)  
Minilight Multicore: Port to Task API and DLS for Random States

- [ocaml-bench/sandmark#164](https://github.com/ocaml-bench/sandmark/pull/164)  
Tweaks to multicore-numerical/game\_of\_life

#### Bug Fixes

- [ocaml-bench/sandmark#156](https://github.com/ocaml-bench/sandmark/pull/156)  
Fix calculation of Nbody Multicore

- [ocaml-bench/sandmark#158](https://github.com/ocaml-bench/sandmark/pull/158)  
Fix key error for Grammatrix for Jupyter notebook

#### Sundries

- [ocaml-bench/sandmark#154](https://github.com/ocaml-bench/sandmark/pull/154)  
Revert PARAMWRAPPER changes

- [ocaml-bench/sandmark#160](https://github.com/ocaml-bench/sandmark/pull/160)  
Specify prefix,libdir for alt-ergo sandbox builds

- [ocaml-bench/sandmark#162](https://github.com/ocaml-bench/sandmark/pull/162)  
Avoid installing packages which are unused for Multicore runs

- [ocaml-bench/sandmark#163](https://github.com/ocaml-bench/sandmark/pull/163)  
Update to domainslib 0.2.2 and use default chunk\_size

## OCaml

### Ongoing

- [ocaml/ocaml#9756](https://github.com/ocaml/ocaml/pull/9756)  
Garbage collectors colour change

### Completed

- [ocaml/ocaml#9722](https://github.com/ocaml/ocaml/pull/9722)  
EINTR-based signals, again

Our thanks to all the OCaml developers and users in the community for their support and contribution to the project. Stay safe!

## Acronyms

- API: Application Programming Interface
- DLS: Domain Local Storage
- GC: Garbage Collector
- OPAM: OCaml Package Manager
- LU: Lower Upper (decomposition)
- PR: Pull Request

---

_[View the full topic](https://discuss.ocaml.org/t/multicore-ocaml-august-2020/6418)._
