Hack_parallel is a standalone parallel and shared memory library based on the components used in FB tools Hack, Flow, and Pyre. The internals of these components are little known outside of these projects, yet stand to benefit the OCaml community more generally, both for practical use and educational purposes. So I extracted the core parts and packaged it up; more information can be found in the project README.
You can ignore the scary THIS CODE ONLY WORKS WITH HACK. The implementation works generally (it’s used in Flow/Pyre and my own projects without problems). The warning is overcompensating so that people do not treat it like a “generic atomic hashtable for OCaml”. The data structure and constraints on memory operations are explained well here. I may document the points in the video in future, but hope that helps for now.
Came here after googling around. This lib does not work on FreeBSD, for your information. When starting Flow (must be run as root because of access to /dev/null, for whatever reason), it fails with “Out of shared memroy”.
What is the difference between parany and parmap by dicosmo?
If you rely on fork to process things in parallel, then here you have your difference: the hacks’s parallel library shines if you need shared memory. It’s like a poor’s man multicore while waiting for the official multicore in OCaml 5.0.