Awesome Multicore OCaml and Multicore Monorepo

A short announcement of two repositories which some people may or may not have seen. Firstly, Awesome Multicore OCaml, a place for gathering all of the rapidly changing experiments, ideas, libraries and resources for Multicore OCaml (including some of the discuss threads). If you are working on something or feel anything is missing please open a PR!

Secondly, a Multicore Monorepo which aims to provide a very quick and easy way to try out effects and parallelism with quite a few libraries (such as Eio, Dream etc.). The breaking changes introduced by OCaml 5 can make it frustrating to get such a setup in place, although this is less and less true thanks to the alpha repository. The idea is that you should just be able to clone this repository, create a new 5.0.0+trunk switch, install dune and start hacking. If that’s not the case please do open an issue.

14 Likes

Is this still the preferred way to play with multicore? I see I’m unable to install utop with the 5.0.0+trunk switch, totally understandable though.

However, after cloning the repo, attempting to dune build into the repo yields this error. Any tips on how to resolve this? Seems I can do trial/error to update the code since it’s all vendored.

File "duniverse/dream/src/vendor/h2/lib/scheduler.ml", lines 34-40, characters 10-6:
34 | ..........Hashtbl.MakeSeeded (struct
35 |     type t = Stream_identifier.t
36 |
37 |     let equal = Stream_identifier.( === )
38 |
39 |     let hash i k = Hashtbl.seeded_hash i k
40 |   end)
Error: Modules do not match:
       sig
         type t = int32
         val equal : t -> t -> bool
         val hash : int -> 'a -> int
       end
     is not included in Hashtbl.SeededHashedType
     The value `seeded_hash' is required but not provided
     File "hashtbl.mli", line 399, characters 4-36: Expected declaration

Ah, thanks for the report. I should really periodically build the repo with the latest trunk compiler. That issue is known though and this patch (which you can apply to the vendored h2 library) should get it working again.

Is this still the preferred way to play with multicore?

With the caveat that the repository builds, it should be a very quick way to build something with the vendored libraries. However, a trunk compiler switch with the alpha repository will get you a long way too.

1 Like

That solves it!

I tried to vendor ocamlformat and the lsp server. Would you know how to have the vscode extension the vendored version? Writing code without intellisense feels like writing code on paper.

Oh, hmm, before I even do that, I should look into building the lib separately on the 5.0 trunk switch. Assuming I vendored lsp correctly, dune build at least doesn’t fail.

Not sure about ocamlformat, but you could try pinning this lsp-server commit on your 5.0.0 switch. I don’t think it needs to be vendored.

opam pin -y git+https://github.com/patricoferris/ocaml-lsp#dc9a4ef8529628fe023e1ed034ffe6b517ea4f1a